tei.su/public/cheerio/js/app.b5356de7.js
2024-08-03 07:53:14 +03:00

2 lines
No EOL
15 KiB
JavaScript

(function(t){function e(e){for(var i,r,a=e[0],l=e[1],c=e[2],u=0,h=[];u<a.length;u++)r=a[u],Object.prototype.hasOwnProperty.call(o,r)&&o[r]&&h.push(o[r][0]),o[r]=0;for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(t[i]=l[i]);f&&f(e);while(h.length)h.shift()();return s.push.apply(s,c||[]),n()}function n(){for(var t,e=0;e<s.length;e++){for(var n=s[e],i=!0,r=1;r<n.length;r++){var a=n[r];0!==o[a]&&(i=!1)}i&&(s.splice(e--,1),t=l(l.s=n[0]))}return t}var i={},r={app:0},o={app:0},s=[];function a(t){return l.p+"js/"+({}[t]||t)+"."+{"chunk-6f440a42":"cb49e7e1"}[t]+".js"}function l(e){if(i[e])return i[e].exports;var n=i[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.e=function(t){var e=[],n={"chunk-6f440a42":1};r[t]?e.push(r[t]):0!==r[t]&&n[t]&&e.push(r[t]=new Promise((function(e,n){for(var i="css/"+({}[t]||t)+"."+{"chunk-6f440a42":"0068aa0c"}[t]+".css",o=l.p+i,s=document.getElementsByTagName("link"),a=0;a<s.length;a++){var c=s[a],u=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(u===i||u===o))return e()}var h=document.getElementsByTagName("style");for(a=0;a<h.length;a++){c=h[a],u=c.getAttribute("data-href");if(u===i||u===o)return e()}var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.onload=e,f.onerror=function(e){var i=e&&e.target&&e.target.src||o,s=new Error("Loading CSS chunk "+t+" failed.\n("+i+")");s.code="CSS_CHUNK_LOAD_FAILED",s.request=i,delete r[t],f.parentNode.removeChild(f),n(s)},f.href=o;var p=document.getElementsByTagName("head")[0];p.appendChild(f)})).then((function(){r[t]=0})));var i=o[t];if(0!==i)if(i)e.push(i[2]);else{var s=new Promise((function(e,n){i=o[t]=[e,n]}));e.push(i[2]=s);var c,u=document.createElement("script");u.charset="utf-8",u.timeout=120,l.nc&&u.setAttribute("nonce",l.nc),u.src=a(t);var h=new Error;c=function(e){u.onerror=u.onload=null,clearTimeout(f);var n=o[t];if(0!==n){if(n){var i=e&&("load"===e.type?"missing":e.type),r=e&&e.target&&e.target.src;h.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",h.name="ChunkLoadError",h.type=i,h.request=r,n[1](h)}o[t]=void 0}};var f=setTimeout((function(){c({type:"timeout",target:u})}),12e4);u.onerror=u.onload=c,document.head.appendChild(u)}return Promise.all(e)},l.m=t,l.c=i,l.d=function(t,e,n){l.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},l.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},l.t=function(t,e){if(1&e&&(t=l(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)l.d(n,i,function(e){return t[e]}.bind(null,i));return n},l.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return l.d(e,"a",e),e},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.p="",l.oe=function(t){throw console.error(t),t};var c=window["webpackJsonp"]=window["webpackJsonp"]||[],u=c.push.bind(c);c.push=e,c=c.slice();for(var h=0;h<c.length;h++)e(c[h]);var f=u;s.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var i=n("85ec"),r=n.n(i);r.a},1:function(t,e){},2:function(t,e){},3:function(t,e){},"56d7":function(t,e,n){"use strict";n.r(e);n("159b"),n("e260"),n("e6cf"),n("cca6"),n("a79d");var i,r=n("2b0e"),o=n("289d"),s=(n("5abe"),n("a70e")),a=n.n(s),l=n("4dd1"),c=n.n(l),u=(n("efe0"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h2",{staticClass:"page-title"},[t._v("Cheerio REPL")]),n("div",{staticClass:"columns"},[t.left?n("div",{staticClass:"column"},[n("CodeMirror",{ref:"editor",attrs:{options:t.cmOptions},model:{value:t.inputHtml,callback:function(e){t.inputHtml=e},expression:"inputHtml"}}),n("div",{staticClass:"buttons"},[n("b-button",{on:{click:t.prettify}},[t._v("Prettify")]),n("b-button",{on:{click:t.load}},[t._v("cheerio.load")])],1)],1):t._e(),n("div",{staticClass:"column"},[n("Repl",{ref:"repl",class:t.left?"":"repl-full-width",attrs:{globals:{cheerio:t.cheerio}}},[n("b-button",{staticClass:"hide-btn",on:{click:function(e){t.left=!t.left}}},[t._v(t._s(t.left?"< hide":"> show"))])],1)],1)])])}),h=[],f=(n("a15b"),n("d3b7"),n("02cc")),p=n.n(f),d=n("e552"),v=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{ref:"output",staticClass:"repl-output"},[n("div",{staticClass:"repl-header level"},[n("div",{staticClass:"level-left"},[t._t("default"),n("h2",[t._v("Output")])],2),n("div",{staticClass:"level-right"},[n("b-button",{staticStyle:{"margin-right":"4px"},attrs:{"icon-right":"backup-restore"},on:{click:t.resetSandbox}}),n("b-button",{attrs:{"icon-right":"broom"},on:{click:t.clear}})],1)]),n("div",{staticClass:"repl-history"},t._l(t.items,(function(e,i){return n("div",{key:i,staticClass:"repl-history-item"},[e.console?n("div",{staticClass:"repl-history-item__console",domProps:{innerHTML:t._s(e.html)}}):n("pre",{directives:[{name:"hljs",rawName:"v-hljs"}],staticClass:"repl-history-item__code"},[n("code",{staticClass:"javascript"},[t._v(t._s(e.expr))])]),"result"in e?n("b-message",{staticClass:"is-family-monospace repl-history-item__response"},[n("pre",{directives:[{name:"hljs",rawName:"v-hljs"}]},[n("code",{staticClass:"javascript"},[t._v(t._s(e.result))])])]):t._e(),"error"in e?n("b-message",{staticClass:"is-family-monospace repl-history-item__error",attrs:{type:"is-danger"}},[n("pre",[n("code",[t._v(t._s(e.error))])])]):t._e()],1)})),0),t.items.length?n("div",{staticClass:"repl-spacer"}):n("div",{staticClass:"repl-placeholder"},[n("h1",[t._v("🐓")]),n("h2",[t._v("Nothing here but us chickens.")])]),n("div",{staticClass:"repl-input"},[n("b-field",[n("b-input",{ref:"input",staticClass:"is-expanded is-family-monospace repl-input__field",style:{height:48+Math.min(24*t.inputLines,192)+"px"},attrs:{type:"textarea"},nativeOn:{keydown:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.evaluate(e)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?null:t.fromHistoryEvent(e,1)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.fromHistoryEvent(e,-1)}]},model:{value:t.input,callback:function(e){t.input=e},expression:"input"}}),n("p",{staticClass:"control"},[n("b-button",{attrs:{"icon-right":"send",disabled:0===this.input.length},on:{click:t.evaluate}})],1)],1)],1)])},m=[],y=(n("d81d"),n("ac1f"),n("466d"),n("1276"),n("e25e"),n("25f0"),n("99de")),g=n("7e84"),b=n("45eb"),_=n("262e"),w=n("d4ec"),x=n("bee2"),k=function(){function t(){Object(w["a"])(this,t),this._first=null,this._last=null,this.length=0}return Object(x["a"])(t,[{key:"push",value:function(t){var e={prev:null,next:null,value:t};null===this._first?this._first=this._last=e:(e.prev=this._last,this._last.next=this._last=e),this.length++}},{key:"pop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length-1;if(!(t<0||t>=this.length)){var e;if(0===t)e=this._first,this._first=this._first.next,this._first.prev=null;else if(t===this.length-1)e=this._last,this._last=this._last.prev,this._last.prev=null;else{e=this._get(t);var n=e.prev,i=e.next;n.next=i,i.prev=n}return this.length-=1,e.value}}},{key:"shift",value:function(){return this.pop(0)}},{key:"unshift",value:function(t){var e={prev:null,next:null,value:t};null===this._first?this._first=this._last=e:(e.next=this._first,this._first.prev=this._first=e),this.length++}},{key:"_get",value:function(t){if(t=parseInt(t),void 0===t||isNaN(t))return{};if(0===t)return this._first;if(t===this.length-1)return this._last;if(t>=this.length)return{};if(t<this.length/2){for(var e=this._first,n=0;n<t;n++)e=e.next;return e}for(var i=this._last,r=0;r<this.length-t-1;r++)i=i.prev;return i}},{key:"toArray",value:function(){if(0===this.length)return[];var t=this._first,e=[t.value];while(null!==t.next)e[e.length]=t.next.value,t=t.next;return e}},{key:"join",value:function(t){return this.toArray().join(t)}},{key:"toString",value:function(){return this.toArray().toString()}},{key:"get",value:function(t){return this._get(t).value}},{key:"last",value:function(){return this._last.value}},{key:"first",value:function(){return this._first.value}},{key:"clear",value:function(){this._first=null,this._last=null,this.length=0}}]),t}(),C=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return Object(w["a"])(this,e),t=Object(y["a"])(this,Object(g["a"])(e).call(this)),t.capacity=n,t}return Object(_["a"])(e,t),Object(x["a"])(e,[{key:"unshift",value:function(t){Object(b["a"])(Object(g["a"])(e.prototype),"unshift",this).call(this,t),this._checkCapacity()}},{key:"push",value:function(t){throw Error("cant be used")}},{key:"pop",value:function(t){throw Error("cant be used")}},{key:"shift",value:function(t){throw Error("cant be used")}},{key:"_checkCapacity",value:function(){while(this.length>this.capacity)this._first=this._first.next,this._first.prev=null}}]),e}(k),j=function(){function t(){Object(w["a"])(this,t),this.iframe=document.createElement("iframe"),this.iframe.style.display="none",document.body.appendChild(this.iframe),this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.document.open(),this.document.write("<script>var MSIE/*@cc_on =1@*/;_e=MSIE?this:{eval:function(s){return window.eval(s)}}<\/script>"),this.document.close(),this._eval=this.window._e,delete this.window._e,this.window.loadScript=this.loadScript}return Object(x["a"])(t,[{key:"evaluate",value:function(t){return this._eval.eval(t)}},{key:"loadScript",value:function(t){var e=this;return new Promise((function(n,i){e.evaluate("_s = document.createElement('script');_s.setAttribute('type','text/javascript');_s.setAttribute('src',".concat(JSON.stringify(t))),e.window._s.onload=n,e.window._s.onerror=i,e.window._s.onreadystatechange=function(t){"complete"!==e.window._s&&"loaded"!==e.window._s||n()},e.evaluate("document.getElementsByTagName('head')[0].appendChild(_s);delete _s;")}))}},{key:"dispose",value:function(){document.body.removeChild(this.iframe)}}]),t}(),O=j,S=(n("a4d3"),n("e01a"),n("99af"),n("b0c0"),n("bf19"),n("53ca")),E=n("eed9"),N=n.n(E);"undefined"!==typeof Symbol&&(i=Symbol.for("nodejs.util.inspect.custom"));var P=function(t){return t&&"object"===Object(S["a"])(t)&&"tag"===t.type&&"name"in t&&"namespace"in t&&"x-attribsNamespace"in t||"text"===t.type&&"data"in t};function A(t){if(t&&t.prototype&&"[cheerio object]"===t.prototype.cheerio)return"CheerioRoot {}";if(t&&t._root&&t._root.constructor&&t._root.constructor.prototype&&"[cheerio object]"===t._root.constructor.prototype.cheerio)return"CheerioSearch { length: ".concat(t.length," }");if(t&&P(t)){var e="Cheerio".concat("text"===t.type?"Text":"","Node {");return"tag"===t.type?e+="\n name: ".concat(JSON.stringify(t.name),",\n attribs: ").concat(A(t.attribs),",\n children: [Node x").concat(t.children.length,"],"):"text"===t.type&&(e+="\n data: ".concat(JSON.stringify(t.data),",")),e+="\n prev: ".concat(t.prev?"Node":null,",\n next: ").concat(t.next?"Node":null,",\n parent: ").concat(t.parent?"Node":null,"\n}"),e}return t&&Array.isArray(t)&&t[0]&&P(t[0])&&(t="[\n"+t.map((function(t){return A(t).split("\n").map((function(t){return" "+t})).join("\n")})).join(",\n")+"\n]"),t&&"object"===Object(S["a"])(t)&&"toJSON"in t&&(t=t.toJSON()),t&&i&&t[i]&&(t=t[i]()),"string"===typeof t?t||"<empty string>":N.a.inspect(t,{compact:!1,depth:2})}var H={name:"Repl",props:{globals:{type:Object,default:function(){return{}}}},data:function(){return{items:[],input:"",inputLines:0,history:new C,historyPosition:-1,sandbox:null}},methods:{resetSandbox:function(){this.sandbox=new O,Object.assign(this.sandbox.window,this.globals);var t=this;this.sandbox.window.console={log:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=n.map((function(t){return A(t)}));t.addResult({console:!0,html:"<pre><code>".concat(r.join(" "),"</code></pre>")})}},this.sandbox.window.clear=this.clear.bind(this),this.clear()},clear:function(){this.items=[]},evaluate:function(t){t&&(t.shiftKey||t.ctrlKey)||!this.input.length||(t&&(t.preventDefault(),t.stopPropagation()),this.runCode(this.input),this.history.unshift(this.input),this.historyPosition=-1,this.input="")},runCode:function(t){var e={expr:t};this.addResult(e);try{var n=this.sandbox.evaluate(t);this.$set(e,"result",A(n)),this.sandbox.window.$_=n}catch(i){this.$set(e,"error",i)}},addResult:function(t){this.items.push(t)},fromHistoryEvent:function(t,e){var n=t.target.value.substr(0,t.target.selectionStart).split("\n").length-1;(0===n&&e>0||n===this.inputLines&&e<0)&&this.fromHistory(e)},fromHistory:function(t){var e=this;if(!(this.historyPosition>=this.history.length-1&&t>0||-1===this.historyPosition&&t<0)){this.historyPosition+=t,this.historyPosition<=-1?(this.historyPosition=-1,this.input=""):this.input=this.history.get(this.historyPosition);var n=this.$refs.input.$refs.textarea;setTimeout((function(){n.setSelectionRange(e.input.length,e.input.length)}),10)}}},watch:{input:function(t){var e=t.match(/\n/g);this.inputLines=(e||[]).length},items:function(){var t=this;setTimeout((function(){t.$refs.output.scrollTop=t.$refs.output.scrollHeight}),10)}},mounted:function(){this.resetSandbox();var t=this;Object.defineProperty(window,"S",{get:function(){return t.sandbox.window},configurable:!0})}},T=H,$=(n("c973"),n("2877")),L=Object($["a"])(T,v,m,!1,null,null,null),M=L.exports,R=function(t,e){if(t.length<=e)return t;var n=(e-3)/2;return t.substring(0,n%1===0?n:Math.round(n))+"..."+t.substring(t.length-n)},J={name:"app",components:{Repl:M,CodeMirror:function(){return n.e("chunk-6f440a42").then(n.bind(null,"d31c"))}},data:function(){return{cheerio:p.a,left:!0,cmOptions:{mode:"text/html",theme:"default",lint:!0,lineNumbers:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],autoCloseTags:!0,styleActiveLine:!0,extraKeys:{"Ctrl-Space":"autocomplete",Tab:function(t){!0!==t.execCommand("emmetExpandAbbreviation")&&(t.somethingSelected()?t.indentSelection("add"):t.replaceSelection(Array(t.getOption("indentUnit")+1).join(" "),"end","+input"))}},placeholder:"<html>...</html>",indentUnit:4},inputHtml:""}},methods:{prettify:function(){this.inputHtml=Object(d["html"])(this.inputHtml,{indentSize:4})},load:function(){var t={expr:"$ = cheerio.load(".concat(JSON.stringify(R(this.inputHtml,25)),")")};this.$refs.repl.addResult(t);try{this.$refs.repl.sandbox.window.$=p.a.load(this.inputHtml)}catch(e){this.$set(t,"error",e)}}},watch:{left:function(t){localStorage.left=t}},mounted:function(){localStorage.left||(localStorage.left="true"),this.left="true"===localStorage.left}};window.cheerio=p.a;var B=J,D=(n("034f"),Object($["a"])(B,u,h,!1,null,null,null)),U=D.exports;a.a.registerLanguage("javascript",c.a),r["a"].directive("hljs",{deep:!0,bind:function(t,e){var n=t.querySelectorAll("code");n.forEach((function(t){e.value&&(t.textContent=e.value),a.a.highlightBlock(t)}))},componentUpdated:function(t,e){var n=t.querySelectorAll("code");n.forEach((function(t){e.value&&(t.textContent=e.value,a.a.highlightBlock(t))}))}}),r["a"].use(o["a"]),r["a"].config.productionTip=!1,new r["a"]({render:function(t){return t(U)}}).$mount("#app")},"5a20":function(t,e,n){},"85ec":function(t,e,n){},c973:function(t,e,n){"use strict";var i=n("5a20"),r=n.n(i);r.a}});
//# sourceMappingURL=app.b5356de7.js.map