blockbench/lib/VuePrismEditor.min.js

17 lines
27 KiB
JavaScript
Raw Normal View History

2019-12-15 20:04:31 +01:00
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["VuePrismEditor"]=e():t["VuePrismEditor"]=e()})("undefined"!==typeof self?self:this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"02f4":function(t,e,n){var r=n("4588"),i=n("be13");t.exports=function(t){return function(e,n){var o,c,a=String(i(e)),u=r(n),s=a.length;return u<0||u>=s?t?"":void 0:(o=a.charCodeAt(u),o<55296||o>56319||u+1===s||(c=a.charCodeAt(u+1))<56320||c>57343?t?a.charAt(u):o:t?a.slice(u,u+2):c-56320+(o-55296<<10)+65536)}}},"0390":function(t,e,n){"use strict";var r=n("02f4")(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"0bfb":function(t,e,n){"use strict";var r=n("cb7c");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},"214f":function(t,e,n){"use strict";n("b0c5");var r=n("2aba"),i=n("32e9"),o=n("79e5"),c=n("be13"),a=n("2b4c"),u=n("520a"),s=a("species"),f=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),l=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=a(t),p=!o(function(){var e={};return e[d]=function(){return 7},7!=""[t](e)}),h=p?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[s]=function(){return n}),n[d](""),!e}):void 0;if(!p||!h||"replace"===t&&!f||"split"===t&&!l){var v=/./[d],g=n(c,d,""[t],function(t,e,n,r,i){return e.exec===u?p&&!i?{done:!0,value:v.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),m=g[0],y=g[1];r(String.prototype,t,m),i(RegExp.prototype,d,2==e?function(t,e){return y.call(t,this,e)}:function(t){return y.call(t,this)})}}},"230e":function(t,e,n){var r=n("d3f4"),i=n("7726").document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},"23c6":function(t,e,n){var r=n("2d95"),i=n("2b4c")("toStringTag"),o="Arguments"==r(function(){return arguments}()),c=function(t,e){try{return t[e]}catch(n){}};t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=c(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},"28a5":function(t,e,n){"use strict";var r=n("aae3"),i=n("cb7c"),o=n("ebd6"),c=n("0390"),a=n("9def"),u=n("5f1b"),s=n("520a"),f=n("79e5"),l=Math.min,d=[].push,p="split",h="length",v="lastIndex",g=4294967295,m=!f(function(){RegExp(g,"y")});n("214f")("split",2,function(t,e,n,f){var y;return y="c"=="abbc"[p](/(b)*/)[1]||4!="test"[p](/(?:)/,-1)[h]||2!="ab"[p](/(?:ab)*/)[h]||4!="."[p](/(.?)(.?)/)[h]||"."[p](/()()/)[h]>1||""[p](/.?/)[h]?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);var o,c,a,u=[],f=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,p=void 0===e?g:e>>>0,m=new RegExp(t.source,f+"g");while(o=s.call(m,i)){if(c=m[v],c>l&&(u.push(i.slice(l,o.index)),o[h]>1&&o.index<i[h
/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/var r=/["'&<>]/;function i(t){var e,n=""+t,i=r.exec(n);if(!i)return n;var o="",c=0,a=0;for(c=i.index;c<n.length;c++){switch(n.charCodeAt(c)){case 34:e="&quot;";break;case 38:e="&amp;";break;case 39:e="&#39;";break;case 60:e="&lt;";break;case 62:e="&gt;";break;default:continue}a!==c&&(o+=n.substring(a,c)),a=c+1,o+=e}return a!==c?o+n.substring(a,c):o}t.exports=i},7726:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"79e5":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},8378:function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},"86cc":function(t,e,n){var r=n("cb7c"),i=n("c69a"),o=n("6a99"),c=Object.defineProperty;e.f=n("9e1e")?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return c(t,e,n)}catch(a){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},"8a8d":function(t,e){function n(t,e){return t^e}t.exports=n},"954e":function(t,e,n){"use strict";var r,i=n("cf4f"),o={},c={default:{"&quot;":'"',"&#34;":'"',"&apos;":"'","&#39;":"'","&amp;":"&","&#38;":"&","&gt;":">","&#62;":">","&lt;":"<","&#60;":"<"},extras:{"&cent;":"¢","&#162;":"¢","&copy;":"©","&#169;":"©","&euro;":"","&#8364;":"","&pound;":"£","&#163;":"£","&reg;":"®","&#174;":"®","&yen;":"¥","&#165;":"¥"}};function a(t,e){if(!s(t))return"";var n=c[e||"default"],r=u(e,n);return t.replace(r,function(t){return n[t]})}function u(t,e){if(o[t])return o[t];var n=Object.keys(e).join("|"),r=new RegExp("(?=("+n+"))\\1","g");return o[t]=r,r}function s(t){return t&&"string"===typeof t}Object.defineProperty(c,"all",{get:function(){return r||(r=i({},c.default,c.extras))}}),a.chars=c.default,a.extras=c.extras,Object.defineProperty(a,"all",{get:function(){return c.all}}),t.exports=a},"9b43":function(t,e,n){var r=n("d8e8");t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},"9def":function(t,e,n){var r=n("4588"),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},"9e1e":function(t,e,n){t.exports=!n("79e5")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},a481:function(t,e,n){"use strict";var r=n("cb7c"),i=n("4bf8"),o=n("9def"),c=n("4588"),a=n("0390"),u=n("5f1b"),s=Math.max,f=Math.min,l=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,p=/\$([$&`']|\d\d?)/g,h=function(t){return void 0===t?t:String(t)};n("214f")("replace",2,function(t,e,n,v){return[function(r,i){var o=t(this),c=void 0==r?void 0:r[e];return void 0!==c?c.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=v(n,t,this,e);if(i.done)return i.value;var l=r(t),d=String(this),p="function"===typeof e;p||(e=String(e));var m=l.global;if(m){var y=l.unicode;l.lastIndex=0}var b=[];while(1){var x=u(l,d);if(null===x)break;if(b.push(x),!m)break;var S=String(x[0]);""===S&&(l.lastIndex=a(d,o(l.lastIndex),y))}for(var _="",C=0,w=0;w<b.length;w++){x=b[w];for(var k=String(x[0]),T=s(f(c(x.index),d.length),0),E=[],O=1;O<x.length;O++)E.push(h(x[O]));var j=x.groups;if(p){var $=[k].concat(E,T,d);void 0!==j&&$.push(j);var N=String(e.apply(void 0,$))}else N=g(k,d,T,E,j,e);T>=C&&(_+=d.slice(C,T)+N,C=T+k.length)}return _+d.slice(C)}];function g(t,e,r,o,c,a){var u=r+t.length,s=o.length,f=p;return void 0!==c&&(c=i(c),f=d),n.call(a,f,function(n,i){var a;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(u);case"<":a=c[i.slice(1,-1)];break;default:var f=+i;if(0===f)return n;if(f>s){var d=l(f/10);return 0===d?n:d<=s?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):n}a=o[f-1]}return void 0===a?"":a})}})},aae3:function(t,e,n){var r=n("d3f4"),i=n("2d95"),o=n("2b4c")("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},ad9a:function(t,e){var n
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/t.exports=function(t){return"undefined"!==typeof t&&null!==t&&("object"===typeof t||"function"===typeof t)}},ebd6:function(t,e,n){var r=n("cb7c"),i=n("d8e8"),o=n("2b4c")("species");t.exports=function(t,e){var n,c=r(t).constructor;return void 0===c||void 0==(n=r(c)[o])?e:i(n)}},f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(r){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fa5b:function(t,e,n){t.exports=n("5537")("native-function-to-string",Function.toString)},fb15:function(t,e,n){"use strict";var r;(n.r(e),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(n.p=r[1]));var i=function(){var t,e=this,n=e.$createElement,r=e._self._c||n;return r("div",{staticClass:"prism-editor-wrapper"},[e.lineNumbers?r("div",{staticClass:"prism-editor__line-numbers",style:{"min-height":e.lineNumbersHeight},attrs:{"aria-hidden":"true"}},[r("div",{staticClass:"prism-editor__line-width-calc",staticStyle:{height:"0px",visibility:"hidden","pointer-events":"none"}},[e._v("\n 999\n ")]),e._l(e.lineNumbersCount,function(t){return r("div",{key:t,staticClass:"prism-editor__line-number token comment"},[e._v("\n "+e._s(t)+"\n ")])})],2):e._e(),r("pre",{ref:"pre",staticClass:"prism-editor__code",class:(t={},t["language-"+e.language]=!0,t),attrs:{contenteditable:!e.readonly,spellCheck:"false",autocapitalize:"off",autocomplete:"off",autocorrect:"off","data-gramm":"false"},domProps:{innerHTML:e._s(e.content)},on:{keydown:e.handleKeyDown,keyup:e.handleKeyUp,click:e.handleClick}})])},o=[],c=(n("aef6"),n("28a5"),n("74a0")),a=n.n(c);function u(t,e,n){return"text"===e&&(t=a()(t)),'<code class="language-'.concat(n,'">').concat(t,"</code>")}var s=function(t,e){if(!e)return u(t,"text","text");e=e.toLowerCase();var n=e;if("vue"!==e&&"html"!==e||(e="markup"),"md"===e&&(e="markdown"),"ts"===e&&(e="typescript"),Prism.languages[e]){var r=Prism.highlight(t,Prism.languages[e],e);return u(r,n,e)}return u(t,"text","text")},f=(n("a481"),function(t){return t.replace("\n","<br>")}),l=f,d=n("954e"),p=n.n(d),h=function(t){return p()(t.replace(/<br>/gm,"\n").replace(/<\/?[^>]*>/gm,""))},v=h,g=(n("6b54"),n("72d6")),m=n.n(g);function y(t,e){var n=window.getSelection();if(1==arguments.length){if(!n.rangeCount)return;var r={},i=n.getRangeAt(0),o=i.cloneRange();return o.selectNodeContents(t),o.setEnd(i.endContainer,i.endOffset),r.end=o.toString().length,o.setStart(i.startContainer,i.startOffset),r.start=r.end-o.toString().length,r.atStart=0===o.startOffset,r.commonAncestorContainer=o.commonAncestorContainer,r.endContainer=o.endContainer,r.startContainer=o.startContainer,r}var c,a,u=e.end&&e.end!==e.start,s=0,f=(i=document.createRange(),m()(t).select(Node.TEXT_NODE).revisit(!1)),l=e.start>t.textContent.length?t.textContent.length:e.start,d=e.end>t.textContent.length?t.textContent.length:e.end,p=e.atStart;while(c=f.next()){var h=s;s+=c.textContent.length;var v=p?s>l:s>=l;if(!a&&v&&(a=!0,i.setStart(c,l-h),!u)){i.collapse(!0),b(t,i);break}if(u&&s>=d){i.setEnd(c,d-h),b(t,i);break}}}function b(t,e){var n=window.getSelection();t.focus(),n.removeAllRanges(),n.addRange(e)}var x=y,S=(n("4917"),function(t,e){var n=t.slice(0,e),r=n.lastIndexOf("\n")+1,i=n.slice(r);return i}),_=/^\s+/,C=function(t,e){var n=S(t,e),r=n.match(_);return null===r?"":r[0]||""},w=/^(\t| {2})* {2}$/,k=function(t,e){var n=S(t,e);return w.test(n)?2:0},T={model:{prop:"code",event:"change"},props:{emitEvents:{type:Boolean,default:!1},language:{type:String,default:"js"},lineNumbers:{type:Boolean,default:!1},autoStyleLineNumbers:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},code:{type:String,default:""}},data:function(){return{undoStack:[],selection:void 0,lineNumbersHeight:"20px",undoOffset:0,undoTimestamp:0,lastPos:0,codeData:"",composing:!1}},watch:{code:{immediate:!0,handler:function(t){thi
//# sourceMappingURL=VuePrismEditor.umd.min.js.map
Vue.component('vue-prism-editor', VuePrismEditor)