PageSourceSearch

https://camtasia.ai/dist/releases/ff5f93b147b99675/chat.js

js camtasia.ai collected 2026-10-04 05:26:41 UTC 1,135,385 bytes, 2,121 lines download raw bytes

1"use strict";(()=>{var jg=Object.create;var Sc=Object.defineProperty;var Gg=Object.getOwnPropertyDescriptor;var Vg=Object.getOwnPropertyNames;var Kg=Object.getPrototypeOf,Yg=Object.prototype.hasOwnProperty;var Ec=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Ye=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Zg=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Vg(e))!Yg.call(t,c)&&c!==r&&Sc(t,c,{get:()=>e[c],enumerable:!(s=Gg(e,c))||s.enumerable});return t};var sr=(t,e,r)=>(r=t!=null?jg(Kg(t)):{},Zg(e||!t||!t.__esModule?Sc(r,"default",{value:t,enumerable:!0}):r,t));var Oc=Ye((rS,$s)=>{var Is=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,s=Object.defineProperty||function(P,H,W){P[H]=W.value},c,f=typeof Symbol=="function"?Symbol:{},i=f.iterator||"@@iterator",d=f.asyncIterator||"@@asyncIterator",n=f.toStringTag||"@@toStringTag";function o(P,H,W){return Object.defineProperty(P,H,{value:W,enumerable:!0,configurable:!0,writable:!0}),P[H]}try{o({},"")}catch{o=function(H,W,K){return H[W]=K}}function a(P,H,W,K){var G=H&&H.prototype instanceof y?H:y,X=Object.create(G.prototype),Z=new O(K||[]);return s(X,"_invoke",{value:R(P,W,Z)}),X}t.wrap=a;function l(P,H,W){try{return{type:"normal",arg:P.call(H,W)}}catch(K){return{type:"throw",arg:K}}}var u="suspendedStart",h="suspendedYield",p="executing",g="completed",m={};function y(){}function b(){}function C(){}var E={};o(E,i,function(){return this});var w=Object.getPrototypeOf,k=w&&w(w(D([])));k&&k!==e&&r.call(k,i)&&(E=k);var I=C.prototype=y.prototype=Object.create(E);b.prototype=C,s(I,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:b,configurable:!0}),b.displayName=o(C,n,"GeneratorFunction");function L(P){["next","throw","return"].forEach(function(H){o(P,H,function(W){return this._invoke(H,W)})})}t.isGeneratorFunction=function(P){var H=typeof P=="function"&&P.constructor;return H?H===b||(H.displayName||H.name)==="GeneratorFunction":!1},t.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,C):(P.__proto__=C,o(P,n,"GeneratorFunction")),P.prototype=Object.create(I),P},t.awrap=function(P){return{__await:P}};function F(P,H){function W(X,Z,q,Q){var ie=l(P[X],P,Z);if(ie.type==="throw")Q(ie.arg);else{var ae=ie.arg,oe=ae.value;return oe&&typeof oe=="object"&&r.call(oe,"__await")?H.resolve(oe.__await).then(function(fe){W("next",fe,q,Q)},function(fe){W("throw",fe,q,Q)}):H.resolve(oe).then(function(fe){ae.value=fe,q(ae)},function(fe){return W("throw",fe,q,Q)})}}var K;function G(X,Z){function q(){return new H(function(Q,ie){W(X,Z,Q,ie)})}return K=K?K.then(q,q):q()}s(this,"_invoke",{value:G})}L(F.prototype),o(F.prototype,d,function(){return this}),t.AsyncIterator=F,t.async=function(P,H,W,K,G){G===void 0&&(G=Promise);var X=new F(a(P,H,W,K),G);return t.isGeneratorFunction(H)?X:X.next().then(function(Z){return Z.done?Z.value:X.next()})};function R(P,H,W){var K=u;return function(X,Z){if(K===p)throw new Error("Generator is already running");if(K===g){if(X==="throw")throw Z;return B()}for(W.method=X,W.arg=Z;;){var q=W.delegate;if(q){var Q=M(q,W);if(Q){if(Q===m)continue;return Q}}if(W.method==="next")W.sent=W._sent=W.arg;else if(W.method==="throw"){if(K===u)throw K=g,W.arg;W.dispatchException(W.arg)}else W.method==="return"&&W.abrupt("return",W.arg);K=p;var ie=l(P,H,W);if(ie.type==="normal"){if(K=W.done?g:h,ie.arg===m)continue;return{value:ie.arg,done:W.done}}else ie.type==="throw"&&(K=g,W.method="throw",W.arg=ie.arg)}}}function M(P,H){var W=H.method,K=P.iterator[W];if(K===c)return H.delegate=null,W==="throw"&&P.iterator.return&&(H.method="return",H.arg=c,M(P,H),H.method==="throw")||W!=="return"&&(H.method="throw",H.arg=new TypeError("The iterator does not provide a '"+W+"' method")),m;var G=l(K,P.iterator,H.arg);if(G.type==="throw")return H.method="throw",H.arg=G.arg,H.delegate=null,m;var X=G.arg;if(!X)return H.method="throw",H.arg=new TypeError("iterator result is not an object"),H.delegate=null,m;if(X.done)H[P.resultName]=X.value,H.next=P.nextLoc,H.method!=="return"&&(H.method="next",H.arg=c);else return X;return H.delegate=null,m}L(I),o(I,n,"Generator"),o(I,i,function(){return this}),o(I,"toString",function(){return"[object Generator]"});function A(P){var H={tryLoc:P[0]};1 in P&&(H.catchLoc=P[1]),2 in P&&(H.finallyLoc=P[2],H.afterLoc=P[3]),this.tryEntries.push(H)}function _(P){var H=P.completion||{};H.type="normal",delete H.arg,P.completion=H}function O(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(A,this),this.reset(!0)}t.keys=function(P){var H=Object(P),W=[];for(var K in H)W.push(K);return W.reverse(),function G(){for(;W.length;){var X=W.pop();if(X in H)return G.value=X,G.done=!1,G}return G.done=!0,G}};function D(P){if(P){var H=P[i];if(H)return H.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var W=-1,K=function G(){for(;++W<P.length;)if(r.call(P,W))return G.value=P[W],G.done=!1,G;return G.value=c,G.done=!0,G};return K.next=K}}return{next:B}}t.values=D;function B(){return{value:c,done:!0}}return O.prototype={constructor:O,reset:function(P){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEac
1h(_),!P)for(var H in this)H.charAt(0)==="t"&&r.call(this,H)&&!isNaN(+H.slice(1))&&(this[H]=c)},stop:function(){this.done=!0;var P=this.tryEntries[0],H=P.completion;if(H.type==="throw")throw H.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var H=this;function W(Q,ie){return X.type="throw",X.arg=P,H.next=Q,ie&&(H.method="next",H.arg=c),!!ie}for(var K=this.tryEntries.length-1;K>=0;--K){var G=this.tryEntries[K],X=G.completion;if(G.tryLoc==="root")return W("end");if(G.tryLoc<=this.prev){var Z=r.call(G,"catchLoc"),q=r.call(G,"finallyLoc");if(Z&&q){if(this.prev<G.catchLoc)return W(G.catchLoc,!0);if(this.prev<G.finallyLoc)return W(G.finallyLoc)}else if(Z){if(this.prev<G.catchLoc)return W(G.catchLoc,!0)}else if(q){if(this.prev<G.finallyLoc)return W(G.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(P,H){for(var W=this.tryEntries.length-1;W>=0;--W){var K=this.tryEntries[W];if(K.tryLoc<=this.prev&&r.call(K,"finallyLoc")&&this.prev<K.finallyLoc){var G=K;break}}G&&(P==="break"||P==="continue")&&G.tryLoc<=H&&H<=G.finallyLoc&&(G=null);var X=G?G.completion:{};return X.type=P,X.arg=H,G?(this.method="next",this.next=G.finallyLoc,m):this.complete(X)},complete:function(P,H){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&H&&(this.next=H),m},finish:function(P){for(var H=this.tryEntries.length-1;H>=0;--H){var W=this.tryEntries[H];if(W.finallyLoc===P)return this.complete(W.completion,W.afterLoc),_(W),m}},catch:function(P){for(var H=this.tryEntries.length-1;H>=0;--H){var W=this.tryEntries[H];if(W.tryLoc===P){var K=W.completion;if(K.type==="throw"){var G=K.arg;_(W)}return G}}throw new Error("illegal catch attempt")},delegateYield:function(P,H,W){return this.delegate={iterator:D(P),resultName:H,nextLoc:W},this.method==="next"&&(this.arg=c),m}},t}(typeof $s=="object"?$s.exports:{});try{regeneratorRuntime=Is}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=Is:Function("r","regeneratorRuntime = r")(Is)}});var $i=Ye((iS,Nc)=>{Nc.exports=(t,e)=>`${t}-${e}-${Math.random().toString(16).slice(3,8)}`});var Os=Ye((oS,Fc)=>{var cm=$i(),Dc=0;Fc.exports=({id:t,action:e,payload:r={}})=>{let s=t;return typeof s>"u"&&(s=cm("Job",Dc),Dc+=1),{id:s,action:e,payload:r}}});var Oi=Ye(Gr=>{var Ns=!1;Gr.logging=Ns;Gr.setLogging=t=>{Ns=t};Gr.log=(...t)=>Ns?console.log.apply(Gr,t):null});var Uc=Ye((Bc,Hc)=>{var um=Os(),{log:Ni}=Oi(),dm=$i(),Pc=0;Hc.exports=()=>{let t=dm("Scheduler",Pc),e={},r={},s=[];Pc+=1;let c=()=>s.length,f=()=>Object.keys(e).length,i=()=>{if(s.length!==0){let l=Object.keys(e);for(let u=0;u<l.length;u+=1)if(typeof r[l[u]]>"u"){s[0](e[l[u]]);break}}},d=(l,u)=>new Promise((h,p)=>{let g=um({action:l,payload:u});s.push(async m=>{s.shift(),r[m.id]=g;try{h(await m[l].apply(Bc,[...u,g.id]))}catch(y){p(y)}finally{delete r[m.id],i()}}),Ni(`[${t}]: Add ${g.id} to JobQueue`),Ni(`[${t}]: JobQueue length=${s.length}`),i()});return{addWorker:l=>(e[l.id]=l,Ni(`[${t}]: Add ${l.id}`),Ni(`[${t}]: Number of workers=${f()}`),i(),l.id),addJob:async(l,...u)=>{if(f()===0)throw Error(`[${t}]: You need to have at least one worker before adding jobs`);return d(l,u)},terminate:async()=>{Object.keys(e).forEach(async l=>{await e[l].terminate()}),s=[]},getQueueLen:c,getNumWorkers:f}}});var zc=Ye((aS,Wc)=>{function hm(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}Wc.exports=hm});var Gc=Ye((lS,jc)=>{var fm=zc();jc.exports=t=>{let e={};return typeof WorkerGlobalScope<"u"?e.type="webworker":fm()?e.type="electron":typeof document=="object"?e.type="browser":typeof process=="object"&&typeof Ec=="function"&&(e.type="node"),typeof t>"u"?e:e[t]}});var Kc=Ye((uS,Vc)=>{var pm=Gc()("type")==="browser",gm=pm?t=>new URL(t,window.location.href).href:t=>t;Vc.exports=t=>{let e={...t};return["corePath","workerPath","langPath"].forEach(r=>{t[r]&&(e[r]=gm(e[r]))}),e}});var Zc=Ye((dS,Yc)=>{Yc.exports=t=>{let e=[],r=[],s=[],c=[],f=[];return t.blocks&&t.blocks.forEach(i=>
1{i.paragraphs.forEach(d=>{d.lines.forEach(n=>{n.words.forEach(o=>{o.symbols.forEach(a=>{f.push({...a,page:t,block:i,paragraph:d,line:n,word:o})}),c.push({...o,page:t,block:i,paragraph:d,line:n})}),s.push({...n,page:t,block:i,paragraph:d})}),r.push({...d,page:t,block:i})}),e.push({...i,page:t})}),{...t,blocks:e,paragraphs:r,lines:s,words:c,symbols:f}}});var Ds=Ye((hS,Xc)=>{Xc.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var qc=Ye((fS,mm)=>{mm.exports={name:"tesseract.js",version:"5.1.1",description:"Pure Javascript Multilingual OCR",main:"src/index.js",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.mjs","profile:tesseract":"webpack-bundle-analyzer dist/tesseract-stats.json","profile:worker":"webpack-bundle-analyzer dist/worker-stats.json",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.min.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:* test:node:all","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node -- ./tests/*.test.js","test:browser-tpl":"mocha-headless-chrome -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:detect":"npm run test:browser-tpl -- -f ./tests/detect.test.html","test:browser:recognize":"npm run test:browser-tpl -- -f ./tests/recognize.test.html","test:browser:scheduler":"npm run test:browser-tpl -- -f ./tests/scheduler.test.html","test:browser:FS":"npm run test:browser-tpl -- -f ./tests/FS.test.html",lint:"eslint src","lint:fix":"eslint --fix src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.21.4","@babel/eslint-parser":"^7.21.3","@babel/preset-env":"^7.21.4","@rollup/plugin-commonjs":"^24.1.0",acorn:"^8.8.2","babel-loader":"^9.1.2",buffer:"^6.0.3",cors:"^2.8.5",eslint:"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.27.5","expect.js":"^0.3.1",express:"^4.18.2",mocha:"^10.2.0","mocha-headless-chrome":"^4.0.0","npm-run-all":"^4.1.5",nyc:"^15.1.0",rimraf:"^5.0.0",rollup:"^3.20.7","wait-on":"^7.0.1",webpack:"^5.79.0","webpack-bundle-analyzer":"^4.8.0","webpack-cli":"^5.0.1","webpack-dev-middleware":"^6.0.2","rollup-plugin-sourcemaps":"^0.6.3"},dependencies:{"bmp-js":"^0.1.0","idb-keyval":"^6.2.0","is-electron":"^2.2.2","is-url":"^1.2.4","node-fetch":"^2.6.9","opencollective-postinstall":"^2.0.3","regenerator-runtime":"^0.13.3","tesseract.js-core":"^5.1.1","wasm-feature-detect":"^1.2.11",zlibjs:"^0.3.1"},overrides:{"@rollup/pluginutils":"^5.0.2"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}});var Qc=Ye((pS,Jc)=>{Jc.exports={workerBlobURL:!0,logger:()=>{}}});var tu=Ye((gS,eu)=>{var vm=qc().version,ym=Qc();eu.exports={...ym,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${vm}/dist/worker.min.js`}});var ru=Ye((mS,nu)=>{nu.exports=({workerPath:t,workerBlobURL:e})=>{let r;if(Blob&&URL&&e){let s=new Blob([`importScripts("${t}");`],{type:"application/javascript"});r=new Worker(URL.createObjectURL(s))}else r=new Worker(t);return r}});var ou=Ye((vS,iu)=>{iu.exports=t=>{t.terminate()}});var au=Ye((yS,su)=>{su.exports=(t,e)=>{t.onmessage=({data:r})=>{e(r)}}});var cu=Ye((bS,lu)=>{lu.exports=async(t,e)=>{t.postMessage(e)}});var du=Ye((wS,uu)=>{var Fs=t=>new Promise((e,r)=>{let s=new FileReader;s.onload=()=>{e(s.result)},s.onerror=({target:{error:{code:c}}})=>{r(Error(`File could not be read! Code=${c}`))},s.readAsArrayBuffer(t)}),Ps=async t=>{let e=t;if(typeof t>"u")return"undefined";if(typeof t=="string")/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(t)?e=atob(t.split(",")[1]).split("").map(r=>r.charCodeAt(0)):e=await(await fetch(t)).arrayBuffer();else if(typeof HTMLElement<"u"&&t instanceof HTMLElement)t.tagName==="IMG"&&(e=await Ps(t.src)),t.tagName==="VIDEO"&&(e=await Ps(t.poster)),t.tagName==="CANVAS"&&await new Promise(r=>{t.toBlob(async s=>{e=await Fs(s),r()})});else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas){let r=await t.convertToBlob();e=await Fs(r)}else(t instanceof File||t instanceof Blob)&&(e=await Fs(t));return new Uint8Array(e)};uu.exports=Ps});var fu=Ye((xS,hu)=>
1{var bm=tu(),wm=ru(),xm=ou(),Sm=au(),Em=cu(),Cm=du();hu.exports={defaultOptions:bm,spawnWorker:wm,terminateWorker:xm,onMessage:Sm,send:Em,loadImage:Cm}});var Bs=Ye((SS,vu)=>{var _m=Kc(),Am=Zc(),mn=Os(),{log:pu}=Oi(),Tm=$i(),lr=Ds(),{defaultOptions:km,spawnWorker:Mm,terminateWorker:Lm,onMessage:Rm,loadImage:gu,send:Im}=fu(),mu=0;vu.exports=async(t="eng",e=lr.LSTM_ONLY,r={},s={})=>{let c=Tm("Worker",mu),{logger:f,errorHandler:i,...d}=_m({...km,...r}),n={},o={},a=typeof t=="string"?t.split("+"):t,l=e,u=s,h=[lr.DEFAULT,lr.LSTM_ONLY].includes(e)&&!d.legacyCore,p,g,m=new Promise((Z,q)=>{g=Z,p=q}),y=Z=>{p(Z.message)},b=Mm(d);b.onerror=y,mu+=1;let C=(Z,q)=>{n[Z]=q},E=(Z,q)=>{o[Z]=q},w=({id:Z,action:q,payload:Q})=>new Promise((ie,ae)=>{pu(`[${c}]: Start ${Z}, action=${q}`);let oe=`${q}-${Z}`;C(oe,ie),E(oe,ae),Im(b,{workerId:c,jobId:Z,action:q,payload:Q})}),k=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),I=Z=>w(mn({id:Z,action:"load",payload:{options:{lstmOnly:h,corePath:d.corePath,logging:d.logging}}})),L=(Z,q,Q)=>w(mn({id:Q,action:"FS",payload:{method:"writeFile",args:[Z,q]}})),F=(Z,q)=>w(mn({id:q,action:"FS",payload:{method:"readFile",args:[Z,{encoding:"utf8"}]}})),R=(Z,q)=>w(mn({id:q,action:"FS",payload:{method:"unlink",args:[Z]}})),M=(Z,q,Q)=>w(mn({id:Q,action:"FS",payload:{method:Z,args:q}})),A=()=>console.warn("`loadLanguage` is depreciated and should be removed from code (workers now come with language pre-loaded)"),_=(Z,q)=>w(mn({id:q,action:"loadLanguage",payload:{langs:Z,options:{langPath:d.langPath,dataPath:d.dataPath,cachePath:d.cachePath,cacheMethod:d.cacheMethod,gzip:d.gzip,lstmOnly:[lr.DEFAULT,lr.LSTM_ONLY].includes(l)&&!d.legacyLang}}})),O=()=>console.warn("`initialize` is depreciated and should be removed from code (workers now come pre-initialized)"),D=(Z,q,Q,ie)=>w(mn({id:ie,action:"initialize",payload:{langs:Z,oem:q,config:Q}})),B=(Z="eng",q,Q,ie)=>{if(h&&[lr.TESSERACT_ONLY,lr.TESSERACT_LSTM_COMBINED].includes(q))throw Error("Legacy model requested but code missing.");let ae=q||l;l=ae;let oe=Q||u;u=oe;let he=(typeof Z=="string"?Z.split("+"):Z).filter(xe=>!a.includes(xe));return a.push(...he),he.length>0?_(he,ie).then(()=>D(Z,ae,oe,ie)):D(Z,ae,oe,ie)},P=(Z={},q)=>w(mn({id:q,action:"setParameters",payload:{params:Z}})),H=async(Z,q={},Q={blocks:!0,text:!0,hocr:!0,tsv:!0},ie)=>w(mn({id:ie,action:"recognize",payload:{image:await gu(Z),options:q,output:Q}})),W=(Z="Tesseract OCR Result",q=!1,Q)=>(console.log("`getPDF` function is depreciated. `recognize` option `savePDF` should be used instead."),w(mn({id:Q,action:"getPDF",payload:{title:Z,textonly:q}}))),K=async(Z,q)=>{if(h)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return w(mn({id:q,action:"detect",payload:{image:await gu(Z)}}))},G=async()=>(b!==null&&(Lm(b),b=null),Promise.resolve());Rm(b,({workerId:Z,jobId:q,status:Q,action:ie,data:ae})=>{let oe=`${ie}-${q}`;if(Q==="resolve"){pu(`[${Z}]: Complete ${q}`);let fe=ae;ie==="recognize"?fe=Am(ae):ie==="getPDF"&&(fe=Array.from({...ae,length:Object.keys(ae).length})),n[oe]({jobId:q,data:fe})}else if(Q==="reject")if(o[oe](ae),ie==="load"&&p(ae),i)i(ae);else throw Error(ae);else Q==="progress"&&f({...ae,userJobId:q})});let X={id:c,worker:b,setResolve:C,setReject:E,load:k,writeText:L,readText:F,removeFile:R,FS:M,loadLanguage:A,initialize:O,reinitialize:B,setParameters:P,recognize:H,getPDF:W,detect:K,terminate:G};return I().then(()=>_(t)).then(()=>D(t,e,s)).then(()=>g(X)).catch(()=>{}),m}});var wu=Ye((ES,bu)=>{var yu=Bs(),$m=async(t,e,r)=>{let s=await yu(e,1,r);return s.recognize(t).finally(async()=>{await s.terminate()})},Om=async(t,e)=>{let r=await yu("osd",0,e);return r.detect(t).finally(async()=>{await r.terminate()})};bu.exports={recognize:$m,detect:Om}});var Su=Ye((CS,xu)=>{xu.exports={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",
1SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}});var Cu=Ye((_S,Eu)=>{Eu.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}});var Au=Ye((AS,_u)=>{Oc();var Nm=Uc(),Dm=Bs(),Fm=wu(),Pm=Su(),Bm=Ds(),Hm=Cu(),{setLogging:Um}=Oi();_u.exports={languages:Pm,OEM:Bm,PSM:Hm,createScheduler:Nm,createWorker:Dm,setLogging:Um,...Fm}});var qf=Ye((Xf,es)=>{(function(){var t="ace",e=function(){return this}();if(!e&&typeof window<"u"&&(e=window),!t&&typeof requirejs<"u")return;var r=function(n,o,a){if(typeof n!="string"){r.original?r.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(a=o),r.modules[n]||(r.payloads[n]=a,r.modules[n]=null)};r.modules={},r.payloads={};var s=function(n,o,a){if(typeof o=="string"){var l=i(n,o);if(l!=null)return a&&a(),l}else if(Object.prototype.toString.call(o)==="[object Array]"){for(var u=[],h=0,p=o.length;h<p;++h){var g=i(n,o[h]);if(g==null&&c.original)return;u.push(g)}return a&&a.apply(null,u)||!0}},c=function(n,o){var a=s("",n,o);return a==null&&c.original?c.original.apply(this,arguments):a},f=function(n,o){if(o.indexOf("!")!==-1){var a=o.split("!");return f(n,a[0])+"!"+f(n,a[1])}if(o.charAt(0)=="."){var l=n.split("/").slice(0,-1).join("/");for(o=l+"/"+o;o.indexOf(".")!==-1&&u!=o;){var u=o;o=o.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return o},i=function(n,o){o=f(n,o);var a=r.modules[o];if(!a){if(a=r.payloads[o],typeof a=="function"){var l={},u={id:o,uri:"",exports:l,packaged:!0},h=function(g,m){return s(o,g,m)},p=a(h,l,u);l=p||u.exports,r.modules[o]=l,delete r.payloads[o]}a=r.modules[o]=l||a}return a};function d(n){var o=e;n&&(e[n]||(e[n]={}),o=e[n]),(!o.define||!o.define.packaged)&&(r.original=o.define,o.define=r,o.define.packaged=!0),(!o.require||!o.require.packaged)&&(c.original=o.require,o.require=c,o.require.packaged=!0)}d(t)})();ace.define("ace/lib/es6-shim",["require","exports","module"],function(t,e,r){function s(c,f,i){Object.defineProperty(c,f,{value:i,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||s(String.prototype,"startsWith",function(c,f){return f=f||0,this.lastIndexOf(c,f)===f}),String.prototype.endsWith||s(String.prototype,"endsWith",function(c,f){var i=this;(f===void 0||f>i.length)&&(f=i.length),f-=c.length;var d=i.indexOf(c,f);return d!==-1&&d===f}),String.prototype.repeat||s(String.prototype,"repeat",function(c){for(var f="",i=this;c>0;)c&1&&(f+=i),(c>>=1)&&(i+=i);return f}),String.prototype.includes||s(String.prototype,"includes",function(c,f){return this.indexOf(c,f)!=-1}),Object.assign||(Object.assign=function(c){if(c==null)throw new TypeError("Cannot convert undefined or null to object");for(var f=Object(c),i=1;i<arguments.length;i++){var d=arguments[i];d!=null&&Object.keys(d).forEach(function(n){f[n]=d[n]})}return f}),Object.values||(Object.values=function(c){return Object.keys(c).map(function(f){return c[f]})}),Array.prototype.find||s(Array.prototype,"find",function(c){for(var f=this.length,i=arguments[1],d=0;d<f;d++){var n=this[d];if(c.call(i,n,d,this))return n}}),Array.prototype.findIndex||s(Array.prototype,"findIndex",function(c){for(var f=this.length,i=arguments[1],d=0;d<f;d++){var n=this[d];if(c.call(i,n,d,this))return d}}),Array.prototype.includes||s(Array.prototype,"includes",function(c,f){return this.indexOf(c,f)!=-1}),Array.prototype.fill||s(Array.prototype,"fill",function(c){for(var f=this,i=f.length>>>0,d=arguments[1],n=d>>0,o=n<0?Math.max(i+n,0):Math.min(n,i),a=arguments[2],l=a===void 0?i:a>>0,u=l<0?Math.max(i+l,0):Math.min(l,i);o<u;)f[o]=c,o++;return f}),Array.of||s(Array,"of",function(){return Array.prototype.slice.call(arguments)})});ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(t,e,r){"use strict";t("./es6-shim")});ace.define("ace/lib/deep_copy",["require","exports","module"],function(t,e,r){e.deepCopy=function s(c){if(typeof c!="object"||!c)return c;var f;
1if(Array.isArray(c)){f=[];for(var i=0;i<c.length;i++)f[i]=s(c[i]);return f}if(Object.prototype.toString.call(c)!=="[object Object]")return c;f={};for(var i in c)f[i]=s(c[i]);return f}});ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(t,e,r){"use strict";e.last=function(f){return f[f.length-1]},e.stringReverse=function(f){return f.split("").reverse().join("")},e.stringRepeat=function(f,i){for(var d="";i>0;)i&1&&(d+=f),(i>>=1)&&(f+=f);return d};var s=/^\s\s*/,c=/\s\s*$/;e.stringTrimLeft=function(f){return f.replace(s,"")},e.stringTrimRight=function(f){return f.replace(c,"")},e.copyObject=function(f){var i={};for(var d in f)i[d]=f[d];return i},e.copyArray=function(f){for(var i=[],d=0,n=f.length;d<n;d++)f[d]&&typeof f[d]=="object"?i[d]=this.copyObject(f[d]):i[d]=f[d];return i},e.deepCopy=t("./deep_copy").deepCopy,e.arrayToMap=function(f){for(var i={},d=0;d<f.length;d++)i[f[d]]=1;return i},e.createMap=function(f){var i=Object.create(null);for(var d in f)i[d]=f[d];return i},e.arrayRemove=function(f,i){for(var d=0;d<=f.length;d++)i===f[d]&&f.splice(d,1)},e.escapeRegExp=function(f){return f.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},e.escapeHTML=function(f){return(""+f).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},e.getMatchOffsets=function(f,i){var d=[];return f.replace(i,function(n){d.push({offset:arguments[arguments.length-2],length:n.length})}),d},e.deferredCall=function(f){var i=null,d=function(){i=null,f()},n=function(o){return n.cancel(),i=setTimeout(d,o||0),n};return n.schedule=n,n.call=function(){return this.cancel(),f(),n},n.cancel=function(){return clearTimeout(i),i=null,n},n.isPending=function(){return i},n},e.delayedCall=function(f,i){var d=null,n=function(){d=null,f()},o=function(a){d==null&&(d=setTimeout(n,a||i))};return o.delay=function(a){d&&clearTimeout(d),d=setTimeout(n,a||i)},o.schedule=o,o.call=function(){this.cancel(),f()},o.cancel=function(){d&&clearTimeout(d),d=null},o.isPending=function(){return d},o},e.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},e.skipEmptyMatch=function(f,i,d){return d&&f.codePointAt(i)>65535?2:1}});ace.define("ace/lib/useragent",["require","exports","module"],function(t,e,r){"use strict";e.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},e.getOS=function(){return e.isMac?e.OS.MAC:e.isLinux?e.OS.LINUX:e.OS.WINDOWS};var s=typeof navigator=="object"?navigator:{},c=(/mac|win|linux/i.exec(s.platform)||["other"])[0].toLowerCase(),f=s.userAgent||"",i=s.appName||"";e.isWin=c=="win",e.isMac=c=="mac",e.isLinux=c=="linux",e.isIE=i=="Microsoft Internet Explorer"||i.indexOf("MSAppHost")>=0?parseFloat((f.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((f.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),e.isOldIE=e.isIE&&e.isIE<9,e.isGecko=e.isMozilla=f.match(/ Gecko\/\d+/),e.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",e.isWebKit=parseFloat(f.split("WebKit/")[1])||void 0,e.isChrome=parseFloat(f.split(" Chrome/")[1])||void 0,e.isSafari=parseFloat(f.split(" Safari/")[1])&&!e.isChrome||void 0,e.isEdge=parseFloat(f.split(" Edge/")[1])||void 0,e.isAIR=f.indexOf("AdobeAIR")>=0,e.isAndroid=f.indexOf("Android")>=0,e.isChromeOS=f.indexOf(" CrOS ")>=0,e.isIOS=/iPad|iPhone|iPod/.test(f)&&!window.MSStream,e.isIOS&&(e.isMac=!0),e.isMobile=e.isIOS||e.isAndroid});ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(t,e,r){"use strict";var s=t("./useragent"),c="http://www.w3.org/1999/xhtml";e.buildDom=function a(l,u,h){if(typeof l=="string"&&l){var p=document.createTextNode(l);return u&&u.appendChild(p),p}if(!Array.isArray(l))return l&&l.appendChild&&u&&u.appendChild(l),l;if(typeof l[0]!="string"||!l[0]){for(var g=[],m=0;m<l.length;m++){var y=a(l[m],u,h);y&&g.push(y)}return g}var b=document.createElement(l[0]),C=l[1],E=1;C&&typeof C=="object"&&!Array.isArray(C)&&(E=2);for(var m=E;m<l.length;m++)a(l[m],b,h);return E==2&&Object.keys(C).forEach(function(w){var k=C[w];w==="class"?b.className=Array.isArray(k)?k.join(" "):k:typeof k=="function"||w=="value"||w[0]=="$"?b[w]=k:w==="ref"?h&&(h[k]=b):w==="style"?typeof k=="string"&&(b.style.cssText=k):k!=null&&b.setAttribute(w,k)}),u&&u.appendChild(b),b},e.getDocumentHead=function(a){return a||(a=document),a.head||a.getElementsByTagName("head")[0]||a.documentElement},e.createElement=function(a,l){return document.createElementNS?document.createElementNS(l||c,a):document.createElement(a)},e.removeChildren=function(a){a.innerHTML=""},e.createTextNode=function(a,l){var u=l?l.ownerDocument:document;return u.createTextNode(a)},e.createFragment=function(a){var l=a?a.ownerDocument:document;return l.createDocumentFragment()},e.hasCssClass=function(a,l){var u=(a.className+"").split(/\s+/g);return u.indexOf(l)!==-1},e.addCssClass=function(a,l){e.hasCssClass(a,l)||(a.className+=" "+l)},e.removeCssClass=function(a,l){for(var u=a.className.split(/\s+/g);;){var h=u.indexOf(l);if(h==-1)break;u.splice(h,1)}a.className=u.join(" ")},e.toggleCssClass=function(a,l){for(var u=a.className.split(/\s+/g),h=!0;;){var p=u.indexOf(l);if(p==-1)break;h=!1,u.splice(p,1)}return h&&u.push(l),a.className=u.join(" "),h},e.setCssClass=function(a,l,u){u?e.addCssClass(a,l):e.removeCssClass(a,l)},e.hasCssString=function(a,l){var u=0,h;if(l=l||document,h=l.querySelectorAll("style")){for(;u<h.length;)if(h[u++].id===a)return!0}},e.removeElementById=function(a,l){l=l||document,l.getElementById(a)&&l.getElementById(a).remove()};var f,i=[];
1e.useStrictCSP=function(a){f=a,a==!1?d():i||(i=[])};function d(){var a=i;i=null,a&&a.forEach(function(l){n(l[0],l[1])})}function n(a,l,u){if(!(typeof document>"u")){if(i){if(u)d();else if(u===!1)return i.push([a,l])}if(!f){var h=u;!u||!u.getRootNode?h=document:(h=u.getRootNode(),(!h||h==u)&&(h=document));var p=h.ownerDocument||h;if(l&&e.hasCssString(l,h))return null;l&&(a+=`
2/*# sourceURL=ace/css/`+l+" */");var g=e.createElement("style");g.appendChild(p.createTextNode(a)),l&&(g.id=l),h==p&&(h=e.getDocumentHead(p)),h.insertBefore(g,h.firstChild)}}}if(e.importCssString=n,e.importCssStylsheet=function(a,l){e.buildDom(["link",{rel:"stylesheet",href:a}],e.getDocumentHead(l))},e.scrollbarWidth=function(a){var l=e.createElement("ace_inner");l.style.width="100%",l.style.minWidth="0px",l.style.height="200px",l.style.display="block";var u=e.createElement("ace_outer"),h=u.style;h.position="absolute",h.left="-10000px",h.overflow="hidden",h.width="200px",h.minWidth="0px",h.height="150px",h.display="block",u.appendChild(l);var p=a&&a.documentElement||document&&document.documentElement;if(!p)return 0;p.appendChild(u);var g=l.offsetWidth;h.overflow="scroll";var m=l.offsetWidth;return g===m&&(m=u.clientWidth),p.removeChild(u),g-m},e.computedStyle=function(a,l){return window.getComputedStyle(a,"")||{}},e.setStyle=function(a,l,u){a[l]!==u&&(a[l]=u)},e.HAS_CSS_ANIMATION=!1,e.HAS_CSS_TRANSFORMS=!1,e.HI_DPI=s.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,s.isChromeOS&&(e.HI_DPI=!1),typeof document<"u"){var o=document.createElement("div");e.HI_DPI&&o.style.transform!==void 0&&(e.HAS_CSS_TRANSFORMS=!0),!s.isEdge&&typeof o.style.animationName<"u"&&(e.HAS_CSS_ANIMATION=!0),o=null}e.HAS_CSS_TRANSFORMS?e.translate=function(a,l,u){a.style.transform="translate("+Math.round(l)+"px, "+Math.round(u)+"px)"}:e.translate=function(a,l,u){a.style.top=Math.round(u)+"px",a.style.left=Math.round(l)+"px"}});ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(t,e,r){"use strict";var s=t("./dom");e.get=function(c,f){var i=new XMLHttpRequest;i.open("GET",c,!0),i.onreadystatechange=function(){i.readyState===4&&f(i.responseText)},i.send(null)},e.loadScript=function(c,f){var i=s.getDocumentHead(),d=document.createElement("script");d.src=c,i.appendChild(d),d.onload=d.onreadystatechange=function(n,o){(o||!d.readyState||d.readyState=="loaded"||d.readyState=="complete")&&(d=d.onload=d.onreadystatechange=null,o||f())}},e.qualifyURL=function(c){var f=document.createElement("a");return f.href=c,f.href}});ace.define("ace/lib/oop",["require","exports","module"],function(t,e,r){"use strict";e.inherits=function(s,c){s.super_=c,s.prototype=Object.create(c.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}})},e.mixin=function(s,c){for(var f in c)s[f]=c[f];return s},e.implement=function(s,c){e.mixin(s,c)}});ace.define("ace/lib/event_emitter",["require","exports","module"],function(t,e,r){"use strict";var s={},c=function(){this.propagationStopped=!0},f=function(){this.defaultPrevented=!0};s._emit=s._dispatchEvent=function(i,d){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[i]||[],o=this._defaultHandlers[i];if(!(!n.length&&!o)){(typeof d!="object"||!d)&&(d={}),d.type||(d.type=i),d.stopPropagation||(d.stopPropagation=c),d.preventDefault||(d.preventDefault=f),n=n.slice();for(var a=0;a<n.length&&(n[a](d,this),!d.propagationStopped);a++);if(o&&!d.defaultPrevented)return o(d,this)}},s._signal=function(i,d){var n=(this._eventRegistry||{})[i];if(n){n=n.slice();for(var o=0;o<n.length;o++)n[o](d,this)}},s.once=function(i,d){var n=this;if(this.on(i,function o(){n.off(i,o),d.apply(null,arguments)}),!d)return new Promise(function(o){d=o})},s.setDefaultHandler=function(i,d){var n=this._defaultHandlers;if(n||(n=this._defaultHandlers={_disabled_:{}}),n[i]){var o=n[i],a=n._disabled_[i];a||(n._disabled_[i]=a=[]),a.push(o);var l=a.indexOf(d);l!=-1&&a.splice(l,1)}n[i]=d},s.removeDefaultHandler=function(i,d){var n=this._defaultHandlers;if(n){var o=n._disabled_[i];if(n[i]==d)o&&this.setDefaultHandler(i,o.pop());else if(o){var a=o.indexOf(d);a!=-1&&o.splice(a,1)}}},s.on=s.addEventListener=function(i,d,n){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[i];return o||(o=this._eventRegistry[i]=[]),o.indexOf(d)==-1&&o[n?"unshift":"push"](d),d},s.off=s.removeListener=s.removeEventListener=function(i,d){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[i];if(n){var o=n.indexOf(d);o!==-1&&n.splice(o,1)}},s.removeAllListeners=function(i){i||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[i]=void 0),this._defaultHandlers&&(this._defaultHandlers[i]=void 0)},e.EventEmitter=s}
2);ace.define("ace/lib/report_error",["require","exports","module"],function(t,e,r){e.reportError=function(c,f){var i=new Error(c);i.data=f,typeof console=="object"&&console.error&&console.error(i),setTimeout(function(){throw i})}});ace.define("ace/lib/default_english_messages",["require","exports","module"],function(t,e,r){var s={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor gutter","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions","editor.tooltip.disable-editing":"Editing is disabled"};e.defaultEnglishMessages=s});ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(t,e,r){"no use strict";var s=t("./oop"),c=t("./event_emitter").EventEmitter,f=t("./report_error").reportError,i=t("./default_english_messages").defaultEnglishMessages,d={setOptions:function(u){Object.keys(u).forEach(function(h){this.setOption(h,u[h])},this)},getOptions:function(u){var h={};if(u)Array.isArray(u)||(h=u,u=Object.keys(h));else{var p=this.$options;u=Object.keys(p).filter(function(g){return!p[g].hidden})}return u.forEach(function(g){h[g]=this.getOption(g)},this),h},setOption:function(u,h){if(this["$"+u]!==h){var p=this.$options[u];if(!p)return n('misspelled option "'+u+'"');if(p.forwardTo)return this[p.forwardTo]&&this[p.forwardTo].setOption(u,h);p.handlesSet||(this["$"+u]=h),p&&p.set&&p.set.call(this,h)}},getOption:function(u){var h=this.$options[u];return h?h.forwardTo?this[h.forwardTo]&&this[h.forwardTo].getOption(u):h&&h.get?h.get.call(this):this["$"+u]:n('misspelled option "'+u+'"')}};function n(u){typeof console<"u"&&console.warn&&console.warn.apply(console,arguments)}var o,a,l=function(){function u(){this.$defaultOptions={},o=i,a="dollarSigns"}return u.prototype.defineOptions=function(h,p,g){return h.$options||(this.$defaultOptions[p]=h.$options={}),Object.keys(g).forEach(function(m){var y=g[m];typeof y=="string"&&(y={forwardTo:y}),y.name||(y.name=m),h.$options[y.name]=y,"initialValue"in y&&(h["$"+y.name]=y.initialValue)}),s.implement(h,d),this},u.prototype.resetOptions=function(h){Object.keys(h.$options).forEac
2h(function(p){var g=h.$options[p];"value"in g&&h.setOption(p,g.value)})},u.prototype.setDefaultValue=function(h,p,g){if(!h){for(h in this.$defaultOptions)if(this.$defaultOptions[h][p])break;if(!this.$defaultOptions[h][p])return!1}var m=this.$defaultOptions[h]||(this.$defaultOptions[h]={});m[p]&&(m.forwardTo?this.setDefaultValue(m.forwardTo,p,g):m[p].value=g)},u.prototype.setDefaultValues=function(h,p){Object.keys(p).forEach(function(g){this.setDefaultValue(h,g,p[g])},this)},u.prototype.setMessages=function(h,p){o=h,p&&p.placeholders&&(a=p.placeholders)},u.prototype.nls=function(h,p,g){o[h]||(n("No message found for the key '"+h+"' in messages with id "+o.$id+", trying to find a translation for the default string '"+p+"'."),o[p]||n("No message found for the default string '"+p+"' in the provided messages. Falling back to the default English message."));var m=o[h]||o[p]||p;return g&&(a==="dollarSigns"&&(m=m.replace(/\$(\$|[\d]+)/g,function(y,b){return b=="$"?"$":g[b]})),a==="curlyBrackets"&&(m=m.replace(/\{([^\}]+)\}/g,function(y,b){return g[b]}))),m},u}();l.prototype.warn=n,l.prototype.reportError=f,s.implement(l.prototype,c),e.AppConfig=l});ace.define("ace/theme/textmate-css",["require","exports","module"],function(t,e,r){r.exports=`.ace-tm .ace_gutter {
3  background: #f0f0f0;
4  color: #333;
5}
6
7.ace-tm .ace_print-margin {
8  width: 1px;
9  background: #e8e8e8;
10}
11
12.ace-tm .ace_fold {
13    background-color: #6B72E6;
14}
15
16.ace-tm {
17  background-color: #FFFFFF;
18  color: black;
19}
20
21.ace-tm .ace_cursor {
22  color: black;
23}
24        
25.ace-tm .ace_invisible {
26  color: rgb(191, 191, 191);
27}
28
29.ace-tm .ace_storage,
30.ace-tm .ace_keyword {
31  color: blue;
32}
33
34.ace-tm .ace_constant {
35  color: rgb(197, 6, 11);
36}
37
38.ace-tm .ace_constant.ace_buildin {
39  color: rgb(88, 72, 246);
40}
41
42.ace-tm .ace_constant.ace_language {
43  color: rgb(88, 92, 246);
44}
45
46.ace-tm .ace_constant.ace_library {
47  color: rgb(6, 150, 14);
48}
49
50.ace-tm .ace_invalid {
51  background-color: rgba(255, 0, 0, 0.1);
52  color: red;
53}
54
55.ace-tm .ace_support.ace_function {
56  color: rgb(60, 76, 114);
57}
58
59.ace-tm .ace_support.ace_constant {
60  color: rgb(6, 150, 14);
61}
62
63.ace-tm .ace_support.ace_type,
64.ace-tm .ace_support.ace_class {
65  color: rgb(109, 121, 222);
66}
67
68.ace-tm .ace_keyword.ace_operator {
69  color: rgb(104, 118, 135);
70}
71
72.ace-tm .ace_string {
73  color: rgb(3, 106, 7);
74}
75
76.ace-tm .ace_comment {
77  color: rgb(76, 136, 107);
78}
79
80.ace-tm .ace_comment.ace_doc {
81  color: rgb(0, 102, 255);
82}
83
84.ace-tm .ace_comment.ace_doc.ace_tag {
85  color: rgb(128, 159, 191);
86}
87
88.ace-tm .ace_constant.ace_numeric {
89  color: rgb(0, 0, 205);
90}
91
92.ace-tm .ace_variable {
93  color: rgb(49, 132, 149);
94}
95
96.ace-tm .ace_xml-pe {
97  color: rgb(104, 104, 91);
98}
99
100.ace-tm .ace_entity.ace_name.ace_function {
101  color: #0000A2;
102}
103
104
105.ace-tm .ace_heading {
106  color: rgb(12, 7, 255);
107}
108
109.ace-tm .ace_list {
110  color:rgb(185, 6, 144);
111}
112
113.ace-tm .ace_meta.ace_tag {
114  color:rgb(0, 22, 142);
115}
116
117.ace-tm .ace_string.ace_regex {
118  color: rgb(255, 0, 0)
119}
120
121.ace-tm .ace_marker-layer .ace_selection {
122  background: rgb(181, 213, 255);
123}
124.ace-tm.ace_multiselect .ace_selection.ace_start {
125  box-shadow: 0 0 3px 0px white;
126}
127.ace-tm .ace_marker-layer .ace_step {
128  background: rgb(252, 255, 0);
129}
130
131.ace-tm .ace_marker-layer .ace_stack {
132  background: rgb(164, 229, 101);
133}
134
135.ace-tm .ace_marker-layer .ace_bracket {
136  margin: -1px 0 0 -1px;
137  border: 1px solid rgb(192, 192, 192);
138}
139
140.ace-tm .ace_marker-layer .ace_active-line {
141  background: rgba(0, 0, 0, 0.07);
142}
143
144.ace-tm .ace_gutter-active-line {
145    background-color : #dcdcdc;
146}
147
148.ace-tm .ace_marker-layer .ace_selected-word {
149  background: rgb(250, 250, 255);
150  border: 1px solid rgb(200, 200, 250);
151}
152
153.ace-tm .ace_indent-guide {
154  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
155}
156
157.ace-tm .ace_indent-guide-active {
158  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
159}
160`});ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(t,e,r){"use strict";e.isDark=!1,e.cssClass="ace-tm",e.cssText=t("./textmate-css"),e.$id="ace/theme/textmate";var s=t("../lib/dom");s.importCssString(e.cssText,e.cssClass,!1)});ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(t,e,r){"no use strict";var s=t("./lib/lang"),c=t("./lib/net"),f=t("./lib/dom"),i=t("./lib/app_config").AppConfig;r.exports=e=new i;var d={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};e.get=function(l){if(!d.hasOwnProperty(l))throw new Error("Unknown config key: "+l);return d[l]},e.set=function(l,u){if(d.hasOwnProperty(l))d[l]=u;else if(this.setDefaultValue("",l,u)==!1)throw new Error("Unknown config key: "+l);l=="useStrictCSP"&&f.useStrictCSP(u)},e.all=function(){return s.copyObject(d)},e.$modes={},e.moduleUrl=function(l,u){if(d.$moduleUrls[l])return d.$moduleUrls[l];var h=l.split("/");u=u||h[h.length-2]||"";var p=u=="snippets"?"/":"-",g=h[h.length-1];if(u=="worker"&&p=="-"){var m=new RegExp("^"+u+"[\\-_]|[\\-_]"+u+"$","g");g=g.replace(m,"")}(!g||g==u)&&h.length>1&&(g=h[h.length-2]);var y=d[u+"Path"];return y==null?y=d.basePath:p=="/"&&(u=p=""),y&&y.slice(-1)!="/"&&(y+="/"),y+u+p+g+this.get("suffix")},e.setModuleUrl=function(l,u){return d.$moduleUrls[l]=u};var n=function(l,u){if(l==="ace/theme/textmate"||l==="./theme/textmate")return u(null,t("./theme/textmate"));if(o)return o(l,u);console.error("loader is not configured")},o;e.setLoader=function(l){o=l},e.dynamicModules=Object.create(null),e.$loading={},e.$loaded={},e.loadModule=function(l,u){var h;if(Array.isArray(l))var p=l[0],g=l[1];else if(typeof l=="string")var g=l;var m=function(y){if(y&&!e.$loading[g])return u&&u(y);if(e.$loading[g]||(e.$loading[g]=[]),e.$loading[g].push(u),!(e.$loading[g].length>1)){var b=function(){n(g,function(C,E){E&&(e.$loaded[g]=E),e._emit("load.module",{name:g,module:E});var w=e.$loading[g];
160e.$loading[g]=null,w.forEach(function(k){k&&k(E)})})};if(!e.get("packaged"))return b();c.loadScript(e.moduleUrl(g,p),b),a()}};if(e.dynamicModules[g])e.dynamicModules[g]().then(function(y){y.default?m(y.default):m(y)});else{try{h=this.$require(g)}catch{}m(h||e.$loaded[g])}},e.$require=function(l){if(typeof r.require=="function"){var u="require";return r[u](l)}},e.setModuleLoader=function(l,u){e.dynamicModules[l]=u};var a=function(){!d.basePath&&!d.workerPath&&!d.modePath&&!d.themePath&&!Object.keys(d.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),a=function(){})};e.version="1.40.1"});ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(t,e,r){"use strict";t("./lib/fixoldbrowsers");var s=t("./config");s.setLoader(function(d,n){t([d],function(o){n(null,o)})});var c=function(){return this||typeof window<"u"&&window}();r.exports=function(d){s.init=f,s.$require=t,d.require=t,typeof define=="function"&&(d.define=define)},f(!0);function f(d){if(!(!c||!c.document)){s.set("packaged",d||t.packaged||r.packaged||c.define&&define.packaged);var n={},o="",a=document.currentScript||document._currentScript,l=a&&a.ownerDocument||document;a&&a.src&&(o=a.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var u=l.getElementsByTagName("script"),h=0;h<u.length;h++){var p=u[h],g=p.src||p.getAttribute("src");if(g){for(var m=p.attributes,y=0,b=m.length;y<b;y++){var C=m[y];C.name.indexOf("data-ace-")===0&&(n[i(C.name.replace(/^data-ace-/,""))]=C.value)}var E=g.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);E&&(o=E[1])}}o&&(n.base=n.base||o,n.packaged=!0),n.basePath=n.base,n.workerPath=n.workerPath||n.base,n.modePath=n.modePath||n.base,n.themePath=n.themePath||n.base,delete n.base;for(var w in n)typeof n[w]<"u"&&s.set(w,n[w])}}function i(d){return d.replace(/-(.)/g,function(n,o){return o.toUpperCase()})}});ace.define("ace/range",["require","exports","module"],function(t,e,r){"use strict";var s=function(){function c(f,i,d,n){this.start={row:f,column:i},this.end={row:d,column:n}}return c.prototype.isEqual=function(f){return this.start.row===f.start.row&&this.end.row===f.end.row&&this.start.column===f.start.column&&this.end.column===f.end.column},c.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},c.prototype.contains=function(f,i){return this.compare(f,i)==0},c.prototype.compareRange=function(f){var i,d=f.end,n=f.start;return i=this.compare(d.row,d.column),i==1?(i=this.compare(n.row,n.column),i==1?2:i==0?1:0):i==-1?-2:(i=this.compare(n.row,n.column),i==-1?-1:i==1?42:0)},c.prototype.comparePoint=function(f){return this.compare(f.row,f.column)},c.prototype.containsRange=function(f){return this.comparePoint(f.start)==0&&this.comparePoint(f.end)==0},c.prototype.intersects=function(f){var i=this.compareRange(f);return i==-1||i==0||i==1},c.prototype.isEnd=function(f,i){return this.end.row==f&&this.end.column==i},c.prototype.isStart=function(f,i){return this.start.row==f&&this.start.column==i},c.prototype.setStart=function(f,i){typeof f=="object"?(this.start.column=f.column,this.start.row=f.row):(this.start.row=f,this.start.column=i)},c.prototype.setEnd=function(f,i){typeof f=="object"?(this.end.column=f.column,this.end.row=f.row):(this.end.row=f,this.end.column=i)},c.prototype.inside=function(f,i){return this.compare(f,i)==0?!(this.isEnd(f,i)||this.isStart(f,i)):!1},c.prototype.insideStart=function(f,i){return this.compare(f,i)==0?!this.isEnd(f,i):!1},c.prototype.insideEnd=function(f,i){return this.compare(f,i)==0?!this.isStart(f,i):!1},c.prototype.compare=function(f,i){return!this.isMultiLine()&&f===this.start.row?i<this.start.column?-1:i>this.end.column?1:0:f<this.start.row?-1:f>this.end.row?1:this.start.row===f?i>=this.start.column?0:-1:this.end.row===f?i<=this.end.column?0:1:0},c.prototype.compareStart=function(f,i){return this.start.row==f&&this.start.column==i?-1:this.compare(f,i)},c.prototype.compareEnd=function(f,i){return this.end.row==f&&this.end.column==i?1:this.compare(f,i)},c.prototype.compareInside=function(f,i){return this.end.row==f&&this.end.column==i?1:this.start.row==f&&this.start.column==i?-1:this.compare(f,i)},c.prototype.clipRows=function(f,i){if(this.end.row>i)var d={row:i+1,column:0};else if(this.end.row<f)var d={row:f,column:0};if(this.start.row>i)var n={row:i+1,column:0};else if(this.start.row<f)var n={row:f,column:0};return c.fromPoints(n||this.start,d||this.end)},c.prototype.extend=function(f,i){var d=this.compare(f,i);if(d==0)return this;if(d==-1)var n={row:f,column:i};else var o={row:f,column:i};return c.fromPoints(n||this.start,o||this.end)},c.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},c.prototype.isMultiLine=function(){return this.start.row!==this.end.row},c.prototype.clone=function(){return c.fromPoints(this.start,this.end)},c.prototype.collapseRows=function(){return this.end.column==0?new c(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new c(this.start.row,0,this.end.row,0)},c.prototype.toScreenRange=function(f){var i=f.documentToScreenPosition(this.start),d=f.documentToScreenPosition(this.end);return new c(i.row,i.column,d.row,d.column)},c.prototype.moveBy=function(f,i){this.start.row+=f,this.start.column+=i,this.end.row+=f,this.end.column+=i},c}();s.fromPoints=function(c,f){return new s(c.row,c.column,f.row,f.column)},s.comparePoints=function(c,f){return c.row-f.row||c.column-f.column},e.Range=s});ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(t,e,r){"use strict";for(var s=t("./oop"),c={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1}
160,FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},f={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},i=0;i<10;i++)f["Digit"+i]=48+i,f["Numpad"+i]=96+i,c.PRINTABLE_KEYS[48+i]=""+i,c.FUNCTION_KEYS[96+i]="Numpad"+i;for(var i=65;i<91;i++){var d=String.fromCharCode(i+32);f["Key"+d.toUpperCase()]=i,c.PRINTABLE_KEYS[i]=d}for(var i=1;i<13;i++)f["F"+i]=111+i,c.FUNCTION_KEYS[111+i]="F"+i;var n={Shift:16,Control:17,Alt:18,Meta:224};for(var o in n)f[o]=f[o+"Left"]=f[o+"Right"]=n[o];e.$codeToKeyCode=f,c.PRINTABLE_KEYS[173]="-";for(var a in c.FUNCTION_KEYS){var l=c.FUNCTION_KEYS[a].toLowerCase();c[l]=parseInt(a,10)}for(var a in c.PRINTABLE_KEYS){var l=c.PRINTABLE_KEYS[a].toLowerCase();c[l]=parseInt(a,10)}s.mixin(c,c.MODIFIER_KEYS),s.mixin(c,c.PRINTABLE_KEYS),s.mixin(c,c.FUNCTION_KEYS),c.enter=c.return,c.escape=c.esc,c.del=c.delete,function(){for(var u=["cmd","ctrl","alt","shift"],h=Math.pow(2,u.length);h--;)c.KEY_MODS[h]=u.filter(function(p){return h&c.KEY_MODS[p]}).join("-")+"-"}(),c.KEY_MODS[0]="",c.KEY_MODS[-1]="input-",s.mixin(e,c),e.default=e,e.keyCodeToString=function(u){var h=c[u];return typeof h!="string"&&(h=String.fromCharCode(u)),h.toLowerCase()}});ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(t,e,r){"use strict";var s=t("./keys"),c=t("./useragent"),f=null,i=0,d;function n(){d=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return d={passive:!1},!0}})}catch{}}function o(){return d==null&&n(),d}function a(y,b,C){this.elem=y,this.type=b,this.callback=C}a.prototype.destroy=function(){u(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var l=e.addListener=function(y,b,C,E){y.addEventListener(b,C,o()),E&&E.$toDestroy.push(new a(y,b,C))},u=e.removeListener=function(y,b,C){y.removeEventListener(b,C,o())};e.stopEvent=function(y){return e.stopPropagation(y),e.preventDefault(y),!1},e.stopPropagation=function(y){y.stopPropagation&&y.stopPropagation()},e.preventDefault=function(y){y.preventDefault&&y.preventDefault()},e.getButton=function(y){return y.type=="dblclick"?0:y.type=="contextmenu"||c.isMac&&y.ctrlKey&&!y.altKey&&!y.shiftKey?2:y.button},e.capture=function(y,b,C){var E=y&&y.ownerDocument||document;function w(k){b&&b(k),C&&C(k),u(E,"mousemove",b),u(E,"mouseup",w),u(E,"dragstart",w)}return l(E,"mousemove",b),l(E,"mouseup",w),l(E,"dragstart",w),w},e.addMouseWheelListener=function(y,b,C){l(y,"wheel",function(E){var w=.15,k=E.deltaX||0,I=E.deltaY||0;switch(E.deltaMode){case E.DOM_DELTA_PIXEL:E.wheelX=k*w,E.wheelY=I*w;break;case E.DOM_DELTA_LINE:var L=15;E.wheelX=k*L,E.wheelY=I*L;break;case E.DOM_DELTA_PAGE:var F=150;E.wheelX=k*F,E.wheelY=I*F;break}b(E)},C)},e.addMultiMouseDownListener=function(y,b,C,E,w){var k=0,I,L,F,R={2:"dblclick",3:"tripleclick",4:"quadclick"};function M(A){if(e.getButton(A)!==0?k=0:A.detail>1?(k++,k>4&&(k=1)):k=1,c.isIE){var _=Math.abs(A.clientX-I)>5||Math.abs(A.clientY-L)>5;(!F||_)&&(k=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},b[k-1]||600),k==1&&(I=A.clientX,L=A.clientY)}if(A._clicks=k,C[E]("mousedown",A),k>4)k=0;else if(k>1)return C[E](R[k],A)}Array.isArray(y)||(y=[y]),y.forEach(function(A){l(A,"mousedown",M,w)})};function h(y){return 0|(y.ctrlKey?1:0)|(y.altKey?2:0)|(y.shiftKey?4:0)|(y.metaKey?8:0)}e.getModifierString=function(y){return s.KEY_MODS[h(y)]};function p(y,b,C){var E=h(b);if(!C&&b.code&&(C=s.$codeToKeyCode[b.code]||C),!c.isMac&&f){if(b.getModifierState&&(b.getModifierState("OS")||b.getModifierState("Win"))&&(E|=8),f.altGr)if((3&E)!=3)f.altGr=0;else return;if(C===18||C===17){var w=b.location;if(C===17&&w===1)f[C]==1&&(i=b.timeStamp);else if(C===18&&E===3&&w===2){var k=b.timeStamp-i;k<50&&(f.altGr=!0)}}}if(C in s.MODIFIER_KEYS&&(C=-1),!(!E&&C===13&&b.location===3&&(y(b,E,-C),b.defaultPrevented))){if(c.isChromeOS&&E&8){if(y(b,E,C),b.defaultPrevented)return;E&=-9}
160return!E&&!(C in s.FUNCTION_KEYS)&&!(C in s.PRINTABLE_KEYS)?!1:y(b,E,C)}}e.addCommandKeyListener=function(y,b,C){var E=null;l(y,"keydown",function(w){f[w.keyCode]=(f[w.keyCode]||0)+1;var k=p(b,w,w.keyCode);return E=w.defaultPrevented,k},C),l(y,"keypress",function(w){E&&(w.ctrlKey||w.altKey||w.shiftKey||w.metaKey)&&(e.stopEvent(w),E=null)},C),l(y,"keyup",function(w){f[w.keyCode]=null},C),f||(g(),l(window,"focus",g))};function g(){f=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!c.isOldIE){var m=1;e.nextTick=function(y,b){b=b||window;var C="zero-timeout-message-"+m++,E=function(w){w.data==C&&(e.stopPropagation(w),u(b,"message",E),y())};l(b,"message",E),b.postMessage(C,"*")}}e.$idleBlocked=!1,e.onIdle=function(y,b){return setTimeout(function C(){e.$idleBlocked?setTimeout(C,100):y()},b)},e.$idleBlockId=null,e.blockIdle=function(y){e.$idleBlockId&&clearTimeout(e.$idleBlockId),e.$idleBlocked=!0,e.$idleBlockId=setTimeout(function(){e.$idleBlocked=!1},y||100)},e.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),e.nextFrame?e.nextFrame=e.nextFrame.bind(window):e.nextFrame=function(y){setTimeout(y,17)}});ace.define("ace/clipboard",["require","exports","module"],function(t,e,r){"use strict";var s;r.exports={lineMode:!1,pasteCancelled:function(){return s&&s>Date.now()-50?!0:s=!1},cancel:function(){s=Date.now()}}});ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(t,e,r){"use strict";var s=t("../lib/event"),c=t("../config").nls,f=t("../lib/useragent"),i=t("../lib/dom"),d=t("../lib/lang"),n=t("../clipboard"),o=f.isChrome<18,a=f.isIE,l=f.isChrome>63,u=400,h=t("../lib/keys"),p=h.KEY_MODS,g=f.isIOS,m=g?/\s/:/\n/,y=f.isMobile,b;b=function(C,E){var w=i.createElement("textarea");w.className="ace_text-input",w.setAttribute("wrap","off"),w.setAttribute("autocorrect","off"),w.setAttribute("autocapitalize","off"),w.setAttribute("spellcheck","false"),w.style.opacity="0",C.insertBefore(w,C.firstChild);var k=!1,I=!1,L=!1,F=!1,R="";y||(w.style.fontSize="1px");var M=!1,A=!1,_="",O=0,D=0,B=0,P=Number.MAX_SAFE_INTEGER,H=Number.MIN_SAFE_INTEGER,W=0;try{var K=document.activeElement===w}catch{}this.setNumberOfExtraLines=function(se){if(P=Number.MAX_SAFE_INTEGER,H=Number.MIN_SAFE_INTEGER,se<0){W=0;return}W=se},this.setAriaLabel=function(){var se="";if(E.$textInputAriaLabel&&(se+="".concat(E.$textInputAriaLabel,", ")),E.session){var ye=E.session.selection.cursor.row;se+=c("text-input.aria-label","Cursor at row $0",[ye+1])}w.setAttribute("aria-label",se)},this.setAriaOptions=function(se){se.activeDescendant?(w.setAttribute("aria-haspopup","true"),w.setAttribute("aria-autocomplete",se.inline?"both":"list"),w.setAttribute("aria-activedescendant",se.activeDescendant)):(w.setAttribute("aria-haspopup","false"),w.setAttribute("aria-autocomplete","both"),w.removeAttribute("aria-activedescendant")),se.role&&w.setAttribute("role",se.role),se.setLabel&&(w.setAttribute("aria-roledescription",c("text-input.aria-roledescription","editor")),this.setAriaLabel())},this.setAriaOptions({role:"textbox"}),s.addListener(w,"blur",function(se){A||(E.onBlur(se),K=!1)},E),s.addListener(w,"focus",function(se){if(!A){if(K=!0,f.isEdge)try{if(!document.hasFocus())return}catch{}E.onFocus(se),f.isEdge?setTimeout(X):X()}},E),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:E.renderer.enableKeyboardAccessibility}),R||l||this.$focusScroll=="browser")return w.focus({preventScroll:!0});var se=w.style.top;w.style.position="fixed",w.style.top="0px";try{var ye=w.getBoundingClientRect().top!=0}catch{return}var Ee=[];if(ye)for(var Le=w.parentElement;Le&&Le.nodeType==1;)Ee.push(Le),Le.setAttribute("ace_nocontext","true"),!Le.parentElement&&Le.getRootNode?Le=Le.getRootNode().host:Le=Le.parentElement;w.focus({preventScroll:!0}),ye&&Ee.forEach(function(De){De.removeAttribute("ace_nocontext")}),setTimeout(function(){w.style.position="",w.style.top=="0px"&&(w.style.top=se)},0)},this.blur=function(){w.blur()},this.isFocused=function(){return K},E.on("beforeEndOperation",function(){var se=E.curOp,ye=se&&se.command&&se.command.name;if(ye!="insertstring"){var Ee=ye&&(se.docChanged||se.selectionChanged);L&&Ee&&(_=w.value="",ue()),X()}}),E.on("changeSelection",this.setAriaLabel);var G=function(se,ye){for(var Ee=ye,Le=1;Le<=se-P&&Le<2*W+1;Le++)Ee+=E.session.getLine(se-Le).length+1;return Ee},X=g?function(se){if(!(!K||k&&!se||F)){se||(se="");var ye=`
161 ab`+se+`cde fg
162`;ye!=w.value&&(w.value=_=ye);var Ee=4,Le=4+(se.length||(E.selection.isEmpty()?0:1));(O!=Ee||D!=Le)&&w.setSelectionRange(Ee,Le),O=Ee,D=Le}}:function(){if(!(L||F)&&!(!K&&!ie)){L=!0;var se=0,ye=0,Ee="";if(E.session){var Le=E.selection,De=Le.getRange(),Qe=Le.cursor.row;Qe===H+1?(P=H+1,H=P+2*W):Qe===P-1?(H=P-1,P=H-2*W):(Qe<P-1||Qe>H+1)&&(P=Qe>W?Qe-W:0,H=Qe>W?Qe+W:2*W);for(var rt=[],Ze=P;Ze<=H;Ze++)rt.push(E.session.getLine(Ze));if(Ee=rt.join(`
163`),se=G(De.start.row,De.start.column),ye=G(De.end.row,De.end.column),De.start.row<P){var $e=E.session.getLine(P-1);se=De.start.row<P-1?0:se,ye+=$e.length+1,Ee=$e+`
164`+Ee}else if(De.end.row>H){var ze=E.session.getLine(H+1);ye=De.end.row>H+1?ze.length:De.end.column,ye+=Ee.length+1,Ee=Ee+`
165`+ze}else y&&Qe>0&&(Ee=`
166`+Ee,ye+=1,se+=1);Ee.length>u&&(se<u&&ye<u?Ee=Ee.slice(0,u):(Ee=`
167`,se==ye?se=ye=0:(se=0,ye=1)));var re=Ee+`
168
169`;re!=_&&(w.value=_=re,O=D=re.length)}if(ie&&(O=w.selectionStart,D=w.selectionEnd),D!=ye||O!=se||w.selectionEnd!=D)try{w.setSelectionRange(se,ye),O=se,D=ye}catch{}L=!1}};this.resetSelection=X,K&&E.onFocus();var Z=function(se){return se.selectionStart===0&&se.selectionEnd>=_.length&&se.value===_&&_&&se.selectionEnd!==D},q=function(se){L||(k?k=!1:Z(w)?(E.selectAll(),X()):y&&w.selectionStart!=O&&X())},Q=null;this.setInputHandler=function(se){Q=se},this.getInputHandler=function(){return Q};var ie=!1,ae=function(se,ye){if(ie&&(ie=!1),I)return X(),se&&E.onPaste(se),I=!1,"";for(var Ee=w.selectionStart,Le=w.selectionEnd,De=O,Qe=_.length-D,rt=se,Ze=se.length-Ee,$e=se.length-Le,ze=0;De>0&&_[ze]==se[ze];)ze++,De--;for(rt=rt.slice(ze),ze=1;Qe>0&&_.length-ze>O-1&&_[_.length-ze]==se[se.length-ze];)ze++,Qe--;Ze-=ze-1,$e-=ze-1;var re=rt.length-ze+1;if(re<0&&(De=-re,re=0),rt=rt.slice(0,re),!ye&&!rt&&!Ze&&!De&&!Qe&&!$e)return"";F=!0;var de=!1;return f.isAndroid&&rt==". "&&(rt="  ",de=!0),rt&&!De&&!Qe&&!Ze&&!$e||M?E.onTextInput(rt):E.onTextInput(rt,{extendLeft:De,extendRight:Qe,restoreStart:Ze,restoreEnd:$e}),F=!1,_=se,O=Ee,D=Le,B=$e,de?`
170`:rt},oe=function(se){if(L)return Ae();if(se&&se.inputType){if(se.inputType=="historyUndo")return E.execCommand("undo");if(se.inputType=="historyRedo")return E.execCommand("redo")}var ye=w.value,Ee=ae(ye,!0);(ye.length>u+100||m.test(Ee)||y&&O<1&&O==D)&&X()},fe=function(se,ye,Ee){var Le=se.clipboardData||window.clipboardData;if(!(!Le||o)){var De=a||Ee?"Text":"text/plain";
170try{return ye?Le.setData(De,ye)!==!1:Le.getData(De)}catch(Qe){if(!Ee)return fe(Qe,ye,!0)}}},he=function(se,ye){var Ee=E.getCopyText();if(!Ee)return s.preventDefault(se);fe(se,Ee)?(g&&(X(Ee),k=Ee,setTimeout(function(){k=!1},10)),ye?E.onCut():E.onCopy(),s.preventDefault(se)):(k=!0,w.value=Ee,w.select(),setTimeout(function(){k=!1,X(),ye?E.onCut():E.onCopy()}))},xe=function(se){he(se,!0)},ke=function(se){he(se,!1)},Re=function(se){var ye=fe(se);n.pasteCancelled()||(typeof ye=="string"?(ye&&E.onPaste(ye,se),f.isIE&&setTimeout(X),s.preventDefault(se)):(w.value="",I=!0))};s.addCommandKeyListener(w,function(se,ye,Ee){if(!L)return E.onCommandKey(se,ye,Ee)},E),s.addListener(w,"select",q,E),s.addListener(w,"input",oe,E),s.addListener(w,"cut",xe,E),s.addListener(w,"copy",ke,E),s.addListener(w,"paste",Re,E),(!("oncut"in w)||!("oncopy"in w)||!("onpaste"in w))&&s.addListener(C,"keydown",function(se){if(!(f.isMac&&!se.metaKey||!se.ctrlKey))switch(se.keyCode){case 67:ke(se);break;case 86:Re(se);break;case 88:xe(se);break}},E);var Ce=function(se){if(!(L||!E.onCompositionStart||E.$readOnly)&&(L={},!M)){se.data&&(L.useTextareaForIME=!1),setTimeout(Ae,0),E._signal("compositionStart"),E.on("mousedown",ut);var ye=E.getSelectionRange();ye.end.row=ye.start.row,ye.end.column=ye.start.column,L.markerRange=ye,L.selectionStart=O,E.onCompositionStart(L),L.useTextareaForIME?(_=w.value="",O=0,D=0):(w.msGetInputContext&&(L.context=w.msGetInputContext()),w.getInputContext&&(L.context=w.getInputContext()))}},Ae=function(){if(!(!L||!E.onCompositionUpdate||E.$readOnly)){if(M)return ut();if(L.useTextareaForIME)E.onCompositionUpdate(w.value);else{var se=w.value;ae(se),L.markerRange&&(L.context&&(L.markerRange.start.column=L.selectionStart=L.context.compositionStartOffset),L.markerRange.end.column=L.markerRange.start.column+D-L.selectionStart+B)}}},ue=function(se){!E.onCompositionEnd||E.$readOnly||(L=!1,E.onCompositionEnd(),E.off("mousedown",ut),se&&oe())};function ut(){A=!0,w.blur(),w.focus(),A=!1}var Je=d.delayedCall(Ae,50).schedule.bind(null,null);function Me(se){se.keyCode==27&&w.value.length<w.selectionStart&&(L||(_=w.value),O=D=-1,X()),Je()}s.addListener(w,"compositionstart",Ce,E),s.addListener(w,"compositionupdate",Ae,E),s.addListener(w,"keyup",Me,E),s.addListener(w,"keydown",Je,E),s.addListener(w,"compositionend",ue,E),this.getElement=function(){return w},this.setCommandMode=function(se){M=se,w.readOnly=!1},this.setReadOnly=function(se){M||(w.readOnly=se)},this.setCopyWithEmptySelection=function(se){},this.onContextMenu=function(se){ie=!0,X(),E._emit("nativecontextmenu",{target:E,domEvent:se}),this.moveToMouse(se,!0)},this.moveToMouse=function(se,ye){R||(R=w.style.cssText),w.style.cssText=(ye?"z-index:100000;":"")+(f.isIE?"opacity:0.1;":"")+"text-indent: -"+(O+D)*E.renderer.characterWidth*.5+"px;";var Ee=E.container.getBoundingClientRect(),Le=i.computedStyle(E.container),De=Ee.top+(parseInt(Le.borderTopWidth)||0),Qe=Ee.left+(parseInt(Le.borderLeftWidth)||0),rt=Ee.bottom-De-w.clientHeight-2,Ze=function($e){i.translate(w,$e.clientX-Qe-2,Math.min($e.clientY-De-2,rt))};Ze(se),se.type=="mousedown"&&(E.renderer.$isMousePressed=!0,clearTimeout(Ue),f.isWin&&s.capture(E.container,Ze,Ve))},this.onContextMenuClose=Ve;var Ue;function Ve(){clearTimeout(Ue),Ue=setTimeout(function(){R&&(w.style.cssText=R,R=""),E.renderer.$isMousePressed=!1,E.renderer.$keepTextAreaAtCursor&&E.renderer.$moveTextAreaToCursor()},0)}var Ne=function(se){E.textInput.onContextMenu(se),Ve()};s.addListener(w,"mouseup",Ne,E),s.addListener(w,"mousedown",function(se){se.preventDefault(),Ve()}
170,E),s.addListener(E.renderer.scroller,"contextmenu",Ne,E),s.addListener(w,"contextmenu",Ne,E),g&&Pt(C,E,w);function Pt(se,ye,Ee){var Le=null,De=!1;Ee.addEventListener("keydown",function(rt){Le&&clearTimeout(Le),De=!0},!0),Ee.addEventListener("keyup",function(rt){Le=setTimeout(function(){De=!1},100)},!0);var Qe=function(rt){if(document.activeElement===Ee&&!(De||L||ye.$mouseHandler.isMousePressed)&&!k){var Ze=Ee.selectionStart,$e=Ee.selectionEnd,ze=null,re=0;if(Ze==0?ze=h.up:Ze==1?ze=h.home:$e>D&&_[$e]==`
171`?ze=h.end:Ze<O&&_[Ze-1]==" "?(ze=h.left,re=p.option):Ze<O||Ze==O&&D!=O&&Ze==$e?ze=h.left:$e>D&&_.slice(0,$e).split(`
172`).length>2?ze=h.down:$e>D&&_[$e-1]==" "?(ze=h.right,re=p.option):($e>D||$e==D&&D!=O&&Ze==$e)&&(ze=h.right),Ze!==$e&&(re|=p.shift),ze){var de=ye.onCommandKey({},re,ze);if(!de&&ye.commands){ze=h.keyCodeToString(ze);var ce=ye.commands.findKeyCommand(re,ze);ce&&ye.execCommand(ce)}O=Ze,D=$e,X("")}}};document.addEventListener("selectionchange",Qe),ye.on("destroy",function(){document.removeEventListener("selectionchange",Qe)})}this.destroy=function(){w.parentElement&&w.parentElement.removeChild(w)}},e.TextInput=b,e.$setUserAgentForTests=function(C,E){y=C,g=E}});ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(t,e,r){"use strict";var s=t("../lib/useragent"),c=0,f=550,i=function(){function o(a){a.$clickSelection=null;var l=a.editor;l.setDefaultHandler("mousedown",this.onMouseDown.bind(a)),l.setDefaultHandler("dblclick",this.onDoubleClick.bind(a)),l.setDefaultHandler("tripleclick",this.onTripleClick.bind(a)),l.setDefaultHandler("quadclick",this.onQuadClick.bind(a)),l.setDefaultHandler("mousewheel",this.onMouseWheel.bind(a));var u=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];u.forEach(function(h){a[h]=this[h]},this),a.selectByLines=this.extendSelectionBy.bind(a,"getLineRange"),a.selectByWords=this.extendSelectionBy.bind(a,"getWordRange")}return o.prototype.onMouseDown=function(a){var l=a.inSelection(),u=a.getDocumentPosition();this.mousedownEvent=a;var h=this.editor,p=a.getButton();if(p!==0){var g=h.getSelectionRange(),m=g.isEmpty();(m||p==1)&&h.selection.moveToPosition(u),p==2&&(h.textInput.onContextMenu(a.domEvent),s.isMozilla||a.preventDefault());return}if(this.mousedownEvent.time=Date.now(),l&&!h.isFocused()&&(h.focus(),this.$focusTimeout&&!this.$clickSelection&&!h.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(a);return}return this.captureMouse(a),this.startSelect(u,a.domEvent._clicks>1),a.preventDefault()},o.prototype.startSelect=function(a,l){a=a||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var u=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?u.selection.selectToPosition(a):l||u.selection.moveToPosition(a),l||this.select(),u.setStyle("ace_selecting"),this.setState("select"))},o.prototype.select=function(){var a,l=this.editor,u=l.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var h=this.$clickSelection.comparePoint(u);if(h==-1)a=this.$clickSelection.end;else if(h==1)a=this.$clickSelection.start;else{var p=n(this.$clickSelection,u);u=p.cursor,a=p.anchor}l.selection.setSelectionAnchor(a.row,a.column)}l.selection.selectToPosition(u),l.renderer.scrollCursorIntoView()},o.prototype.extendSelectionBy=function(a){var l,u=this.editor,h=u.renderer.screenToTextCoordinates(this.x,this.y),p=u.selection[a](h.row,h.column);if(this.$clickSelection){var g=this.$clickSelection.comparePoint(p.start),m=this.$clickSelection.comparePoint(p.end);if(g==-1&&m<=0)l=this.$clickSelection.end,(p.end.row!=h.row||p.end.column!=h.column)&&(h=p.start);else if(m==1&&g>=0)l=this.$clickSelection.start,(p.start.row!=h.row||p.start.column!=h.column)&&(h=p.end);else if(g==-1&&m==1)h=p.end,l=p.start;else{var y=n(this.$clickSelection,h);h=y.cursor,l=y.anchor}u.selection.setSelectionAnchor(l.row,l.column)}u.selection.selectToPosition(h),u.renderer.scrollCursorIntoView()},o.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")}
172,o.prototype.focusWait=function(){var a=d(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),l=Date.now();(a>c||l-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},o.prototype.onDoubleClick=function(a){var l=a.getDocumentPosition(),u=this.editor,h=u.session,p=h.getBracketRange(l);p?(p.isEmpty()&&(p.start.column--,p.end.column++),this.setState("select")):(p=u.selection.getWordRange(l.row,l.column),this.setState("selectByWords")),this.$clickSelection=p,this.select()},o.prototype.onTripleClick=function(a){var l=a.getDocumentPosition(),u=this.editor;this.setState("selectByLines");var h=u.getSelectionRange();h.isMultiLine()&&h.contains(l.row,l.column)?(this.$clickSelection=u.selection.getLineRange(h.start.row),this.$clickSelection.end=u.selection.getLineRange(h.end.row).end):this.$clickSelection=u.selection.getLineRange(l.row),this.select()},o.prototype.onQuadClick=function(a){var l=this.editor;l.selectAll(),this.$clickSelection=l.getSelectionRange(),this.setState("selectAll")},o.prototype.onMouseWheel=function(a){if(!a.getAccelKey()){a.getShiftKey()&&a.wheelY&&!a.wheelX&&(a.wheelX=a.wheelY,a.wheelY=0);var l=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var u=this.$lastScroll,h=a.domEvent.timeStamp,p=h-u.t,g=p?a.wheelX/p:u.vx,m=p?a.wheelY/p:u.vy;p<f&&(g=(g+u.vx)/2,m=(m+u.vy)/2);var y=Math.abs(g/m),b=!1;if(y>=1&&l.renderer.isScrollableBy(a.wheelX*a.speed,0)&&(b=!0),y<=1&&l.renderer.isScrollableBy(0,a.wheelY*a.speed)&&(b=!0),b)u.allowed=h;else if(h-u.allowed<f){var C=Math.abs(g)<=1.5*Math.abs(u.vx)&&Math.abs(m)<=1.5*Math.abs(u.vy);C?(b=!0,u.allowed=h):u.allowed=0}if(u.t=h,u.vx=g,u.vy=m,b)return l.renderer.scrollBy(a.wheelX*a.speed,a.wheelY*a.speed),a.stop()}},o}();i.prototype.selectEnd=i.prototype.selectByLinesEnd,i.prototype.selectAllEnd=i.prototype.selectByLinesEnd,i.prototype.selectByWordsEnd=i.prototype.selectByLinesEnd,e.DefaultHandlers=i;function d(o,a,l,u){return Math.sqrt(Math.pow(l-o,2)+Math.pow(u-a,2))}function n(o,a){if(o.start.row==o.end.row)var l=2*a.column-o.start.column-o.end.column;else if(o.start.row==o.end.row-1&&!o.start.column&&!o.end.column)var l=a.column-4;else var l=2*a.row-o.start.row-o.end.row;return l<0?{cursor:o.start,anchor:o.end}:{cursor:o.end,anchor:o.start}}});ace.define("ace/lib/scroll",["require","exports","module"],function(t,e,r){e.preventParentScroll=function(c){c.stopPropagation();var f=c.currentTarget,i=f.scrollHeight>f.clientHeight;i||c.preventDefault()}});ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var p=function(g,m){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,b){y.__proto__=b}||function(y,b){for(var C in b)Object.prototype.hasOwnProperty.call(b,C)&&(y[C]=b[C])},p(g,m)};return function(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");p(g,m);function y(){this.constructor=g}g.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),c=this&&this.__values||function(p){var g=typeof Symbol=="function"&&Symbol.iterator,m=g&&p[g],y=0;if(m)return m.call(p);if(p&&typeof p.length=="number")return{next:function(){return p&&y>=p.length&&(p=void 0),{value:p&&p[y++],done:!p}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")},f=t("./lib/dom"),i=t("./lib/event"),d=t("./range").Range,n=t("./lib/scroll").preventParentScroll,o="ace_tooltip",a=function(){function p(g){this.isOpen=!1,this.$element=null,this.$parentNode=g}return p.prototype.$init=function(){return this.$element=f.createElement("div"),this.$element.className=o,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},p.prototype.getElement=function(){return this.$element||this.$init()},p.prototype.setText=function(g){this.getElement().textContent=g},p.prototype.setHtml=function(g){this.getElement().innerHTML=g},p.prototype.setPosition=function(g,m){this.getElement().style.left=g+"px",this.getElement().style.top=m+"px"},p.prototype.setClassName=function(g){f.addCssClass(this.getElement(),g)},p.prototype.setTheme=function(g){this.$element.className=o+" "+(g.isDark?"ace_dark ":"")+(g.cssClass||"")},p.prototype.show=function(g,m,y){g!=null&&this.setText(g),m!=null&&y!=null&&this.setPosition(m,y),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},p.prototype.hide=function(g){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=o,this.isOpen=!1)},p.prototype.getHeight=function(){return this.getElement().offsetHeight},p.prototype.getWidth=function(){return this.getElement().offsetWidth},p.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},p}(),l=function(){function p(){this.popups=[]}return p.prototype.addPopup=function(g){this.popups.push(g),this.updatePopups()},p.prototype.removePopup=function(g){var m=this.popups.indexOf(g);m!==-1&&(this.popups.splice(m,1),this.updatePopups())},p.prototype.updatePopups=function(){var g,m,y,b;this.popups.sort(function(M,A){return A.priority-M.priority});var C=[];try{for(var E=c(this.popups),w=E.next();!w.done;w=E.next()){var k=w.value,I=!0;try{for(var L=(y=void 0,c(C)),F=L.next();!F.done;F=L.next()){var R=F.value;if(this.doPopupsOverlap(R,k)){I=!1;break}}}catch(M){y={error:M}}finally{try{F&&!F.done&&(b=L.return)&&b.call(L)}finally{if(y)throw y.error}}I?C.push(k):k.hide()}}catch(M){g={error:M}}finally{try{w&&!w.done&&(m=E.return)&&m.call(E)}finally{if(g)throw g.error}}},p.prototype.doPopupsOverlap=function(g,m){var y=g.getElement().getBoundingClientRect(),b=m.getElement().getBoundingClientRect();return y.left<b.right&&y.right>b.left&&y.top<b.bottom&&y.bottom>b.top},p}(),u=new l;e.popupManager=u,e.Tooltip=a;var h=function(p){s(g,p);function g(m){m===void 0&&(m=document.body);var y=p.call(this,m)||this;y.timeout=void 0,y.lastT=0,y.idleTime=350,y.lastEvent=void 0,y.onMouseOut=y.onMouseOut.bind(y),y.onMouseMove=y.onMouseMove.bind(y),y.waitForHover=y.waitForHover.bind(y),y.hide=y.hide.bind(y);var b=y.getElement();return b.style.whiteSpace="pre-wrap",b.style.pointerEvents="auto",b.addEventListener("mouseout",y.onMouseOut),b.tabIndex=-1,b.addEventListener("blur",function(){b.contains(document.activeElement)||this.hide()}.bind(y)),b.addEventListener("wheel",n),y}return g.prototype.addToEditor=function(m){m.on("mousemove",this.onMouseMove),m.on("mousedown",this.hide),m.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},g.prototype.removeFromEditor=function(m){m.off("mousemove",this.onMouseMove),m.off("mousedown",this.hide),m.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},g.prototype.onMouseMove=function(m,y){this.lastEvent=m,this.lastT=Date.now();var b=y.$mouseHandler.isMousePressed;if(this.isOpen){var C=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(C.row,C.column)||b||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||b||(this.lastEvent=m,this.timeout=setTimeout(this.waitForHover,this.idleTime))},g.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var m=Date.now()-this.lastT;if(this.idleTime-m>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-m);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},g.prototype.isOutsideOfText=function(m){var y=m.editor,b=m.getDocumentPosition(),C=y.session.getLine(b.row);if(b.column==C.length){var E=y.renderer.pixelToScreenCoordinates(m.clientX,m.clientY),w=y.session.documentToScreenPosition(b.row,b.column);if(w.column!=E.column||w.row!=E.row)return!0}return!1},g.prototype.setDataProvider=function(m){this.$gatherData=m},g.prototype.showForRange=function(m,y,b,C){var E=10;if(!(C&&C!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var w=m.renderer;this.isOpen||(u.addPopup(this),this.$registerCloseEvents(),this.setTheme(w.theme)),this.isOpen=!0,this.addMarker(y,m.session),this.range=d.fromPoints(y.start,y.end);var k=w.textToScreenCoordinates(y.start.row,y.start.column),I=w.scroller.getBoundingClientRect();k.pageX<I.left&&(k.pageX=I.left);var L=this.getElement();L.innerHTML="",L.appendChild(b),L.style.maxHeight="",L.style.display="block";var F=L.clientHeight,R=L.clientWidth,M=window.innerHeight-k.pageY-w.lineHeight,A=!0;k.pageY-F<0&&k.pageY<M&&(A=!1),L.style.maxHeight=(A?k.pageY:M)-E+"px",L.style.top=A?"":k.pageY+w.lineHeight+"px",L.style.bottom=A?window.innerHeight-k.pageY+"px":"",L.style.left=Math.min(k.pageX,window.innerWidth-R-E)+"px"}},g.prototype.addMarker=function(m,y){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=y,this.marker=y&&y.addMarker(m,"ace_highlight-marker","text")},g.prototype.hide=function(m){!m&&document.activeElement==this.getElement()||m&&m.target&&(m.type!="keydown"||m.ctrlKey||m.metaKey)&&this.$element.contains(m.target)||(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,u.removePopup(this)))},g.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},g.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},g.prototype.onMouseOut=function(m){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,this.isOpen&&(!m.relatedTarget||this.getElement().contains(m.relatedTarget)||m&&m.currentTarget.contains(m.relatedTarget)||m.relatedTarget.classList.contains("ace_content")||this.hide())},g}(a);e.HoverTooltip=h});ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var h=function(p,g){return h=Object.
172setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var b in y)Object.prototype.hasOwnProperty.call(y,b)&&(m[b]=y[b])},h(p,g)};return function(p,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");h(p,g);function m(){this.constructor=p}p.prototype=g===null?Object.create(g):(m.prototype=g.prototype,new m)}}(),c=this&&this.__values||function(h){var p=typeof Symbol=="function"&&Symbol.iterator,g=p&&h[p],m=0;if(g)return g.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&m>=h.length&&(h=void 0),{value:h&&h[m++],done:!h}}};throw new TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")},f=t("../lib/dom"),i=t("../lib/event"),d=t("../tooltip").Tooltip,n=t("../config").nls,o=5,a=3;e.GUTTER_TOOLTIP_LEFT_OFFSET=o,e.GUTTER_TOOLTIP_TOP_OFFSET=a;function l(h){var p=h.editor,g=p.renderer.$gutterLayer,m=new u(p,!0);h.editor.setDefaultHandler("guttermousedown",function(k){if(!(!p.isFocused()||k.getButton()!=0)){var I=g.getRegion(k);if(I!="foldWidgets"){var L=k.getDocumentPosition().row,F=p.session.selection;if(k.getShiftKey())F.selectTo(L,0);else{if(k.domEvent.detail==2)return p.selectAll(),k.preventDefault();h.$clickSelection=p.selection.getLineRange(L)}return h.setState("selectByLines"),h.captureMouse(k),k.preventDefault()}}});var y,b;function C(){var k=b.getDocumentPosition().row,I=p.session.getLength();if(k==I){var L=p.renderer.pixelToScreenCoordinates(0,b.y).row,F=b.$pos;if(L>p.session.documentToScreenRow(F.row,F.column))return E()}if(m.showTooltip(k),!!m.isOpen)if(p.on("mousewheel",E),p.on("changeSession",E),window.addEventListener("keydown",E,!0),h.$tooltipFollowsMouse)w(b);else{var R=b.getGutterRow(),M=g.$lines.get(R);if(M){var A=M.element.querySelector(".ace_gutter_annotation"),_=A.getBoundingClientRect(),O=m.getElement().style;O.left=_.right-o+"px",O.top=_.bottom-a+"px"}else w(b)}}function E(k){k&&k.type==="keydown"&&(k.ctrlKey||k.metaKey)||k&&k.type==="mouseout"&&(!k.relatedTarget||m.getElement().contains(k.relatedTarget))||(y&&(y=clearTimeout(y)),m.isOpen&&(m.hideTooltip(),p.off("mousewheel",E),p.off("changeSession",E),window.removeEventListener("keydown",E,!0)))}function w(k){m.setPosition(k.x,k.y)}h.editor.setDefaultHandler("guttermousemove",function(k){var I=k.domEvent.target||k.domEvent.srcElement;if(f.hasCssClass(I,"ace_fold-widget")||f.hasCssClass(I,"ace_custom-widget"))return E();m.isOpen&&h.$tooltipFollowsMouse&&w(k),b=k,!y&&(y=setTimeout(function(){y=null,b&&!h.isMousePressed&&C()},50))}),i.addListener(p.renderer.$gutter,"mouseout",function(k){b=null,m.isOpen&&(y=setTimeout(function(){y=null,E(k)},50))},p)}e.GutterHandler=l;var u=function(h){s(p,h);function p(g,m){m===void 0&&(m=!1);var y=h.call(this,g.container)||this;y.editor=g,y.visibleTooltipRow;var b=y.getElement();return b.setAttribute("role","tooltip"),b.style.pointerEvents="auto",m&&(y.onMouseOut=y.onMouseOut.bind(y),b.addEventListener("mouseout",y.onMouseOut)),y}return p.prototype.onMouseOut=function(g){this.isOpen&&(!g.relatedTarget||this.getElement().contains(g.relatedTarget)||g&&g.currentTarget.contains(g.relatedTarget)||this.hideTooltip())},p.prototype.setPosition=function(g,m){var y=window.innerWidth||document.documentElement.clientWidth,b=window.innerHeight||document.documentElement.clientHeight,C=this.getWidth(),E=this.getHeight();g+=15,m+=15,g+C>y&&(g-=g+C-y),m+E>b&&(m-=20+E),d.prototype.setPosition.call(this,g,m)},Object.defineProperty(p,"annotationLabels",{get:function(){return{error:{singular:n("gutter-tooltip.aria-label.error.singular","error"),plural:n("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:n("gutter-tooltip.aria-label.security.singular","security finding"),plural:n("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:n("gutter-tooltip.aria-label.warning.singular","warning"),plural:n("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:n("gutter-tooltip.aria-label.info.singular","information message"),plural:n("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:n("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:n("gutter-tooltip.aria-label.hint.plural","suggestions")}}}
172,enumerable:!1,configurable:!0}),p.prototype.showTooltip=function(g){var m,y=this.editor.renderer.$gutterLayer,b=y.$annotations[g],C;b?C={displayText:Array.from(b.displayText),type:Array.from(b.type)}:C={displayText:[],type:[]};var E=y.session.getFoldLine(g);if(E&&y.$showFoldedAnnotations){for(var w={error:[],security:[],warning:[],info:[],hint:[]},k={error:1,security:2,warning:3,info:4,hint:5},I,L=g+1;L<=E.end.row;L++)if(y.$annotations[L])for(var F=0;F<y.$annotations[L].text.length;F++){var R=y.$annotations[L].type[F];w[R].push(y.$annotations[L].text[F]),(!I||k[R]<k[I])&&(I=R)}if(["error","security","warning"].includes(I)){var M="".concat(p.annotationsToSummaryString(w)," in folded code.");C.displayText.push(M),C.type.push(I+"_fold")}}if(C.displayText.length===0)return this.hideTooltip();for(var A={error:[],security:[],warning:[],info:[],hint:[]},_=y.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",L=0;L<C.displayText.length;L++){var O=f.createElement("span"),D=f.createElement("span");(m=D.classList).add.apply(m,["ace_".concat(C.type[L]),_]),D.setAttribute("aria-label","".concat(p.annotationLabels[C.type[L].replace("_fold","")].singular)),D.setAttribute("role","img"),D.appendChild(f.createTextNode(" ")),O.appendChild(D),O.appendChild(f.createTextNode(C.displayText[L])),O.appendChild(f.createElement("br")),A[C.type[L].replace("_fold","")].push(O)}var B=this.getElement();f.removeChildren(B),A.error.forEach(function(P){return B.appendChild(P)}),A.security.forEach(function(P){return B.appendChild(P)}),A.warning.forEach(function(P){return B.appendChild(P)}),A.info.forEach(function(P){return B.appendChild(P)}),A.hint.forEach(function(P){return B.appendChild(P)}),B.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.visibleTooltipRow=g,this.editor._signal("showGutterTooltip",this)},p.prototype.hideTooltip=function(){this.isOpen&&(this.$element.removeAttribute("aria-live"),this.hide(),this.visibleTooltipRow=void 0,this.editor._signal("hideGutterTooltip",this))},p.annotationsToSummaryString=function(g){var m,y,b=[],C=["error","security","warning","info","hint"];try{for(var E=c(C),w=E.next();!w.done;w=E.next()){var k=w.value;if(g[k].length){var I=g[k].length===1?p.annotationLabels[k].singular:p.annotationLabels[k].plural;b.push("".concat(g[k].length," ").concat(I))}}}catch(L){m={error:L}}finally{try{w&&!w.done&&(y=E.return)&&y.call(E)}finally{if(m)throw m.error}}return b.join(", ")},p}(d);e.GutterTooltip=u});ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(t,e,r){"use strict";var s=t("../lib/event"),c=t("../lib/useragent"),f=function(){function i(d,n){this.speed,this.wheelX,this.wheelY,this.domEvent=d,this.editor=n,this.x=this.clientX=d.clientX,this.y=this.clientY=d.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return i.prototype.stopPropagation=function(){s.stopPropagation(this.domEvent),this.propagationStopped=!0},i.prototype.preventDefault=function(){s.preventDefault(this.domEvent),this.defaultPrevented=!0},i.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},i.prototype.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},i.prototype.getGutterRow=function(){var d=this.getDocumentPosition().row,n=this.editor.session.documentToScreenRow(d,0),o=this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0);return n-o},i.prototype.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var d=this.editor,n=d.getSelectionRange();if(n.isEmpty())this.$inSelection=!1;else{var o=this.getDocumentPosition();this.$inSelection=n.contains(o.row,o.column)}return this.$inSelection},i.prototype.getButton=function(){return s.getButton(this.domEvent)},i.prototype.getShiftKey=function(){return this.domEvent.shiftKey},i.prototype.getAccelKey=function(){return c.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},i}();e.MouseEvent=f});ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=t("../lib/event"),f=t("../lib/useragent"),i=200,d=200,n=5;function o(l){var u=l.editor,h=s.createElement("div");h.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",h.textContent="\xA0";var p=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];p.forEach(function(G){l[G]=this[G]},this),u.on("mousedown",this.onMouseDown.bind(l));var g=u.container,m,y,b,C,E,w,k=0,I,L,F,R,M;this.onDragStart=function(G){if(this.cancelDrag||!g.draggable){var X=this;return setTimeout(function(){X.startSelect(),X.captureMouse(G)},0),G.preventDefault()}E=u.getSelectionRange();var Z=G.dataTransfer;Z.effectAllowed=u.getReadOnly()?"copy":"copyMove",u.container.appendChild(h),Z.setDragImage&&Z.setDragImage(h,0,0),setTimeout(function(){u.container.removeChild(h)}),Z.clearData(),Z.setData("Text",u.session.getTextRange()),L=!0,this.setState("drag")},this.onDragEnd=function(G){if(g.draggable=!1,L=!1,this.setState(null),!u.getReadOnly()){var X=G.dataTransfer.dropEffect;!I&&X=="move"&&u.session.remove(u.getSelectionRange()),u.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(G){if(!(u.getReadOnly()||!W(G.dataTransfer)))return y=G.clientX,b=G.clientY,m||D(),k++,G.dataTransfer.dropEffect=I=K(G),c.preventDefault(G)},this.onDragOver=function(G){if(!(u.getReadOnly()||!W(G.dataTransfer)))return y=G.clientX,b=G.clientY,m||(D(),k++),P!==null&&(P=null),G.dataTransfer.dropEffect=I=K(G),c.preventDefault(G)},this.onDragLeave=function(G){if(k--,k<=0&&m)return B(),I=null,c.preventDefault(G)},this.onDrop=function(G){if(w){var X=G.dataTransfer;if(L)switch(I){case"move":E.contains(w.row,w.column)?E={start:w,end:w}:E=u.moveText(E,w);break;case"copy":E=u.moveText(E,w,!0);break}else{var Z=X.getData("Text");E={start:w,end:u.session.insert(w,Z)},u.focus(),I=null}return B(),c.preventDefault(G)}},c.addListener(g,"dragstart",this.onDragStart.bind(l),u),c.addListener(g,"dragend",this.onDragEnd.bind(l),u),c.addListener(g,"dragenter",this.onDragEnter.bind(l),u),c.addListener(g,"dragover",this.onDragOver.bind(l),u),c.addListener(g,"dragleave",this.onDragLeave.bind(l),u),c.addListener(g,"drop",this.onDrop.bind(l),u);function A(G,X){var Z=Date.now(),q=!X||G.row!=X.row,Q=!X||G.column!=X.column;if(!R||q||Q)u.moveCursorToPosition(G),R=Z,M={x:y,y:b};else{var ie=a(M.x,M.y,y,b);ie>n?R=null:Z-R>=d&&(u.renderer.scrollCursorIntoView(),R=null)}}function _(G,X){var Z=Date.now(),q=u.renderer.layerConfig.lineHeight,Q=u.renderer.layerConfig.characterWidth,ie=u.renderer.scroller.getBoundingClientRect(),ae={x:{left:y-ie.left,right:ie.right-y},y:{top:b-ie.top,bottom:ie.bottom-b}},oe=Math.min(ae.x.left,ae.x.right),fe=Math.min(ae.y.top,ae.y.bottom),he={row:G.row,column:G.column};oe/Q<=2&&(he.column+=ae.x.left<ae.x.right?-3:2),fe/q<=1&&(he.row+=ae.y.top<ae.y.bottom?-1:1);var xe=G.row!=he.row,ke=G.column!=he.column,Re=!X||G.row!=X.row;xe||ke&&!Re?F?Z-F>=i&&u.renderer.scrollCursorIntoView(he):F=Z:F=null}function O(){var G=w;w=u.renderer.screenToTextCoordinates(y,b),A(w,G),_(w,G)}function D(){E=u.selection.toOrientedRange(),m=u.session.addMarker(E,"ace_selection",u.getSelectionStyle()),u.clearSelection(),u.isFocused()&&u.renderer.$cursorLayer.setBlinking(!1),clearInterval(C),O(),C=setInterval(O,20),k=0,c.addListener(document,"mousemove",H)}function B(){clearInterval(C),u.session.removeMarker(m),m=null,u.selection.fromOrientedRange(E),u.isFocused()&&!L&&u.$resetCursorStyle(),E=null,w=null,k=0,F=null,R=null,c.removeListener(document,"mousemove",H)}var P=null;function H(){P==null&&(P=setTimeout(function(){P!=null&&m&&B()},20))}function W(G){var X=G.types;return!X||Array.prototype.some.call(X,function(Z){return Z=="text/plain"||Z=="Text"})}function K(G){var X=["copy","copymove","all","uninitialized"],Z=["move","copymove","linkmove","all","uninitialized"],q=f.isMac?G.altKey:G.ctrlKey,Q="uninitialized";try{Q=G.dataTransfer.effectAllowed.toLowerCase()}catch{}var ie="none";return q&&X.indexOf(Q)>=0?ie="copy":Z.indexOf(Q)>=0?ie="move":X.indexOf(Q)>=0&&(ie="copy"),ie}}(function(){this.dragWait=function(){var l=Date.now()-this.mousedownEvent.time;l>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var l=this.editor.container;l.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(l){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var l=this.editor,u=l.container;u.draggable=!0,l.renderer.$cursorLayer.setBlinking(!1),l.setStyle("ace_dragging");var h=f.isWin?"default":"move";l.renderer.setCursorStyle(h),this.setState("dragReady")},this.onMouseDrag=function(l){var u=this.editor.container;if(f.isIE&&this.state=="dragReady"){var h=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);h>3&&u.dragDrop()}if(this.state==="dragWait"){var h=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);h>0&&(u.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(l){if(this.$dragEnabled){this.mousedownEvent=l;var u=this.editor,h=l.inSelection(),p=l.getButton(),g=l.domEvent.detail||1;if(g===1&&p===0&&h){if(l.editor.inMultiSelectMode&&(l.getAccelKey()||l.getShiftKey()))return;this.mousedownEvent.time=Date.now();var m=l.domEvent.target||l.domEvent.srcElement;if("unselectable"in m&&(m.unselectable="on"),u.getDragDelay()){if(f.isWebKit){this.cancelDrag=!0;var y=u.container;y.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(l,this.onMouseDrag.bind(this)),l.defaultPrevented=!0}}}}).call(o.prototype);function a(l,u,h,p){return Math.sqrt(Math.pow(h-l,2)+Math.pow(p-u,2))}e.DragdropHandler=o});ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(t,e,r){"use strict";var s=t("./mouse_event").MouseEvent,c=t("../lib/event"),f=t("../lib/dom");e.addTouchListeners=function(i,d){var n="scroll",o,a,l,u,h,p,g=0,m,y=0,b=0,C=0,E,w;function k(){var A=window.navigator&&window.navigator.clipboard,_=!1,O=function(){var P=d.getCopyText(),H=d.session.getUndoManager().hasUndo();w.replaceChild(f.buildDom(_?["span",!P&&D("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],P&&D("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],P&&D("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],A&&D("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],H&&D("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],D("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],D("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),w.firstChild)},D=function(P){return d.commands.canExecute(P,d)},B=function(P){var H=P.target.getAttribute("action");if(H=="more"||!_)return _=!_,O();H=="paste"?A.readText().then(function(W){d.execCommand(H,W)}):H&&((H=="cut"||H=="copy")&&(A?A.writeText(d.getCopyText()):document.execCommand("copy")),d.execCommand(H)),w.firstChild.style.display="none",_=!1,H!="openCommandPalette"&&d.focus()};w=f.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(P){n="menu",P.stopPropagation(),P.preventDefault(),d.textInput.focus()},ontouchend:function(P){P.stopPropagation(),P.preventDefault(),B(P)},onclick:B},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],d.container)}function I(){if(!d.getOption("enableMobileMenu")){w&&L();return}w||k();var A=d.selection.cursor,_=d.renderer.textToScreenCoordinates(A.row,A.column),O=d.renderer.textToScreenCoordinates(0,0).pageX,D=d.renderer.scrollLeft,B=d.container.getBoundingClientRect();w.style.top=_.pageY-B.top-3+"px",_.pageX-B.left<B.width-70?(w.style.left="",w.style.right="10px"):(w.style.right="",w.style.left=O+D-B.left+"px"),w.style.display="",w.firstChild.style.display="none",d.on("input",L
172)}function L(A){w&&(w.style.display="none"),d.off("input",L)}function F(){h=null,clearTimeout(h);var A=d.selection.getRange(),_=A.contains(m.row,m.column);(A.isEmpty()||!_)&&(d.selection.moveToPosition(m),d.selection.selectWord()),n="wait",I()}function R(){h=null,clearTimeout(h),d.selection.moveToPosition(m);var A=y>=2?d.selection.getLineRange(m.row):d.session.getBracketRange(m);A&&!A.isEmpty()?d.selection.setRange(A):d.selection.selectWord(),n="wait"}c.addListener(i,"contextmenu",function(A){if(E){var _=d.textInput.getElement();_.focus()}},d),c.addListener(i,"touchstart",function(A){var _=A.touches;if(h||_.length>1){clearTimeout(h),h=null,l=-1,n="zoom";return}E=d.$mouseHandler.isMousePressed=!0;var O=d.renderer.layerConfig.lineHeight,D=d.renderer.layerConfig.lineHeight,B=A.timeStamp;u=B;var P=_[0],H=P.clientX,W=P.clientY;Math.abs(o-H)+Math.abs(a-W)>O&&(l=-1),o=A.clientX=H,a=A.clientY=W,b=C=0;var K=new s(A,d);if(m=K.getDocumentPosition(),B-l<500&&_.length==1&&!g)y++,A.preventDefault(),A.button=0,R();else{y=0;var G=d.selection.cursor,X=d.selection.isEmpty()?G:d.selection.anchor,Z=d.renderer.$cursorLayer.getPixelPosition(G,!0),q=d.renderer.$cursorLayer.getPixelPosition(X,!0),Q=d.renderer.scroller.getBoundingClientRect(),ie=d.renderer.layerConfig.offset,ae=d.renderer.scrollLeft,oe=function(xe,ke){return xe=xe/D,ke=ke/O-.75,xe*xe+ke*ke};if(A.clientX<Q.left){n="zoom";return}var fe=oe(A.clientX-Q.left-Z.left+ae,A.clientY-Q.top-Z.top+ie),he=oe(A.clientX-Q.left-q.left+ae,A.clientY-Q.top-q.top+ie);fe<3.5&&he<3.5&&(n=fe>he?"cursor":"anchor"),he<3.5?n="anchor":fe<3.5?n="cursor":n="scroll",h=setTimeout(F,450)}l=B},d),c.addListener(i,"touchend",function(A){E=d.$mouseHandler.isMousePressed=!1,p&&clearInterval(p),n=="zoom"?(n="",g=0):h?(d.selection.moveToPosition(m),g=0,I()):n=="scroll"?(M(),L()):I(),clearTimeout(h),h=null},d),c.addListener(i,"touchmove",function(A){h&&(clearTimeout(h),h=null);var _=A.touches;if(!(_.length>1||n=="zoom")){var O=_[0],D=o-O.clientX,B=a-O.clientY;if(n=="wait")if(D*D+B*B>4)n="cursor";else return A.preventDefault();o=O.clientX,a=O.clientY,A.clientX=O.clientX,A.clientY=O.clientY;var P=A.timeStamp,H=P-u;if(u=P,n=="scroll"){var W=new s(A,d);W.speed=1,W.wheelX=D,W.wheelY=B,10*Math.abs(D)<Math.abs(B)&&(D=0),10*Math.abs(B)<Math.abs(D)&&(B=0),H!=0&&(b=D/H,C=B/H),d._emit("mousewheel",W),W.propagationStopped||(b=C=0)}else{var K=new s(A,d),G=K.getDocumentPosition();n=="cursor"?d.selection.moveCursorToPosition(G):n=="anchor"&&d.selection.setSelectionAnchor(G.row,G.column),d.renderer.scrollCursorIntoView(G),A.preventDefault()}}},d);function M(){g+=60,p=setInterval(function(){g--<=0&&(clearInterval(p),p=null),Math.abs(b)<.01&&(b=0),Math.abs(C)<.01&&(C=0),g<20&&(b=.9*b),g<20&&(C=.9*C);var A=d.session.getScrollTop();d.renderer.scrollBy(10*b,10*C),A==d.session.getScrollTop()&&(g=0)},10)}}});ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(t,e,r){"use strict";var s=t("../lib/event"),c=t("../lib/useragent"),f=t("./default_handlers").DefaultHandlers,i=t("./default_gutter_handler").GutterHandler,d=t("./mouse_event").MouseEvent,n=t("./dragdrop_handler").DragdropHandler,o=t("./touch_handler").addTouchListeners,a=t("../config"),l=function(){function u(h){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var p=this;this.editor=h,new f(this),new i(this),new n(this);var g=function(b){var C=!document.hasFocus||!document.hasFocus()||!h.isFocused()&&document.activeElement==(h.textInput&&h.textInput.getElement());C&&window.focus(),h.focus(),setTimeout(function(){h.isFocused()||h.focus()})},m=h.renderer.getMouseEventTarget();s.addListener(m,"click",this.onMouseEvent.bind(this,"click"),h),s.addListener(m,"mousemove",this.onMouseMove.bind(this,"mousemove"),h),s.addMultiMouseDownListener([m,h.renderer.scrollBarV&&h.renderer.scrollBarV.inner,h.renderer.scrollBarH&&h.renderer.scrollBarH.inner,h.textInput&&h.textInput.getElement()].filter(
172Boolean),[400,300,250],this,"onMouseEvent",h),s.addMouseWheelListener(h.container,this.onMouseWheel.bind(this,"mousewheel"),h),o(h.container,h);var y=h.renderer.$gutter;s.addListener(y,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),h),s.addListener(y,"click",this.onMouseEvent.bind(this,"gutterclick"),h),s.addListener(y,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),h),s.addListener(y,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),h),s.addListener(m,"mousedown",g,h),s.addListener(y,"mousedown",g,h),c.isIE&&h.renderer.scrollBarV&&(s.addListener(h.renderer.scrollBarV.element,"mousedown",g,h),s.addListener(h.renderer.scrollBarH.element,"mousedown",g,h)),h.on("mousemove",function(b){if(!(p.state||p.$dragDelay||!p.$dragEnabled)){var C=h.renderer.screenToTextCoordinates(b.x,b.y),E=h.session.selection.getRange(),w=h.renderer;!E.isEmpty()&&E.insideStart(C.row,C.column)?w.setCursorStyle("default"):w.setCursorStyle("")}},h)}return u.prototype.onMouseEvent=function(h,p){this.editor.session&&this.editor._emit(h,new d(p,this.editor))},u.prototype.onMouseMove=function(h,p){var g=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!g||!g.length||this.editor._emit(h,new d(p,this.editor))},u.prototype.onMouseWheel=function(h,p){var g=new d(p,this.editor);g.speed=this.$scrollSpeed*2,g.wheelX=p.wheelX,g.wheelY=p.wheelY,this.editor._emit(h,g)},u.prototype.setState=function(h){this.state=h},u.prototype.captureMouse=function(h,p){this.x=h.x,this.y=h.y,this.isMousePressed=!0;var g=this.editor,m=this.editor.renderer;m.$isMousePressed=!0;var y=this,b=function(I){if(I){if(c.isWebKit&&!I.which&&y.releaseMouse)return y.releaseMouse();y.x=I.clientX,y.y=I.clientY,p&&p(I),y.mouseEvent=new d(I,y.editor),y.$mouseMoved=!0}},C=function(I){g.off("beforeEndOperation",w),clearInterval(k),g.session&&E(),y[y.state+"End"]&&y[y.state+"End"](I),y.state="",y.isMousePressed=m.$isMousePressed=!1,m.$keepTextAreaAtCursor&&m.$moveTextAreaToCursor(),y.$onCaptureMouseMove=y.releaseMouse=null,I&&y.onMouseEvent("mouseup",I),g.endOperation()},E=function(){y[y.state]&&y[y.state](),y.$mouseMoved=!1};if(c.isOldIE&&h.domEvent.type=="dblclick")return setTimeout(function(){C(h)});var w=function(I){y.releaseMouse&&g.curOp.command.name&&g.curOp.selectionChanged&&(y[y.state+"End"]&&y[y.state+"End"](),y.state="",y.releaseMouse())};g.on("beforeEndOperation",w),g.startOperation({command:{name:"mouse"}}),y.$onCaptureMouseMove=b,y.releaseMouse=s.capture(this.editor.container,b,C);var k=setInterval(E,20)},u.prototype.cancelContextMenu=function(){var h=function(p){p&&p.domEvent&&p.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",h),p&&p.domEvent&&s.stopEvent(p.domEvent))}.bind(this);setTimeout(h,10),this.editor.on("nativecontextmenu",h)},u.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},u}();l.prototype.releaseMouse=null,a.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:c.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),e.MouseHandler=l});ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=function(){function f(i){i.on("click",function(d){var n=d.getDocumentPosition(),o=i.session,a=o.getFoldAt(n.row,n.column,1);a&&(d.getAccelKey()?o.removeFold(a):o.expandFold(a),d.stop());var l=d.domEvent&&d.domEvent.target;l&&s.hasCssClass(l,"ace_inline_button")&&s.hasCssClass(l,"ace_toggle_wrap")&&(o.setOption("wrap",!o.getUseWrapMode()),i.renderer.scrollCursorIntoView())}),i.on("gutterclick",function(d){var n=i.renderer.$gutterLayer.getRegion(d);if(n=="foldWidgets"){var o=d.getDocumentPosition().row,a=i.session;a.foldWidgets&&a.foldWidgets[o]&&i.session.onFoldWidgetClick(o,d),i.isFocused()||i.focus(),d.stop()}}),i.on("gutterdblclick",function(d){var n=i.renderer.$gutterLayer.getRegion(d);if(n=="foldWidgets"){var o=d.getDocumentPosition().row,a=i.session,l=a.getParentFoldRangeData(o,!0),u=l.range||l.firstRange;if(u){o=u.start.row;var h=a.getFoldAt(o,a.getLine(o).length,1);h?a.removeFold(h):(a.addFold("...",u),i.renderer.scrollCursorIntoView({row:u.start.row,column:0}))}d.stop()}})}return f}();e.FoldHandler=c});ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(t,e,r){"use strict";var s=t("../lib/keys"),c=t("../lib/event"),f=function(){function i(d){this.$editor=d,this.$data={editor:d},this.$handlers=[],this.setDefaultHandler(d.commands)}return i.prototype.setDefaultHandler=function(d){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=d,this.addKeyboardHandler(d,0)},i.prototype.setKeyboardHandler=function(d){var n=this.$handlers;if(n[n.length-1]!=d){for(;n[n.length-1]&&n[n.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(n[n.length-1]);this.addKeyboardHandler(d,1)}},i.prototype.addKeyboardHandler=function(d,n){if(d){typeof d=="function"&&!d.handleKeyboard&&(d.handleKeyboard=d);var o=this.$handlers.indexOf(d);o!=-1&&this.$handlers.splice(o,1),n==null?this.$handlers.push(d):this.$handlers.splice(n,0,d),o==-1&&d.attach&&d.attach(this.$editor)}},i.prototype.removeKeyboardHandler=function(d){var n=this.$handlers.indexOf(d);return n==-1?!1:(this.$handlers.splice(n,1),d.detach&&d.detach(this.$editor),!0)},i.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},i.prototype.getStatusText=function(){var d=this.$data,n=d.editor;return this.$handlers.map(function(o){return o.getStatusText&&o.getStatusText(n,d)||""}
172).filter(Boolean).join(" ")},i.prototype.$callKeyboardHandlers=function(d,n,o,a){for(var l,u=!1,h=this.$editor.commands,p=this.$handlers.length;p--&&(l=this.$handlers[p].handleKeyboard(this.$data,d,n,o,a),!(!(!l||!l.command)&&(l.command=="null"?u=!0:u=h.exec(l.command,this.$editor,l.args,a),u&&a&&d!=-1&&l.passEvent!=!0&&l.command.passEvent!=!0&&c.stopEvent(a),u))););return!u&&d==-1&&(l={command:"insertstring"},u=h.exec("insertstring",this.$editor,n)),u&&this.$editor._signal&&this.$editor._signal("keyboardActivity",l),u},i.prototype.onCommandKey=function(d,n,o){var a=s.keyCodeToString(o);return this.$callKeyboardHandlers(n,a,o,d)},i.prototype.onTextInput=function(d){return this.$callKeyboardHandlers(-1,d)},i}();e.KeyBinding=f});ace.define("ace/lib/bidiutil",["require","exports","module"],function(t,e,r){"use strict";var s=["\u0621","\u0641"],c=["\u063A","\u064A"],f=0,i=0,d=!1,n=!1,o=!1,a=!1,l=!1,u=!1,h=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],p=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],g=0,m=1,y=0,b=1,C=2,E=3,w=4,k=5,I=6,L=7,F=8,R=9,M=10,A=11,_=12,O=13,D=14,B=15,P=16,H=17,W=18,K=[W,W,W,W,W,W,W,W,W,I,k,I,F,k,W,W,W,W,W,W,W,W,W,W,W,W,W,W,k,k,k,I,F,w,w,A,A,A,w,w,w,w,w,M,R,M,R,R,C,C,C,C,C,C,C,C,C,C,R,w,w,w,w,w,w,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,w,w,w,w,w,w,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,w,w,w,w,W,W,W,W,W,W,k,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,w,A,A,A,A,w,w,w,w,y,w,w,W,w,w,A,A,C,C,w,y,w,w,w,C,y,w,w,w,w,w],G=[F,F,F,F,F,F,F,F,F,F,F,W,W,W,y,b,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,F,k,O,D,B,P,H,R,A,A,A,A,A,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,R,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,F];function X(ae,oe,fe,he){var xe=f?p:h,ke=null,Re=null,Ce=null,Ae=0,ue=null,ut=null,Je=-1,Me=null,Ue=null,Ve=[];if(!he)for(Me=0,he=[];Me<fe;Me++)he[Me]=Q(ae[Me]);for(i=f,d=!1,n=!1,o=!1,a=!1,Ue=0;Ue<fe;Ue++){if(ke=Ae,Ve[Ue]=Re=q(ae,he,Ve,Ue),Ae=xe[ke][Re],ue=Ae&240,Ae&=15,oe[Ue]=Ce=xe[Ae][5],ue>0)if(ue==16){for(Me=Je;Me<Ue;Me++)oe[Me]=1;Je=-1}else Je=-1;if(ut=xe[Ae][6],ut)Je==-1&&(Je=Ue);else if(Je>-1){for(Me=Je;Me<Ue;Me++)oe[Me]=Ce;Je=-1}he[Ue]==k&&(oe[Ue]=0),i|=Ce}if(a){for(Me=0;Me<fe;Me++)if(he[Me]==I){oe[Me]=f;for(var Ne=Me-1;Ne>=0&&he[Ne]==F;Ne--)oe[Ne]=f}}}function Z(ae,oe,fe){if(!(i<ae)){if(ae==1&&f==m&&!o){fe.reverse();return}for(var he=fe.length,xe=0,ke,Re,Ce,Ae;xe<he;){if(oe[xe]>=ae){for(ke=xe+1;ke<he&&oe[ke]>=ae;)ke++;for(Re=xe,Ce=ke-1;Re<Ce;Re++,Ce--)Ae=fe[Re],fe[Re]=fe[Ce],fe[Ce]=Ae;xe=ke}xe++}}}function q(ae,oe,fe,he){var xe=oe[he],ke,Re,Ce,Ae;switch(xe){case y:case b:d=!1;case w:case E:return xe;case C:return d?E:C;case L:return d=!0,n=!0,b;case F:return w;case R:return he<1||he+1>=oe.length||(ke=fe[he-1])!=C&&ke!=E||(Re=oe[he+1])!=C&&Re!=E?w:(d&&(Re=E),Re==ke?Re:w);case M:return ke=he>0?fe[he-1]:k,ke==C&&he+1<oe.length&&oe[he+1]==C?C:w;case A:if(he>0&&fe[he-1]==C)return C;if(d)return w;for(Ae=he+1,Ce=oe.length;Ae<Ce&&oe[Ae]==A;)Ae++;return Ae<Ce&&oe[Ae]==C?C:w;case _:for(Ce=oe.length,Ae=he+1;Ae<Ce&&oe[Ae]==_;)Ae++;if(Ae<Ce){var ue=ae[he],ut=ue>=1425&&ue<=2303||ue==64286;if(ke=oe[Ae],ut&&(ke==b||ke==L))return b}return he<1||(ke=oe[he-1])==k?w:fe[he-1];case k:return d=!1,o=!0,f;case I:return a=!0,w;case O:case D:case P:case H:case B:d=!1;case W:return w}}function Q(ae){var oe=ae.charCodeAt(0),fe=oe>>8;return fe==0?oe>191?y:K[oe]:fe==5?/[\u0591-\u05f4]/.test(ae)?b:y:fe==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(ae)?_:/[\u0660-\u0669\u066b-\u066c]/.test(ae)?E:oe==1642?A:/[\u06f0-\u06f9]/.test(ae)?C:L:fe==32&&oe<=8287?G[oe&255]:fe==254&&oe>=65136?L:w}function ie(ae){return ae>="\u064B"&&ae<="\u0655"}e.L=y,e.R=b,e.EN=C,e.ON_R=3,e.AN=4,e.R_H=5,e.B=6,e.RLE=7,e.DOT="\xB7",e.doBidiReorder=function(ae,oe,fe){if(ae.length<2)return{};var he=ae.split(""),xe=new Array(he.length),ke=new Array(he.length),Re=[];f=fe?m:g,X(he,Re,he.length,oe);for(var Ce=0;Ce<xe.length;xe[Ce]=Ce,Ce++);Z(2,Re,xe),Z(1,Re,xe);for(var Ce=0;Ce<xe.length-1;Ce++)oe[Ce]===E?Re[Ce]=e.AN:Re[Ce]===b&&(oe[Ce]>L&&oe[Ce]<O||oe[Ce]===w||oe[Ce]===W)?Re[Ce]=e.ON_R:Ce>0&&he[Ce-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(he[Ce])&&(Re[Ce-1]=Re[Ce]=e.R_H,Ce++);he[he.length-1]===e.DOT&&(Re[he.length-1]=e.B),he[0]==="\u202B"&&(Re[0]=e.RLE);for(var Ce=0;Ce<xe.length;Ce++)ke[Ce]=Re[xe[Ce]];return{logicalFromVisual:xe,bidiLevels:ke}},e.hasBidiCharacters=function(ae,oe){for(var fe=!1,he=0;he<ae.length;he++)oe[he]=Q(ae.charAt(he)),!fe&&(oe[he]==b||oe[he]==L||oe[he]==E)&&(fe=!0);return fe},e.getVisualFromLogicalIdx=function(ae,oe){for(var fe=0;fe<oe.logicalFromVisual.length;fe++)if(oe.logicalFromVisual[fe]==ae)return fe;return 0}});ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(t,e,r){"use strict";var s=t("./lib/bidiutil"),c=t("./lib/lang"),f=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,i=function(){function d(n){this.session=n,this.bidiMap={},this.currentRow=null,this.bidiUtil=s,this.charWidths=[],this.EOL="\xAC",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="\xB6",this.RLE="\u202B",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=f.test(n.getValue())}return d.prototype.isBidiRow=function(n,o,a){return this.seenBidi?(n!==this.currentRow&&(this.currentRow=n,this.updateRowLine(o,a),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},d.prototype.onChange=function(n){this.seenBidi?this.currentRow=null:n.action=="insert"&&f.test(n.lines.join(`
173`))&&(this.seenBidi=!0,this.currentRow=null)},d.prototype.getDocumentRow=function(){var n=0,o=this.session.$screenRowCache;if(o.length){var a=this.session.$getRowCacheIndex(o,this.currentRow);a>=0&&(n=this.session.$docRowCache[a])}return n},d.prototype.getSplitIndex=function(){var n=0,o=this.session.$screenRowCache;if(o.length)for(var a,l=this.session.$getRowCacheIndex(o,this.currentRow);this.currentRow-n>0&&(a=this.session.$getRowCacheIndex(o,this.currentRow-n-1),a===l);)l=a,n++;else n=this.currentRow;return n},d.prototype.updateRowLine=function(n,o){n===void 0&&(n=this.getDocumentRow());var a=n===this.session.getLength()-1,l=a?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(n),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var u=this.session.$wrapData[n];u&&(o===void 0&&(o=this.getSplitIndex()),o>0&&u.length?(this.wrapIndent=u.indent,this.wrapOffset=this.wrapIndent*this.charWidths[s.L],this.line=o<u.length?this.line.substring(u[o-1],u[o]):this.line.substring(u[u.length-1])):this.line=this.line.substring(0,u[o]),o==u.length&&(this.line+=this.showInvisibles?l:s.DOT))}else this.line+=this.showInvisibles?l:s.DOT;var h=this.session,p=0,g;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(m,y){return m==="	"||h.isFullWidth(m.charCodeAt(0))?(g=m==="	"?h.getScreenTabSize(y+p):2,p+=g-1,c.stringRepeat(s.DOT,g)):m}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==s.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},d.prototype.updateBidiMap=function(){var n=[];s.hasBidiCharacters(this.line,n)||this.isRtlDir?this.bidiMap=s.doBidiReorder(this.line,n,this.isRtlDir):this.bidiMap={}},d.prototype.markAsDirty=function(){this.currentRow=null},d.prototype.updateCharacterWidths=function(n){if(this.characterWidth!==n.$characterSize.width){this.fontMetrics=n;var o=this.characterWidth=n.$characterSize.width,a=n.$measureCharWidth("\u05D4");this.charWidths[s.L]=this.charWidths[s.EN]=this.charWidths[s.ON_R]=o,this.charWidths[s.R]=this.charWidths[s.AN]=a,this.charWidths[s.R_H]=a*.45,this.charWidths[s.B]=this.charWidths[s.RLE]=0,this.currentRow=null}},d.prototype.setShowInvisibles=function(n){this.showInvisibles=n,this.currentRow=null},d.prototype.setEolChar=function(n){this.EOL=n},d.prototype.setContentWidth=function(n){this.contentWidth=n},d.prototype.isRtlLine=function(n){return this.$isRtl?!0:n!=null?this.session.getLine(n).charAt(0)==this.RLE:this.isRtlDir},d.prototype.setRtlDirection=function(n,o){for(var a=n.getCursorPosition(),l=n.selection.getSelectionAnchor().row;l<=a.row;l++)!o&&n.session.getLine(l).charAt(0)===n.session.$bidiHandler.RLE?n.session.doc.removeInLine(l,0,1):o&&n.session.getLine(l).charAt(0)!==n.session.$bidiHandler.RLE&&n.session.doc.insert({column:0,row:l},n.session.$bidiHandler.RLE)},d.prototype.getPosLeft=function(n){n-=this.wrapIndent;var o=this.line.charAt(0)===this.RLE?1:0,a=n>o?this.session.getOverwrite()?n:n-1:o,l=s.getVisualFromLogicalIdx(a,this.bidiMap),u=this.bidiMap.bidiLevels,h=0;!this.session.getOverwrite()&&n<=o&&u[l]%2!==0&&l++;for(var p=0;p<l;p++)h+=this.charWidths[u[p]];return!this.session.getOverwrite()&&n>o&&u[l]%2===0&&(h+=this.charWidths[u[l]]),this.wrapIndent&&(h+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(h+=this.rtlLineOffset),h},d.prototype.getSelections=function(n,o){var a=this.bidiMap,l=a.bidiLevels,u,h=[],p=0,g=Math.min(n,o)-this.wrapIndent,m=Math.max(n,o)-this.wrapIndent,y=!1,b=!1,C=0;this.wrapIndent&&(p+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var E,w=0;w<l.length;w++)E=a.logicalFromVisual[w],u=l[w],y=E>=g&&E<m,y&&!b?C=p:!y&&b&&h.push({left:C,width:p-C}),p+=this.charWidths[u],b=y;if(y&&w===l.length&&h.push({left:C,width:p-C}),this.isRtlDir)for(var k=0;k<h.length;k++)h[k].left+=this.rtlLineOffset;return h},d.prototype.offsetToCol=function(a){this.isRtlDir&&(a-=this.rtlLineOffset);var o=0,a=Math.max(a,0),l=0,u=0,h=this.bidiMap.bidiLevels,p=this.charWidths[h[u]];for(this.wrapIndent&&(a-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);a>l+p/2;){if(l+=p,u===h.length-1){p=0;break}p=this.charWidths[h[++u]]}return u>0&&h[u-1]%2!==0&&h[u]%2===0?(a<l&&u--,o=this.bidiMap.logicalFromVisual[u]):u>0&&h[u-1]%2===0&&h[u]%2!==0?o=1+(a>l?this.bidiMap.logicalFromVisual[u]:this.bidiMap.logicalFromVisual[u-1]):this.isRtlDir&&u===h.length-1&&p===0&&h[u-1]%2===0||!this.isRtlDir&&u===0&&h[u]%2!==0?o=1+this.bidiMap.logicalFromVisual[u]:(u>0&&h[u-1]%2!==0&&p!==0&&u--,o=this.bidiMap.logicalFromVisual[u]),o===0&&this.isRtlDir&&o++,o+this.wrapIndent},d}();e.BidiHandler=i});ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./lib/lang"),f=t("./lib/event_emitter").EventEmitter,i=t("./range").Range,d=function(){function n(o){this.session=o,this.doc=o.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var a=this;
vendor: 6,024 bytes, line 173
173this.cursor.on("change",function(l){a.$cursorChanged=!0,a.$silent||a._emit("changeCursor"),!a.$isEmpty&&!a.$silent&&a._emit("changeSelection"),!a.$keepDesiredColumnOnChange&&l.old.column!=l.value.column&&(a.$desiredColumn=null)}),this.anchor.on("change",function(){a.$anchorChanged=!0,!a.$isEmpty&&!a.$silent&&a._emit("changeSelection")})}return n.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},n.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},n.prototype.getCursor=function(){return this.lead.getPosition()},n.prototype.setAnchor=function(o,a){this.$isEmpty=!1,this.anchor.setPosition(o,a)},n.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},n.prototype.getSelectionLead=function(){return this.lead.getPosition()},n.prototype.isBackwards=function(){var o=this.anchor,a=this.lead;return o.row>a.row||o.row==a.row&&o.column>a.column},n.prototype.getRange=function(){var o=this.anchor,a=this.lead;return this.$isEmpty?i.fromPoints(a,a):this.isBackwards()?i.fromPoints(a,o):i.fromPoints(o,a)},n.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},n.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},n.prototype.setRange=function(o,a){var l=a?o.end:o.start,u=a?o.start:o.end;this.$setSelection(l.row,l.column,u.row,u.column)},n.prototype.$setSelection=function(o,a,l,u){if(!this.$silent){var h=this.$isEmpty,p=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(o,a),this.cursor.setPosition(l,u),this.$isEmpty=!i.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||h!=this.$isEmpty||p)&&this._emit("changeSelection")}},n.prototype.$moveSelection=function(o){var a=this.lead;this.$isEmpty&&this.setSelectionAnchor(a.row,a.column),o.call(this)},n.prototype.selectTo=function(o,a){this.$moveSelection(function(){this.moveCursorTo(o,a)})},n.prototype.selectToPosition=function(o){this.$moveSelection(function(){this.moveCursorToPosition(o)})},n.prototype.moveTo=function(o,a){this.clearSelection(),this.moveCursorTo(o,a)},n.prototype.moveToPosition=function(o){this.clearSelection(),this.moveCursorToPosition(o)},n.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},n.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},n.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},n.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},n.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},n.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},n.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},n.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},n.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},n.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},n.prototype.getWordRange=function(o,a){if(typeof a>"u"){var l=o||this.lead;o=l.row,a=l.column}return this.session.getWordRange(o,a)},n.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},n.prototype.selectAWord=function(){var o=this.getCursor(),a=this.session.getAWordRange(o.row,o.column);this.setSelectionRange(a)},n.prototype.getLineRange=function(o,a){var l=typeof o=="number"?o:this.lead.row,u,h=this.session.getFoldLine(l);return h?(l=h.start.row,u=h.end.row):u=l,a===!0?new i(l,0,u,this.session.getLine(u).length):new i(l,0,u+1,0)},n.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},n.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},n.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},n.prototype.wouldMoveIntoSoftTab=function(o,a,l){var u=o.column,h=o.column+a;return l<0&&(u=o.column-a,h=o.column),this.session.isTabStop(o)&&this.doc.getLine(o.row).slice(u,h).split(" ").length-1==a},n.prototype.moveCursorLeft=function(){var o=this.lead.getPosition(),a;if(a=this.session.getFoldAt(o.row,o.column,-1))this.moveCursorTo(a.start.row,a.start.column);else if(o.column===0)o.row>0&&this.moveCursorTo(o.row-1,this.doc.getLine(o.row-1).length);else{var l=this.session.getTabSize();this.wouldMoveIntoSoftTab(o,l,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-l):this.moveCursorBy(0,-1)}},n.prototype.moveCursorRight=function(){var o=this.lead.getPosition(),a;if(a=this.session.getFoldAt(o.row,o.column,1))this.moveCursorTo(a.end.row,a.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var l=this.session.getTabSize(),o=this.lead;this.wouldMoveIntoSoftTab(o,l,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,l):this.moveCursorBy(0,1)}},n.prototype.moveCursorLineStart=function(){var o=this.lead.row,a=this.lead.column,l=this.session.documentToScreenRow(o,a),u=this.session.screenToDocumentPosition(l,0),h=this.session.getDisplayLine(o,null,u.row,u.column),p=h.match(/^\s*/);p[0].length!=a&&!this.session.$useEmacsStyleLineStart&&(u.column+=p[0].length),this.moveCursorToPosition(u)},n.prototype.moveCursorLineEnd=function(){var o=this.lead,a=this.session.getDocumentLastRowColumnPosition(o.row,o.column);if(this.lead.column==a.column){var l=this.session.getLine(a.row);if(a.column==l.length){var u=l.search(/\s+$/);u>0&&(a.column=u)}}this.moveCursorTo(a.row,a.column)},n.prototype.moveCursorFileEnd=function(){var o=this.doc.getLength()-1,a=this.doc.getLine(o).length;this.moveCursorTo(o,a)},n.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},n.prototype.moveCursorLongWordRight=function(){var o=this.lead.row,a=this.lead.column,l=this.doc.getLine(o),u=l.substring(a);
173this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var h=this.session.getFoldAt(o,a,1);if(h){this.moveCursorTo(h.end.row,h.end.column);return}if(this.session.nonTokenRe.exec(u)&&(a+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,u=l.substring(a)),a>=l.length){this.moveCursorTo(o,l.length),this.moveCursorRight(),o<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(u)&&(a+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(o,a)},n.prototype.moveCursorLongWordLeft=function(){var o=this.lead.row,a=this.lead.column,l;if(l=this.session.getFoldAt(o,a,-1)){this.moveCursorTo(l.start.row,l.start.column);return}var u=this.session.getFoldStringAt(o,a,-1);u==null&&(u=this.doc.getLine(o).substring(0,a));var h=c.stringReverse(u);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(h)&&(a-=this.session.nonTokenRe.lastIndex,h=h.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),a<=0){this.moveCursorTo(o,0),this.moveCursorLeft(),o>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(h)&&(a-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(o,a)},n.prototype.$shortWordEndIndex=function(o){var a=0,l,u=/\s/,h=this.session.tokenRe;if(h.lastIndex=0,this.session.tokenRe.exec(o))a=this.session.tokenRe.lastIndex;else{for(;(l=o[a])&&u.test(l);)a++;if(a<1){for(h.lastIndex=0;(l=o[a])&&!h.test(l);)if(h.lastIndex=0,a++,u.test(l))if(a>2){a--;break}else{for(;(l=o[a])&&u.test(l);)a++;if(a>2)break}}}return h.lastIndex=0,a},n.prototype.moveCursorShortWordRight=function(){var o=this.lead.row,a=this.lead.column,l=this.doc.getLine(o),u=l.substring(a),h=this.session.getFoldAt(o,a,1);if(h)return this.moveCursorTo(h.end.row,h.end.column);if(a==l.length){var p=this.doc.getLength();do o++,u=this.doc.getLine(o);while(o<p&&/^\s*$/.test(u));/^\s+/.test(u)||(u=""),a=0}var g=this.$shortWordEndIndex(u);this.moveCursorTo(o,a+g)},n.prototype.moveCursorShortWordLeft=function(){var o=this.lead.row,a=this.lead.column,l;if(l=this.session.getFoldAt(o,a,-1))return this.moveCursorTo(l.start.row,l.start.column);var u=this.session.getLine(o).substring(0,a);if(a===0){do o--,u=this.doc.getLine(o);while(o>0&&/^\s*$/.test(u));a=u.length,/\s+$/.test(u)||(u="")}var h=c.stringReverse(u),p=this.$shortWordEndIndex(h);return this.moveCursorTo(o,a-p)},n.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},n.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},n.prototype.moveCursorBy=function(o,a){var l=this.session.documentToScreenPosition(this.lead.row,this.lead.column),u;if(a===0&&(o!==0&&(this.session.$bidiHandler.isBidiRow(l.row,this.lead.row)?(u=this.session.$bidiHandler.getPosLeft(l.column),l.column=Math.round(u/this.session.$bidiHandler.charWidths[0])):u=l.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?l.column=this.$desiredColumn:this.$desiredColumn=l.column),o!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var h=this.session.lineWidgets[this.lead.row];o<0?o-=h.rowsAbove||0:o>0&&(o+=h.rowCount-(h.rowsAbove||0))}var p=this.session.screenToDocumentPosition(l.row+o,l.column,u);o!==0&&a===0&&p.row===this.lead.row&&(p.column,this.lead.column),this.moveCursorTo(p.row,p.column+a,a===0)},n.prototype.moveCursorToPosition=function(o){this.moveCursorTo(o.row,o.column)},n.prototype.moveCursorTo=function(o,a,l){var u=this.session.getFoldAt(o,a,1);u&&(o=u.start.row,a=u.start.column),this.$keepDesiredColumnOnChange=!0;var h=this.session.getLine(o);/[\uDC00-\uDFFF]/.test(h.charAt(a))&&h.charAt(a-1)&&(this.lead.row==o&&this.lead.column==a+1?a=a-1:a=a+1),this.lead.setPosition(o,a),this.$keepDesiredColumnOnChange=!1,l||(this.$desiredColumn=null)},n.prototype.moveCursorToScreen=function(o,a,l){var u=this.session.screenToDocumentPosition(o,a);this.moveCursorTo(u.row,u.column,l)},n.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},n.prototype.fromOrientedRange=function(o){this.setSelectionRange(o,o.cursor==o.start),this.$desiredColumn=o.desiredColumn||this.$desiredColumn},n.prototype.toOrientedRange=function(o){var a=this.getRange();return o?(o.start.column=a.start.column,o.start.row=a.start.row,o.end.column=a.end.column,o.end.row=a.end.row):o=a,o.cursor=this.isBackwards()?o.start:o.end,o.desiredColumn=this.$desiredColumn,o},n.prototype.getRangeOfMovements=function(o){var a=this.getCursor();try{o(this);var l=this.getCursor();return i.fromPoints(a,l)}catch{return i.fromPoints(a,a)}finally{this.moveCursorToPosition(a)}},n.prototype.toJSON=function(){if(this.rangeCount)var o=this.ranges.map(function(a){var l=a.clone();return l.isBackwards=a.cursor==a.start,l});else{var o=this.getRange();o.isBackwards=this.isBackwards()}return o}
173,n.prototype.fromJSON=function(o){if(o.start==null)if(this.rangeList&&o.length>1){this.toSingleRange(o[0]);for(var a=o.length;a--;){var l=i.fromPoints(o[a].start,o[a].end);o[a].isBackwards&&(l.cursor=l.start),this.addRange(l,!0)}return}else o=o[0];this.rangeList&&this.toSingleRange(o),this.setSelectionRange(o,o.isBackwards)},n.prototype.isEqual=function(o){if((o.length||this.rangeCount)&&o.length!=this.rangeCount)return!1;if(!o.length||!this.ranges)return this.getRange().isEqual(o);for(var a=this.ranges.length;a--;)if(!this.ranges[a].isEqual(o[a]))return!1;return!0},n}();d.prototype.setSelectionAnchor=d.prototype.setAnchor,d.prototype.getSelectionAnchor=d.prototype.getAnchor,d.prototype.setSelectionRange=d.prototype.setRange,s.implement(d.prototype,f),e.Selection=d});ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(t,e,r){"use strict";var s=t("./lib/report_error").reportError,c=2e3,f=function(){function i(d){this.splitRegex,this.states=d,this.regExps={},this.matchMappings={};for(var n in this.states){for(var o=this.states[n],a=[],l=0,u=this.matchMappings[n]={defaultToken:"text"},h="g",p=[],g=0;g<o.length;g++){var m=o[g];if(m.defaultToken&&(u.defaultToken=m.defaultToken),m.caseInsensitive&&h.indexOf("i")===-1&&(h+="i"),m.unicode&&h.indexOf("u")===-1&&(h+="u"),m.regex!=null){m.regex instanceof RegExp&&(m.regex=m.regex.toString().slice(1,-1));var y=m.regex,b=new RegExp("(?:("+y+")|(.))").exec("a").length-2;Array.isArray(m.token)?m.token.length==1||b==1?m.token=m.token[0]:b-1!=m.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:m,groupCount:b-1}),m.token=m.token[0]):(m.tokenArray=m.token,m.token=null,m.onMatch=this.$arrayTokens):typeof m.token=="function"&&!m.onMatch&&(b>1?m.onMatch=this.$applyToken:m.onMatch=m.token),b>1&&(/\\\d/.test(m.regex)?y=m.regex.replace(/\\([0-9]+)/g,function(C,E){return"\\"+(parseInt(E,10)+l+1)}):(b=1,y=this.removeCapturingGroups(m.regex)),!m.splitRegex&&typeof m.token!="string"&&p.push(m)),u[l]=g,l+=b,a.push(y),m.onMatch||(m.onMatch=null)}}a.length||(u[0]=0,a.push("$")),p.forEach(function(C){C.splitRegex=this.createSplitterRegexp(C.regex,h)},this),this.regExps[n]=new RegExp("("+a.join(")|(")+")|($)",h)}}return i.prototype.$setMaxTokenCount=function(d){c=d|0},i.prototype.$applyToken=function(d){var n=this.splitRegex.exec(d).slice(1),o=this.token.apply(this,n);if(typeof o=="string")return[{type:o,value:d}];for(var a=[],l=0,u=o.length;l<u;l++)n[l]&&(a[a.length]={type:o[l],value:n[l]});return a},i.prototype.$arrayTokens=function(d){if(!d)return[];var n=this.splitRegex.exec(d);if(!n)return"text";for(var o=[],a=this.tokenArray,l=0,u=a.length;l<u;l++)n[l+1]&&(o[o.length]={type:a[l],value:n[l+1]});return o},i.prototype.removeCapturingGroups=function(d){var n=d.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(o,a){return a?"(?:":o});return n},i.prototype.createSplitterRegexp=function(d,n){if(d.indexOf("(?=")!=-1){var o=0,a=!1,l={};d.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(u,h,p,g,m,y){return a?a=m!="]":m?a=!0:g?(o==l.stack&&(l.end=y+1,l.stack=-1),o--):p&&(o++,p.length!=1&&(l.stack=o,l.start=y)),u}),l.end!=null&&/^\)*$/.test(d.substr(l.end))&&(d=d.substring(0,l.start)+d.substr(l.end))}return d.charAt(0)!="^"&&(d="^"+d),d.charAt(d.length-1)!="$"&&(d+="$"),new RegExp(d,(n||"").replace("g",""))},i.prototype.getLineTokens=function(d,n){if(n&&typeof n!="string"){var o=n.slice(0);n=o[0],n==="#tmp"&&(o.shift(),n=o.shift())}else var o=[];var a=n||"start",l=this.states[a];l||(a="start",l=this.states[a]);var u=this.matchMappings[a],h=this.regExps[a];h.lastIndex=0;for(var p,g=[],m=0,y=0,b={type:null,value:""};p=h.exec(d);){var C=u.defaultToken,E=null,w=p[0],k=h.lastIndex;if(k-w.length>m){var I=d.substring(m,k-w.length);b.type==C?b.value+=I:(b.type&&g.push(b),b={type:C,value:I})}for(var L=0;L<p.length-2;L++)if(p[L+1]!==void 0){E=l[u[L]],E.onMatch?C=E.onMatch(w,a,o,d):C=E.token,E.next&&(typeof E.next=="string"?a=E.next:a=E.next(a,o),l=this.states[a],l||(this.reportError("state doesn't exist",a),a="start",l=this.states[a]),u=this.matchMappings[a],m=k,h=this.regExps[a],h.lastIndex=k),E.consumeLineEnd&&(m=k);break}if(w){if(typeof C=="string")(!E||E.merge!==!1)&&b.type===C?b.value+=w:(b.type&&g.push(b),b={type:C,value:w});else if(C){b.type&&g.push(b),b={type:null,value:""};for(var L=0;L<C.length;L++)g.push(C[L])}}if(m==d.length)break;if(m=k,y++>c){for(y>2*d.length&&this.reportError("infinite loop with in ace tokenizer",{startState:n,line:d});m<d.length;)b.type&&g.push(b),b={value:d.substring(m,m+=500),type:"overflow"};a="start",o=[];break}}return b.type&&g.push(b),o.length>1&&o[0]!==a&&o.unshift("#tmp",a),{tokens:g,state:o.length?o:a}},i}();f.prototype.reportError=s,e.Tokenizer=f});ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(t,e,r){"use strict";var s=t("../lib/deep_copy").deepCopy,c;c=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},function(){this.addRules=function(d,n){if(!n){for(var o in d)this.$rules[o]=d[o];return}for(var o in d){for(var a=d[o],l=0;l<a.length;l++){var u=a[l];(u.next||u.onMatch)&&(typeof u.next=="string"&&u.next.indexOf(n)!==0&&(u.next=n+u.next),u.nextState&&u.nextState.indexOf(n)!==0&&(u.nextState=n+u.nextState))}this.$rules[n+o]=a}},this.getRules=function(){return this.$rules},this.embedRules=function(d,n,o,a,l){var u=typeof d=="function"?new d().getRules():d;if(a)for(var h=0;h<a.length;h++)a[h]=n+a[h];else{a=[];for(var p in u)a.push(n+p)}if(this.addRules(u,n),o)for(var g=Array.prototype[l?"push":"unshift"],h=0;h<a.length;h++)g.apply(this.$rules[a[h]],s(o));this.$embeds||(this.$embeds=[]),this.$embeds.push(n)},this.getEmbeds=function(){return this.$embeds};var f=function(d,n){return(d!="start"||n.length)&&n.unshift(this.nextState,d),this.nextState},i=function(d,n){return n.shift(),n.shift()||"start"};this.normalizeRules=function(){var d=0,n=this.$rules;function o(a){var l=n[a];l.processed=!0;for(var u=0;u<l.length;u++){var h=l[u],p=null;Array.isArray(h)&&(p=h,h={}),!h.regex&&h.start&&(h.regex=h.start,h.next||(h.next=[]),h.next.push({defaultToken:h.token},{token:h.token+".end",regex:h.end||h.start,next:"pop"}),h.token=h.token+".start",h.push=!0);var g=h.next||h.push;if(g&&Array.isArray(g)){var m=h.stateName;m||(m=h.token,typeof m!="string"&&(m=m[0]||""),n[m]&&(m+=d++)),n[m]=g,h.next=m,o(m)}else g=="pop"&&(h.next=i);if(h.push&&(h.nextState=h.next||h.push,h.next=f,delete h.push),h.rules)for(var y in h.rules)n[y]?n[y].push&&n[y].push.apply(n[y],h.rules[y]):n[y]=h.rules[y];var b=typeof h=="string"?h:h.include;if(b&&(b==="$self"&&(b="start"),Array.isArray(b)?p=b.map(function(E){return n[E]}):p=n[b]),p){var C=[u,1].concat(p);h.noEscape&&(C=C.filter(function(E){return!E.next})),l.splice.apply(l,C),u--}h.keywordMap&&(h.token=this.createKeywordMapper(h.keywordMap,h.defaultToken||"text",h.caseInsensitive),delete h.defaultToken)}}
173Object.keys(n).forEach(o,this)},this.createKeywordMapper=function(d,n,o,a){var l=Object.create(null);return this.$keywordList=[],Object.keys(d).forEach(function(u){for(var h=d[u],p=h.split(a||"|"),g=p.length;g--;){var m=p[g];this.$keywordList.push(m),o&&(m=m.toLowerCase()),l[m]=u}},this),d=null,o?function(u){return l[u.toLowerCase()]||n}:function(u){return l[u]||n}},this.getKeywords=function(){return this.$keywords}}.call(c.prototype),e.TextHighlightRules=c});ace.define("ace/mode/behaviour",["require","exports","module"],function(t,e,r){"use strict";var s;s=function(){this.$behaviours={}},function(){this.add=function(c,f,i){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[c]:this.$behaviours[c]={}}this.$behaviours[c][f]=i},this.addBehaviours=function(c){for(var f in c)for(var i in c[f])this.add(f,i,c[f][i])},this.remove=function(c){this.$behaviours&&this.$behaviours[c]&&delete this.$behaviours[c]},this.inherit=function(c,f){if(typeof c=="function")var i=new c().getBehaviours(f);else var i=c.getBehaviours(f);this.addBehaviours(i)},this.getBehaviours=function(c){if(c){for(var f={},i=0;i<c.length;i++)this.$behaviours[c[i]]&&(f[c[i]]=this.$behaviours[c[i]]);return f}else return this.$behaviours}}.call(s.prototype),e.Behaviour=s});ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=t("./range").Range,c=function(){function f(i,d,n){this.$session=i,this.$row=d,this.$rowTokens=i.getTokens(d);var o=i.getTokenAt(d,n);this.$tokenIndex=o?o.index:-1}return f.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},f.prototype.stepForward=function(){this.$tokenIndex+=1;for(var i;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,i||(i=this.$session.getLength()),this.$row>=i)return this.$row=i-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},f.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},f.prototype.getCurrentTokenRow=function(){return this.$row},f.prototype.getCurrentTokenColumn=function(){var i=this.$rowTokens,d=this.$tokenIndex,n=i[d].start;if(n!==void 0)return n;for(n=0;d>0;)d-=1,n+=i[d].value.length;return n},f.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},f.prototype.getCurrentTokenRange=function(){var i=this.$rowTokens[this.$tokenIndex],d=this.getCurrentTokenColumn();return new s(this.$row,d,this.$row,d+i.value.length)},f}();e.TokenIterator=c});ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../behaviour").Behaviour,f=t("../../token_iterator").TokenIterator,i=t("../../lib/lang"),d=["text","paren.rparen","rparen","paren","punctuation.operator"],n=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],o,a={},l={'"':'"',"'":"'"},u=function(g){var m=-1;if(g.multiSelect&&(m=g.selection.index,a.rangeCount!=g.multiSelect.rangeCount&&(a={rangeCount:g.multiSelect.rangeCount})),a[m])return o=a[m];o=a[m]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(g,m,y,b){var C=g.end.row-g.start.row;return{text:y+m+b,selection:[0,g.start.column+1,C,g.end.column+(C?0:1)]}},p;p=function(g){g=g||{},this.add("braces","insertion",function(m,y,b,C,E){var w=b.getCursorPosition(),k=C.doc.getLine(w.row);if(E=="{"){u(b);var I=b.getSelectionRange(),L=C.doc.getTextRange(I),F=C.getTokenAt(w.row,w.column);if(L!==""&&L!=="{"&&b.getWrapBehavioursEnabled())return h(I,L,"{","}");if(F&&/(?:string)\.quasi|\.xml/.test(F.type)){var R=[/tag\-(?:open|name)/,/attribute\-name/];return R.some(function(P){return P.test(F.type)})||/(string)\.quasi/.test(F.type)&&F.value[w.column-F.start-1]!=="$"?void 0:(p.recordAutoInsert(b,C,"}"),{text:"{}",selection:[1,1]})}else if(p.isSaneInsertion(b,C))return/[\]\}\)]/.test(k[w.column])||b.inMultiSelectMode||g.braces?(p.recordAutoInsert(b,C,"}"),{text:"{}",selection:[1,1]}):(p.recordMaybeInsert(b,C,"{"),{text:"{",selection:[1,1]})}else if(E=="}"){u(b);var M=k.substring(w.column,w.column+1);if(M=="}"){var A=C.$findOpeningBracket("}",{column:w.column+1,row:w.row});if(A!==null&&p.isAutoInsertedClosing(w,k,E))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(E==`
174`||E==`\r
175`){u(b);var _="";p.isMaybeInsertedClosing(w,k)&&(_=i.stringRepeat("}",o.maybeInsertedBrackets),p.clearMaybeInsertedClosing());var M=k.substring(w.column,w.column+1);if(M==="}"){var O=C.findMatchingBracket({row:w.row,column:w.column+1},"}");if(!O)return null;var D=this.$getIndent(C.getLine(O.row))}else if(_)var D=this.$getIndent(k);else{p.clearMaybeInsertedClosing();return}var B=D+C.getTabString();return{text:`
176`+B+`
177`+D+_,selection:[1,B.length,1,B.length]}}else p.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(m,y,b,C,E){var w=C.doc.getTextRange(E);
177if(!E.isMultiLine()&&w=="{"){u(b);var k=C.doc.getLine(E.start.row),I=k.substring(E.end.column,E.end.column+1);if(I=="}")return E.end.column++,E;o.maybeInsertedBrackets--}}),this.add("parens","insertion",function(m,y,b,C,E){if(E=="("){u(b);var w=b.getSelectionRange(),k=C.doc.getTextRange(w);if(k!==""&&b.getWrapBehavioursEnabled())return h(w,k,"(",")");if(p.isSaneInsertion(b,C))return p.recordAutoInsert(b,C,")"),{text:"()",selection:[1,1]}}else if(E==")"){u(b);var I=b.getCursorPosition(),L=C.doc.getLine(I.row),F=L.substring(I.column,I.column+1);if(F==")"){var R=C.$findOpeningBracket(")",{column:I.column+1,row:I.row});if(R!==null&&p.isAutoInsertedClosing(I,L,E))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(m,y,b,C,E){var w=C.doc.getTextRange(E);if(!E.isMultiLine()&&w=="("){u(b);var k=C.doc.getLine(E.start.row),I=k.substring(E.start.column+1,E.start.column+2);if(I==")")return E.end.column++,E}}),this.add("brackets","insertion",function(m,y,b,C,E){if(E=="["){u(b);var w=b.getSelectionRange(),k=C.doc.getTextRange(w);if(k!==""&&b.getWrapBehavioursEnabled())return h(w,k,"[","]");if(p.isSaneInsertion(b,C))return p.recordAutoInsert(b,C,"]"),{text:"[]",selection:[1,1]}}else if(E=="]"){u(b);var I=b.getCursorPosition(),L=C.doc.getLine(I.row),F=L.substring(I.column,I.column+1);if(F=="]"){var R=C.$findOpeningBracket("]",{column:I.column+1,row:I.row});if(R!==null&&p.isAutoInsertedClosing(I,L,E))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(m,y,b,C,E){var w=C.doc.getTextRange(E);if(!E.isMultiLine()&&w=="["){u(b);var k=C.doc.getLine(E.start.row),I=k.substring(E.start.column+1,E.start.column+2);if(I=="]")return E.end.column++,E}}),this.add("string_dquotes","insertion",function(m,y,b,C,E){var w=C.$mode.$quotes||l;if(E.length==1&&w[E]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(E)!=-1)return;u(b);var k=E,I=b.getSelectionRange(),L=C.doc.getTextRange(I);if(L!==""&&(L.length!=1||!w[L])&&b.getWrapBehavioursEnabled())return h(I,L,k,k);if(!L){var F=b.getCursorPosition(),R=C.doc.getLine(F.row),M=R.substring(F.column-1,F.column),A=R.substring(F.column,F.column+1),_=C.getTokenAt(F.row,F.column),O=C.getTokenAt(F.row,F.column+1);if(M=="\\"&&_&&/escape/.test(_.type))return null;var D=_&&/string|escape/.test(_.type),B=!O||/string|escape/.test(O.type),P;if(A==k)P=D!==B,P&&/string\.end/.test(O.type)&&(P=!1);else{if(D&&!B||D&&B)return null;var H=C.$mode.tokenRe;H.lastIndex=0;var W=H.test(M);H.lastIndex=0;var K=H.test(A),G=C.$mode.$pairQuotesAfter,X=G&&G[k]&&G[k].test(M);if(!X&&W||K||A&&!/[\s;,.})\]\\]/.test(A))return null;var Z=R[F.column-2];if(M==k&&(Z==k||H.test(Z)))return null;P=!0}return{text:P?k+k:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(m,y,b,C,E){var w=C.$mode.$quotes||l,k=C.doc.getTextRange(E);if(!E.isMultiLine()&&w.hasOwnProperty(k)){u(b);var I=C.doc.getLine(E.start.row),L=I.substring(E.start.column+1,E.start.column+2);if(L==k)return E.end.column++,E}}),g.closeDocComment!==!1&&this.add("doc comment end","insertion",function(m,y,b,C,E){if(m==="doc-start"&&(E===`
178`||E===`\r
179`)&&b.selection.isEmpty()){var w=b.getCursorPosition();if(w.column===0)return;for(var k=C.doc.getLine(w.row),I=C.doc.getLine(w.row+1),L=C.getTokens(w.row),F=0,R=0;R<L.length;R++){F+=L[R].value.length;var M=L[R];if(F>=w.column){if(F===w.column){if(!/\.doc/.test(M.type))return;if(/\*\//.test(M.value)){var A=L[R+1];if(!A||!/\.doc/.test(A.type))return}}var _=w.column-(F-M.value.length),O=M.value.indexOf("*/"),D=M.value.indexOf("/**",O>-1?O+2:0);if(D!==-1&&_>D&&_<D+3||O!==-1&&D!==-1&&_>=O&&_<=D||!/\.doc/.test(M.type))return;break}}var B=this.$getIndent(k);if(/\s*\*/.test(I))return/^\s*\*/.test(k)?{text:E+B+"* ",selection:[1,2+B.length,1,2+B.length]}:{text:E+B+" * ",selection:[1,3+B.length,1,3+B.length]};if(/\/\*\*/.test(k.substring(0,w.column)))return{text:E+B+" * "+E+" "+B+"*/",selection:[1,4+B.length,1,4+B.length]}}})},p.isSaneInsertion=function(g,m){var y=g.getCursorPosition(),b=new f(m,y.row,y.column);if(!this.$matchTokenType(b.getCurrentToken()||"text",d)){if(/[)}\]]/.test(g.session.getLine(y.row)[y.column]))return!0;var C=new f(m,y.row,y.column+1);if(!this.$matchTokenType(C.getCurrentToken()||"text",d))return!1}return b.stepForward(),b.getCurrentTokenRow()!==y.row||this.$matchTokenType(b.getCurrentToken()||"text",n)},p.$matchTokenType=function(g,m){return m.indexOf(g.type||g)>-1},p.recordAutoInsert=function(g,m,y){var b=g.getCursorPosition(),C=m.doc.getLine(b.row);
179this.isAutoInsertedClosing(b,C,o.autoInsertedLineEnd[0])||(o.autoInsertedBrackets=0),o.autoInsertedRow=b.row,o.autoInsertedLineEnd=y+C.substr(b.column),o.autoInsertedBrackets++},p.recordMaybeInsert=function(g,m,y){var b=g.getCursorPosition(),C=m.doc.getLine(b.row);this.isMaybeInsertedClosing(b,C)||(o.maybeInsertedBrackets=0),o.maybeInsertedRow=b.row,o.maybeInsertedLineStart=C.substr(0,b.column)+y,o.maybeInsertedLineEnd=C.substr(b.column),o.maybeInsertedBrackets++},p.isAutoInsertedClosing=function(g,m,y){return o.autoInsertedBrackets>0&&g.row===o.autoInsertedRow&&y===o.autoInsertedLineEnd[0]&&m.substr(g.column)===o.autoInsertedLineEnd},p.isMaybeInsertedClosing=function(g,m){return o.maybeInsertedBrackets>0&&g.row===o.maybeInsertedRow&&m.substr(g.column)===o.maybeInsertedLineEnd&&m.substr(0,g.column)==o.maybeInsertedLineStart},p.popAutoInsertedClosing=function(){o.autoInsertedLineEnd=o.autoInsertedLineEnd.substr(1),o.autoInsertedBrackets--},p.clearMaybeInsertedClosing=function(){o&&(o.maybeInsertedBrackets=0,o.maybeInsertedRow=-1)},s.inherits(p,c),e.CstyleBehaviour=p});ace.define("ace/unicode",["require","exports","module"],function(t,e,r){"use strict";for(var s=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],c=0,f=[],i=0;i<s.length;i+=2)f.push(c+=s[i]),s[i+1]&&f.push(45,c+=s[i+1]);e.wordChars=String.fromCharCode.apply(null,f)});ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(t,e,r){"use strict";var s=t("../config"),c=t("../tokenizer").Tokenizer,f=t("./text_highlight_rules").TextHighlightRules,i=t("./behaviour/cstyle").CstyleBehaviour,d=t("../unicode"),n=t("../lib/lang"),o=t("../token_iterator").TokenIterator,a=t("../range").Range,l;l=function(){this.HighlightRules=f},function(){this.$defaultBehaviour=new i,this.tokenRe=new RegExp("^["+d.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+d.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new c(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(u,h,p,g){var m=h.doc,y=!0,b=!0,C=1/0,E=h.getTabSize(),w=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var L=this.lineCommentStart.map(n.escapeRegExp).join("|"),k=this.lineCommentStart[0];else var L=n.escapeRegExp(this.lineCommentStart),k=this.lineCommentStart;L=new RegExp("^(\\s*)(?:"+L+") ?"),w=h.getUseSoftTabs();var M=function(K,G){var X=K.match(L);if(X){var Z=X[1].length,q=X[0].length;!O(K,Z,q)&&X[0][q-1]==" "&&q--,m.removeInLine(G,Z,q)}},_=k+" ",R=function(K,G){(!y||/\S/.test(K))&&(O(K,C,C)?m.insertInLine({row:G,column:C},_):m.insertInLine({row:G,column:C},k))},A=function(K,G){return L.test(K)},O=function(K,G,X){for(var Z=0;G--&&K.charAt(G)==" ";)Z++;if(Z%E!=0)return!1;for(var Z=0;K.charAt(X++)==" ";)Z++;return E>2?Z%E!=E-1:Z%E==0}}else{if(!this.blockComment)return!1;var k=this.blockComment.start,I=this.blockComment.end,L=new RegExp("^(\\s*)(?:"+n.escapeRegExp(k)+")"),F=new RegExp("(?:"+n.escapeRegExp(I)+")\\s*$"),R=function(P,H){A(P,H)||(!y||/\S/.test(P))&&(m.insertInLine({row:H,column:P.length},I),m.insertInLine({row:H,column:C},k))},M=function(P,H){var W;(W=P.match(F))&&m.removeInLine(H,P.length-W[0].length,P.length),(W=P.match(L))&&m.removeInLine(H,W[1].length,W[0].length)},A=function(P,H){if(L.test(P))return!0;for(var W=h.getTokens(H),K=0;K<W.length;K++)if(W[K].type==="comment")return!0}}function D(P){for(var H=p;H<=g;H++)P(m.getLine(H),H)}var B=1/0;D(function(P,H){var W=P.search(/\S/);W!==-1?(W<C&&(C=W),b&&!A(P,H)&&(b=!1)):B>P.length&&(B=P.length)}),C==1/0&&(C=B,y=!1,b=!1),w&&C%E!=0&&(C=Math.floor(C/E)*E),D(b?M:R)},this.toggleBlockComment=function(u,h,p,g){var m=this.blockComment;if(m){!m.start&&m[0]&&(m=m[0]);var y=new o(h,g.row,g.column),b=y.getCurrentToken(),C=h.selection,E=h.selection.toOrientedRange(),w,k;if(b&&/comment/.test(b.type)){for(var I,L;b&&/comment/.test(b.type);){var F=b.value.indexOf(m.start);if(F!=-1){var R=y.getCurrentTokenRow(),M=y.getCurrentTokenColumn()+F;I=new a(R,M,R,M+m.start.length);break}b=y.stepBackward()}for(var y=new o(h,g.row,g.column),b=y.getCurrentToken();b&&/comment/.test(b.type);){var F=b.value.indexOf(m.end);if(F!=-1){var R=y.getCurrentTokenRow(),M=y.getCurrentTokenColumn()+F;L=new a(R,M,R,M+m.end.length);break}b=y.stepForward()}L&&h.remove(L),I&&(h.remove(I),w=I.start.row,k=-m.start.length)}else k=m.start.length,w=p.start.row,h.insert(p.end,m.end),h.insert(p.start,m.start);E.start.row==w&&(E.start.column+=k),E.end.row==w&&(E.end.column+=k),h.selection.fromOrientedRange(E)}},this.getNextLineIndent=function(u,h,p){return this.$getIndent(h)},this.checkOutdent=function(u,h,p){return!1},this.autoOutdent=function(u,h,p){},this.$getIndent=function(u){return u.match(/^\s*/)[0]},this.createWorker=function(u){return null},this.createModeDelegates=function(u){this.$embeds=[],this.$modes={};for(var h in u)if(u[h]){var p=u[h],g=p.prototype.$id,m=s.$modes[g];m||(s.$modes[g]=m=new p),s.$modes[h]||(s.$modes[h]=m),this.$embeds.push(h),this.$modes[h]=m}for(var y=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],b=function(E){(function(w){var k=y[E],I=w[k];w[y[E]]=function(){return this.$delegator(k,arguments,I)}})(C)},C=this,h=0;h<y.length;h++)b(h)},this.$delegator=function(u,h,p){var g=h[0]||"start";if(typeof g!="string"){if(Array.isArray(g[2])){var m=g[2][g[2].length-1],y=this.$modes[m];if(y)return y[u].apply(y,[g[1]].concat([].slice.call(h,1)))}g=g[0]||"start"}for(var b=0;b<this.$embeds.length;b++)if(this.$modes[this.$embeds[b]]){var C=g.split(this.$embeds[b]);if(!C[0]&&C[1]){h[0]=C[1];var y=this.$modes[this.$embeds[b]];return y[u].apply(y,h)}}var E=p.apply(this,h);return p?E:void 0},this.transformAction=function(u,h,p,g,m){if(this.$behaviour){var y=this.$behaviour.getBehaviours();for(var b in y)if(y[b][h]){var C=y[b][h].apply(this,arguments);if(C)return C}}},this.getKeywords=function(u){if(!this.completionKeywords){var h=this.$tokenizer.rules,p=[];for(var g in h)for(var m=h[g],y=0,b=m.length;y<b;y++)if(typeof m[y].token=="string")/keyword|support|storage/.test(m[y].token)&&p.push(m[y].regex);else if(typeof m[y].token=="object"){for(var C=0,E=m[y].token.length;C<E;C++)if(/keyword|support|storage/.test(m[y].token[C])){var g=m[y].regex.match(/\(.+?\)/g)[C];p.push(g.substr(1,g.length-2))}}this.completionKeywords=p}return u?p.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(u,h,p,g){var m=this.$keywordList||this.$createKeywordList();return m.map(function(y){return{name:y,value:y,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}.call(l.prototype),e.Mode=l});ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(t,e,r){"use strict";var s=t("./lib/dom"),c=function(){function f(i){this.session=i,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return f.prototype.getRowLength=function(i){var d;return this.lineWidgets?d=this.lineWidgets[i]&&this.lineWidgets[i].rowCount||0:d=0,!this.$useWrapMode||!this.$wrapData[i]?1+d:this.$wrapData[i].length+1+d}
179,f.prototype.$getWidgetScreenLength=function(){var i=0;return this.lineWidgets.forEach(function(d){d&&d.rowCount&&!d.hidden&&(i+=d.rowCount)}),i},f.prototype.$onChangeEditor=function(i){this.attach(i.editor)},f.prototype.attach=function(i){i&&i.widgetManager&&i.widgetManager!=this&&i.widgetManager.detach(),this.editor!=i&&(this.detach(),this.editor=i,i&&(i.widgetManager=this,i.renderer.on("beforeRender",this.measureWidgets),i.renderer.on("afterRender",this.renderWidgets)))},f.prototype.detach=function(i){var d=this.editor;if(d){this.editor=null,d.widgetManager=null,d.renderer.off("beforeRender",this.measureWidgets),d.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(o){o&&o.el&&o.el.parentNode&&(o._inDocument=!1,o.el.parentNode.removeChild(o.el))})}},f.prototype.updateOnFold=function(i,d){var n=d.lineWidgets;if(!(!n||!i.action)){for(var o=i.data,a=o.start.row,l=o.end.row,u=i.action=="add",h=a+1;h<l;h++)n[h]&&(n[h].hidden=u);n[l]&&(u?n[a]?n[l].hidden=u:n[a]=n[l]:(n[a]==n[l]&&(n[a]=void 0),n[l].hidden=u))}},f.prototype.updateOnChange=function(i){var d=this.session.lineWidgets;if(d){var n=i.start.row,o=i.end.row-n;if(o!==0)if(i.action=="remove"){var a=d.splice(n+1,o);!d[n]&&a[a.length-1]&&(d[n]=a.pop()),a.forEach(function(u){u&&this.removeLineWidget(u)},this),this.$updateRows()}else{var l=new Array(o);d[n]&&d[n].column!=null&&i.start.column>d[n].column&&n++,l.unshift(n,0),d.splice.apply(d,l),this.$updateRows()}}},f.prototype.$updateRows=function(){var i=this.session.lineWidgets;if(i){var d=!0;i.forEach(function(n,o){if(n)for(d=!1,n.row=o;n.$oldWidget;)n.$oldWidget.row=o,n=n.$oldWidget}),d&&(this.session.lineWidgets=null)}},f.prototype.$registerLineWidget=function(i){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var d=this.session.lineWidgets[i.row];return d&&(i.$oldWidget=d,d.el&&d.el.parentNode&&(d.el.parentNode.removeChild(d.el),d._inDocument=!1)),this.session.lineWidgets[i.row]=i,i},f.prototype.addLineWidget=function(i){if(this.$registerLineWidget(i),i.session=this.session,!this.editor)return i;var d=this.editor.renderer;i.html&&!i.el&&(i.el=s.createElement("div"),i.el.innerHTML=i.html),i.text&&!i.el&&(i.el=s.createElement("div"),i.el.textContent=i.text),i.el&&(s.addCssClass(i.el,"ace_lineWidgetContainer"),i.className&&s.addCssClass(i.el,i.className),i.el.style.position="absolute",i.el.style.zIndex="5",d.container.appendChild(i.el),i._inDocument=!0,i.coverGutter||(i.el.style.zIndex="3"),i.pixelHeight==null&&(i.pixelHeight=i.el.offsetHeight)),i.rowCount==null&&(i.rowCount=i.pixelHeight/d.layerConfig.lineHeight);var n=this.session.getFoldAt(i.row,0);if(i.$fold=n,n){var o=this.session.lineWidgets;i.row==n.end.row&&!o[n.start.row]?o[n.start.row]=i:i.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:i.row}}}),this.$updateRows(),this.renderWidgets(null,d),this.onWidgetChanged(i),i},f.prototype.removeLineWidget=function(i){if(i._inDocument=!1,i.session=null,i.el&&i.el.parentNode&&i.el.parentNode.removeChild(i.el),i.editor&&i.editor.destroy)try{i.editor.destroy()}catch{}if(this.session.lineWidgets){var d=this.session.lineWidgets[i.row];if(d==i)this.session.lineWidgets[i.row]=i.$oldWidget,i.$oldWidget&&this.onWidgetChanged(i.$oldWidget);else for(;d;){if(d.$oldWidget==i){d.$oldWidget=i.$oldWidget;break}d=d.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:i.row}}}),this.$updateRows()},f.prototype.getWidgetsAtRow=function(i){for(var d=this.session.lineWidgets,n=d&&d[i],o=[];n;)o.push(n),n=n.$oldWidget;return o},f.prototype.onWidgetChanged=function(i){this.session._changedWidgets.push(i),this.editor&&this.editor.renderer.updateFull()},f.prototype.measureWidgets=function(i,d){var n=this.session._changedWidgets,o=d.layerConfig;if(!(!n||!n.length)){for(var a=1/0,l=0;l<n.length;l++){var u=n[l];if(!(!u||!u.el)&&u.session==this.session){if(!u._inDocument){if(this.session.lineWidgets[u.row]!=u)continue;u._inDocument=!0,d.container.appendChild(u.el)}u.h=u.el.offsetHeight,u.fixedWidth||(u.w=u.el.offsetWidth,u.screenWidth=Math.ceil(u.w/o.characterWidth));var h=u.h/o.lineHeight;u.coverLine&&(h-=this.session.getRowLineCount(u.row),h<0&&(h=0)),u.rowCount!=h&&(u.rowCount=h,u.row<a&&(a=u.row))}}a!=1/0&&(this.session._emit("changeFold",{data:{start:{row:a}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},f.prototype.renderWidgets=function(i,d){var n=d.layerConfig,o=this.session.lineWidgets;if(o){for(var a=Math.min(this.firstRow,n.firstRow),l=Math.max(this.lastRow,n.lastRow,o.length);a>0&&!o[a];)a--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,d.$cursorLayer.config=n;for(var u=a;u<=l;u++){var h=o[u];if(!(!h||!h.el)){if(h.hidden){h.el.style.top=-100-(h.pixelHeight||0)+"px";continue}h._inDocument||(h._inDocument=!0,d.container.appendChild(h.el));var p=d.$cursorLayer.getPixelPosition({row:u,column:0},!0).top;h.coverLine||(p+=n.lineHeight*this.session.getRowLineCount(h.row)),h.el.style.top=p-n.offset+"px";var g=h.coverGutter?0:d.gutterWidth;h.fixedWidth||(g-=d.scrollLeft),h.el.style.left=g+"px",h.fullWidth&&h.screenWidth&&(h.el.style.minWidth=n.width+2*n.padding+"px"),h.fixedWidth?h.el.style.right=d.scrollBar.getWidth()+"px":h.el.style.right=""}}}},f}();e.LineWidgets=c});ace.define("ace/apply_delta",["require","exports","module"],function(t,e,r){"use strict";function s(i,d){throw console.log("Invalid Delta:",i),"Invalid Delta: "+d}function c(i,d){return d.row>=0&&d.row<i.length&&d.column>=0&&d.column<=i[d.row].length}function f(i,d){d.action!="insert"&&d.action!="remove"&&s(d,"delta.action must be 'insert' or 'remove'"),d.lines instanceof Array||s(d,"delta.lines must be an Array"),(!d.start||!d.end)&&s(d,"delta.start/end must be an present");var n=d.start;c(i,d.start)||s(d,"delta.start must be contained in document");var o=d.end;d.action=="remove"&&!c(i,o)&&s(d,"delta.end must contained in document for 'remove' actions");var a=o.row-n.row,l=o.column-(a==0?n.column:0);(a!=d.lines.length-1||d.lines[a].length!=l)&&s(d,"delta.range must match delta lines")}e.applyDelta=function(i,d,n){var o=d.start.row,a=d.start.column,l=i[o]||"";switch(d.action){case"insert":var u=d.lines;if(u.length===1)i[o]=l.substring(0,a)+d.lines[0]+l.substring(a);else{var h=[o,1].concat(d.lines);i.splice.apply(i,h),i[o]=l.substring(0,a)+i[o],i[o+d.lines.length-1]+=l.substring(a)}break;case"remove":var p=d.end.column,g=d.end.row;o===g?i[o]=l.substring(0,a)+l.substring(p):i.splice(o,g-o+1,l.substring(0,a)+i[g].substring(p));break}}});ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./lib/event_emitter").EventEmitter,f=function(){function n(o,a,l){this.$onChange=this.onChange.bind(this),this.attach(o),typeof a!="number"?this.setPosition(a.row,a.column):this.setPosition(a,l)}return n.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},n.prototype.getDocument=function(){return this.document}
179,n.prototype.onChange=function(o){if(!(o.start.row==o.end.row&&o.start.row!=this.row)&&!(o.start.row>this.row)){var a=d(o,{row:this.row,column:this.column},this.$insertRight);this.setPosition(a.row,a.column,!0)}},n.prototype.setPosition=function(o,a,l){var u;if(l?u={row:o,column:a}:u=this.$clipPositionToDocument(o,a),!(this.row==u.row&&this.column==u.column)){var h={row:this.row,column:this.column};this.row=u.row,this.column=u.column,this._signal("change",{old:h,value:u})}},n.prototype.detach=function(){this.document.off("change",this.$onChange)},n.prototype.attach=function(o){this.document=o||this.document,this.document.on("change",this.$onChange)},n.prototype.$clipPositionToDocument=function(o,a){var l={};return o>=this.document.getLength()?(l.row=Math.max(0,this.document.getLength()-1),l.column=this.document.getLine(l.row).length):o<0?(l.row=0,l.column=0):(l.row=o,l.column=Math.min(this.document.getLine(l.row).length,Math.max(0,a))),a<0&&(l.column=0),l},n}();f.prototype.$insertRight=!1,s.implement(f.prototype,c);function i(n,o,a){var l=a?n.column<=o.column:n.column<o.column;return n.row<o.row||n.row==o.row&&l}function d(n,o,a){var l=n.action=="insert",u=(l?1:-1)*(n.end.row-n.start.row),h=(l?1:-1)*(n.end.column-n.start.column),p=n.start,g=l?p:n.end;return i(o,p,a)?{row:o.row,column:o.column}:i(g,o,!a)?{row:o.row+u,column:o.column+(o.row==g.row?h:0)}:{row:p.row,column:p.column}}e.Anchor=f});ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./apply_delta").applyDelta,f=t("./lib/event_emitter").EventEmitter,i=t("./range").Range,d=t("./anchor").Anchor,n=function(){function o(a){this.$lines=[""],a.length===0?this.$lines=[""]:Array.isArray(a)?this.insertMergedLines({row:0,column:0},a):this.insert({row:0,column:0},a)}return o.prototype.setValue=function(a){var l=this.getLength()-1;this.remove(new i(0,0,l,this.getLine(l).length)),this.insert({row:0,column:0},a||"")},o.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},o.prototype.createAnchor=function(a,l){return new d(this,a,l)},o.prototype.$detectNewLine=function(a){var l=a.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=l?l[1]:`
180`,this._signal("changeNewLineMode")},o.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
181`;case"unix":return`
182`;default:return this.$autoNewLine||`
183`}},o.prototype.setNewLineMode=function(a){this.$newLineMode!==a&&(this.$newLineMode=a,this._signal("changeNewLineMode"))},o.prototype.getNewLineMode=function(){return this.$newLineMode},o.prototype.isNewLine=function(a){return a==`\r
184`||a=="\r"||a==`
185`},o.prototype.getLine=function(a){return this.$lines[a]||""},o.prototype.getLines=function(a,l){return this.$lines.slice(a,l+1)},o.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},o.prototype.getLength=function(){return this.$lines.length},o.prototype.getTextRange=function(a){return this.getLinesForRange(a).join(this.getNewLineCharacter())},o.prototype.getLinesForRange=function(a){var l;if(a.start.row===a.end.row)l=[this.getLine(a.start.row).substring(a.start.column,a.end.column)];else{l=this.getLines(a.start.row,a.end.row),l[0]=(l[0]||"").substring(a.start.column);var u=l.length-1;a.end.row-a.start.row==u&&(l[u]=l[u].substring(0,a.end.column))}return l},o.prototype.insertLines=function(a,l){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(a,l)},o.prototype.removeLines=function(a,l){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(a,l)},o.prototype.insertNewLine=function(a){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(a,["",""])},o.prototype.insert=function(a,l){return this.getLength()<=1&&this.$detectNewLine(l),this.insertMergedLines(a,this.$split(l))},o.prototype.insertInLine=function(a,l){var u=this.clippedPos(a.row,a.column),h=this.pos(a.row,a.column+l.length);return this.applyDelta({start:u,end:h,action:"insert",lines:[l]},!0),this.clonePos(h)},o.prototype.clippedPos=function(a,l){var u=this.getLength();a===void 0?a=u:a<0?a=0:a>=u&&(a=u-1,l=void 0);var h=this.getLine(a);return l==null&&(l=h.length),l=Math.min(Math.max(l,0),h.length),{row:a,column:l}},o.prototype.clonePos=function(a){return{row:a.row,column:a.column}},o.prototype.pos=function(a,l){return{row:a,column:l}},o.prototype.$clipPosition=function(a){var l=this.getLength();return a.row>=l?(a.row=Math.max(0,l-1),a.column=this.getLine(l-1).length):(a.row=Math.max(0,a.row),a.column=Math.min(Math.max(a.column,0),this.getLine(a.row).length)),a},o.prototype.insertFullLines=function(a,l){a=Math.min(Math.max(a,0),this.getLength());var u=0;a<this.getLength()?(l=l.concat([""]),u=0):(l=[""].concat(l),a--,u=this.$lines[a].length),this.insertMergedLines({row:a,column:u},l)},o.prototype.insertMergedLines=function(a,l){var u=this.clippedPos(a.row,a.column),h={row:u.row+l.length-1,column:(l.length==1?u.column:0)+l[l.length-1].length};return this.applyDelta({start:u,end:h,action:"insert",lines:l}),this.clonePos(h)},o.prototype.remove=function(a){var l=this.clippedPos(a.start.row,a.start.column),u=this.clippedPos(a.end.row,a.end.column);return this.applyDelta({start:l,end:u,action:"remove",lines:this.getLinesForRange({start:l,end:u})}),this.clonePos(l)},o.prototype.removeInLine=function(a,l,u){var h=this.clippedPos(a,l),p=this.clippedPos(a,u);return this.applyDelta({start:h,end:p,action:"remove",lines:this.getLinesForRange({start:h,end:p})},!0),this.clonePos(h)},o.prototype.removeFullLines=function(a,l){a=Math.min(Math.max(0,a),this.getLength()-1),l=Math.min(Math.max(0,l),this.getLength()-1);var u=l==this.getLength()-1&&a>0,h=l<this.getLength()-1,p=u?a-1:a,g=u?this.getLine(p).length:0,m=h?l+1:l,y=h?0:this.getLine(m).length,b=new i(p,g,m,y),C=this.$lines.slice(a,l+1);return this.applyDelta({start:b.start,end:b.end,action:"remove",lines:this.getLinesForRange(b)}),C},o.prototype.removeNewLine=function(a){a<this.getLength()-1&&a>=0&&this.applyDelta({start:this.pos(a,this.getLine(a).length),end:this.pos(a+1,0),action:"remove",lines:["",""]})},o.prototype.replace=function(a,l){if(a instanceof i||(a=i.fromPoints(a.start,a.end)),l.length===0&&a.isEmpty())return a.start;if(l==this.getTextRange(a))return a.end;this.remove(a);var u;return l?u=this.insert(a.start,l):u=a.start,u},o.prototype.applyDeltas=function(a){for(var l=0;l<a.length;l++)this.applyDelta(a[l])},o.prototype.revertDeltas=function(a){for(var l=a.length-1;l>=0;l--)this.revertDelta(a[l])},o.prototype.applyDelta=function(a,l){var u=a.action=="insert";(u?a.lines.length<=1&&!a.lines[0]:!i.comparePoints(a.start,a.end))||(u&&a.lines.length>2e4?this.$splitAndapplyLargeDelta(a,2e4):(c(this.$lines,a,l),this._signal("change",a)))},o.prototype.$safeApplyDelta=function(a){var l=this.$lines.length;(a.action=="remove"&&a.start.row<l&&a.end.row<l||a.action=="insert"&&a.start.row<=l)&&this.applyDelta(a)},o.prototype.$splitAndapplyLargeDelta=function(a,l){for(var u=a.lines,h=u.length-l+1,p=a.start.row,g=a.start.column,m=0,y=0;m<h;m=y){y+=l-1;var b=u.slice(m,y);b.push(""),this.applyDelta({start:this.pos(p+m,g),end:this.pos(p+y,g=0),action:a.action,lines:b},!0)}
185a.lines=u.slice(m),a.start.row=p+m,a.start.column=g,this.applyDelta(a,!0)},o.prototype.revertDelta=function(a){this.$safeApplyDelta({start:this.clonePos(a.start),end:this.clonePos(a.end),action:a.action=="insert"?"remove":"insert",lines:a.lines.slice()})},o.prototype.indexToPosition=function(a,l){for(var u=this.$lines||this.getAllLines(),h=this.getNewLineCharacter().length,p=l||0,g=u.length;p<g;p++)if(a-=u[p].length+h,a<0)return{row:p,column:a+u[p].length+h};return{row:g-1,column:a+u[g-1].length+h}},o.prototype.positionToIndex=function(a,l){for(var u=this.$lines||this.getAllLines(),h=this.getNewLineCharacter().length,p=0,g=Math.min(a.row,u.length),m=l||0;m<g;++m)p+=u[m].length+h;return p+a.column},o.prototype.$split=function(a){return a.split(/\r\n|\r|\n/)},o}();n.prototype.$autoNewLine="",n.prototype.$newLineMode="auto",s.implement(n.prototype,f),e.Document=n});ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./lib/event_emitter").EventEmitter,f=function(){function i(d,n){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=d;var o=this;this.$worker=function(){if(o.running){for(var a=new Date,l=o.currentLine,u=-1,h=o.doc,p=l;o.lines[l];)l++;var g=h.getLength(),m=0;for(o.running=!1;l<g;){o.$tokenizeRow(l),u=l;do l++;while(o.lines[l]);if(m++,m%5===0&&new Date-a>20){o.running=setTimeout(o.$worker,20);break}}o.currentLine=l,u==-1&&(u=l),p<=u&&o.fireUpdateEvent(p,u)}}}return i.prototype.setTokenizer=function(d){this.tokenizer=d,this.lines=[],this.states=[],this.start(0)},i.prototype.setDocument=function(d){this.doc=d,this.lines=[],this.states=[],this.stop()},i.prototype.fireUpdateEvent=function(d,n){var o={first:d,last:n};this._signal("update",{data:o})},i.prototype.start=function(d){this.currentLine=Math.min(d||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},i.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},i.prototype.$updateOnChange=function(d){var n=d.start.row,o=d.end.row-n;if(o===0)this.lines[n]=null;else if(d.action=="remove")this.lines.splice(n,o+1,null),this.states.splice(n,o+1,null);else{var a=Array(o+1);a.unshift(n,1),this.lines.splice.apply(this.lines,a),this.states.splice.apply(this.states,a)}this.currentLine=Math.min(n,this.currentLine,this.doc.getLength()),this.stop()},i.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},i.prototype.getTokens=function(d){return this.lines[d]||this.$tokenizeRow(d)},i.prototype.getState=function(d){return this.currentLine==d&&this.$tokenizeRow(d),this.states[d]||"start"},i.prototype.$tokenizeRow=function(d){var n=this.doc.getLine(d),o=this.states[d-1],a=this.tokenizer.getLineTokens(n,o,d);return this.states[d]+""!=a.state+""?(this.states[d]=a.state,this.lines[d+1]=null,this.currentLine>d+1&&(this.currentLine=d+1)):this.currentLine==d&&(this.currentLine=d+1),this.lines[d]=a.tokens},i.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},i}();s.implement(f.prototype,c),e.BackgroundTokenizer=f});ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(t,e,r){"use strict";var s=t("./lib/lang"),c=t("./range").Range,f=function(){function i(d,n,o){o===void 0&&(o="text"),this.setRegexp(d),this.clazz=n,this.type=o,this.docLen=0}return i.prototype.setRegexp=function(d){this.regExp+""!=d+""&&(this.regExp=d,this.cache=[])},i.prototype.update=function(d,n,o,a){if(this.regExp){for(var l=a.firstRow,u=a.lastRow,h={},p=o.$editor.$search,g=p.$isMultilineSearch(o.$editor.getLastSearchOptions()),m=l;m<=u;m++){var y=this.cache[m];if(y==null||o.getValue().length!=this.docLen){if(g){y=[];var b=p.$multiLineForward(o,this.regExp,m,u);if(b){var C=b.endRow<=u?b.endRow-1:u;C>m&&(m=C),y.push(new c(b.startRow,b.startCol,b.endRow,b.endCol))}y.length>this.MAX_RANGES&&(y=y.slice(0,this.MAX_RANGES))}else y=s.getMatchOffsets(o.getLine(m),this.regExp),y.length>this.MAX_RANGES&&(y=y.slice(0,this.MAX_RANGES)),y=y.map(function(I){return new c(m,I.offset,m,I.offset+I.length)});this.cache[m]=y.length?y:""}if(y.length!==0)for(var E=y.length;E--;){var w=y[E].toScreenRange(o),k=w.toString();
185h[k]||(h[k]=!0,n.drawSingleLineMarker(d,w,this.clazz,a))}}this.docLen=o.getValue().length}},i}();f.prototype.MAX_RANGES=500,e.SearchHighlight=f});ace.define("ace/undomanager",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=function(){function w(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return w.prototype.addSession=function(k){this.$session=k},w.prototype.add=function(k,I,L){if(!this.$fromUndo&&k!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),I===!1||!this.lastDeltas){this.lastDeltas=[];var F=this.$undoStack.length;F>this.$undoDepth-1&&this.$undoStack.splice(0,F-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),k.id=this.$rev=++this.$maxRev}(k.action=="remove"||k.action=="insert")&&(this.$lastDelta=k),this.lastDeltas.push(k)}},w.prototype.addSelection=function(k,I){this.selections.push({value:k,rev:I||this.$rev})},w.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},w.prototype.markIgnored=function(k,I){I==null&&(I=this.$rev+1);for(var L=this.$undoStack,F=L.length;F--;){var R=L[F][0];if(R.id<=k)break;R.id<I&&(R.ignore=!0)}this.lastDeltas=null},w.prototype.getSelection=function(k,I){for(var L=this.selections,F=L.length;F--;){var R=L[F];if(R.rev<k)return I&&(R=L[F+1]),R}},w.prototype.getRevision=function(){return this.$rev},w.prototype.getDeltas=function(k,I){I==null&&(I=this.$rev+1);for(var L=this.$undoStack,F=null,R=0,M=L.length;M--;){var A=L[M][0];if(A.id<I&&!F&&(F=M+1),A.id<=k){R=M+1;break}}return L.slice(R,F)},w.prototype.getChangedRanges=function(k,I){I==null&&(I=this.$rev+1)},w.prototype.getChangedLines=function(k,I){I==null&&(I=this.$rev+1)},w.prototype.undo=function(k,I){this.lastDeltas=null;var L=this.$undoStack;if(c(L,L.length)){k||(k=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var F=L.pop(),R=null;return F&&(R=k.undoChanges(F,I),this.$redoStack.push(F),this.$syncRev()),this.$fromUndo=!1,R}},w.prototype.redo=function(k,I){if(this.lastDeltas=null,k||(k=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var L=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);E(this.$redoStack,L),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(M){M[0].id=++this.$maxRev},this)}var F=this.$redoStack.pop(),R=null;return F&&(R=k.redoChanges(F,I),this.$undoStack.push(F),this.$syncRev()),this.$fromUndo=!1,R},w.prototype.$syncRev=function(){var k=this.$undoStack,I=k[k.length-1],L=I&&I[0].id||0;this.$redoStackBaseRev=L,this.$rev=L},w.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},w.prototype.canUndo=function(){return this.$undoStack.length>0},w.prototype.canRedo=function(){return this.$redoStack.length>0},w.prototype.bookmark=function(k){k==null&&(k=this.$rev),this.mark=k},w.prototype.isAtBookmark=function(){return this.$rev===this.mark},w.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},w.prototype.fromJSON=function(k){this.reset(),this.$undoStack=k.$undoStack,this.$redoStack=k.$redoStack},w.prototype.$prettyPrint=function(k){return k?l(k):l(this.$undoStack)+`
186---
187`+l(this.$redoStack)},w}();s.prototype.hasUndo=s.prototype.canUndo,s.prototype.hasRedo=s.prototype.canRedo,s.prototype.isClean=s.prototype.isAtBookmark,s.prototype.markClean=s.prototype.bookmark;function c(w,k){for(var I=k;I--;){var L=w[I];if(L&&!L[0].ignore){for(;I<k-1;){var F=p(w[I],w[I+1]);w[I]=F[0],w[I+1]=F[1],I++}return!0}}}var f=t("./range").Range,i=f.comparePoints,d=f.comparePoints;function n(w){var k=w.action=="insert",I=w.start,L=w.end,F=(L.row-I.row)*(k?1:-1),R=(L.column-I.column)*(k?1:-1);k&&(L=I);for(var M in this.marks){var A=this.marks[M],_=d(A,I);if(!(_<0)){if(_===0&&k)if(A.bias==1)_=1;else{A.bias==-1;continue}var O=k?_:d(A,L);if(O>0){A.row+=F,A.column+=A.row==L.row?R:0;continue}!k&&O<=0&&(A.row=I.row,A.column=I.column,O===0&&(A.bias=1))}}}function o(w){return{row:w.row,column:w.column}}function a(w){return{start:o(w.start),end:o(w.end),action:w.action,lines:w.lines.slice()}}function l(w){if(w=w||this,Array.isArray(w))return w.map(l).join(`
188`);var k="";return w.action?(k=w.action=="insert"?"+":"-",k+="["+w.lines+"]"):w.value&&(Array.isArray(w.value)?k=w.value.map(u).join(`
189`):k=u(w.value)),w.start&&(k+=u(w)),(w.id||w.rev)&&(k+="	("+(w.id||w.rev)+")"),k}function u(w){return w.start.row+":"+w.start.column+"=>"+w.end.row+":"+w.end.column}function h(w,k){var I=w.action=="insert",L=k.action=="insert";if(I&&L)if(i(k.start,w.end)>=0)m(k,w,-1);else if(i(k.start,w.start)<=0)m(w,k,1);else return null;else if(I&&!L)if(i(k.start,w.end)>=0)m(k,w,-1);else if(i(k.end,w.start)<=0)m(w,k,-1);else return null;else if(!I&&L)if(i(k.start,w.start)>=0)m(k,w,1);else if(i(k.start,w.start)<=0)m(w,k,1);else return null;else if(!I&&!L)if(i(k.start,w.start)>=0)m(k,w,1);else if(i(k.end,w.start)<=0)m(w,k,-1);else return null;return[k,w]}function p(w,k){for(var I=w.length;I--;)for(var L=0;L<k.length;L++)if(!h(w[I],k[L])){for(;I<w.length;){for(;L--;)h(k[L],w[I]);L=k.length,I++}return[w,k]}return w.selectionBefore=k.selectionBefore=w.selectionAfter=k.selectionAfter=null,[k,w]}function g(w,k){var I=w.action=="insert",L=k.action=="insert";if(I&&L)i(w.start,k.start)<0?m(k,w,1):m(w,k,1);else if(I&&!L)i(w.start,k.end)>=0?m(w,k,-1):(i(w.start,k.start)<=0||m(w,f.fromPoints(k.start,w.start),-1),m(k,w,1));else if(!I&&L)i(k.start,w.end)>=0?m(k,w,-1):(i(k.start,w.start)<=0||m(k,f.fromPoints(w.start,k.start),-1),m(w,k,1));else if(!I&&!L)if(i(k.start,w.end)>=0)m(k,w,-1);else if(i(k.end,w.start)<=0)m(w,k,-1);else{var F,R;return i(w.start,k.start)<0&&(F=w,w=b(w,k.start)),i(w.end,k.end)>0&&(R=b(w,k.end)),y(k.end,w.start,w.end,-1),R&&!F&&(w.lines=R.lines,w.start=R.start,w.end=R.end,R=w),[k,F,R].filter(
189Boolean)}return[k,w]}function m(w,k,I){y(w.start,k.start,k.end,I),y(w.end,k.start,k.end,I)}function y(w,k,I,L){w.row==(L==1?k:I).row&&(w.column+=L*(I.column-k.column)),w.row+=L*(I.row-k.row)}function b(w,k){var I=w.lines,L=w.end;w.end=o(k);var F=w.end.row-w.start.row,R=I.splice(F,I.length),M=F?k.column:k.column-w.start.column;I.push(R[0].substring(0,M)),R[0]=R[0].substr(M);var A={start:o(k),end:L,lines:R,action:w.action};return A}function C(w,k){k=a(k);for(var I=w.length;I--;){for(var L=w[I],F=0;F<L.length;F++){var R=L[F],M=g(R,k);k=M[0],M.length!=2&&(M[2]?(L.splice(F+1,1,M[1],M[2]),F++):M[1]||(L.splice(F,1),F--))}L.length||w.splice(I,1)}return w}function E(w,k){for(var I=0;I<k.length;I++)for(var L=k[I],F=0;F<L.length;F++)C(w,L[F])}e.UndoManager=s});ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=t("../range").Range,c=function(){function f(i,d){this.foldData=i,Array.isArray(d)?this.folds=d:d=this.folds=[d];var n=d[d.length-1];this.range=new s(d[0].start.row,d[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(o){o.setFoldLine(this)},this)}return f.prototype.shiftRow=function(i){this.start.row+=i,this.end.row+=i,this.folds.forEach(function(d){d.start.row+=i,d.end.row+=i})},f.prototype.addFold=function(i){if(i.sameRow){if(i.start.row<this.startRow||i.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(i),this.folds.sort(function(d,n){return-d.range.compareEnd(n.start.row,n.start.column)}),this.range.compareEnd(i.start.row,i.start.column)>0?(this.end.row=i.end.row,this.end.column=i.end.column):this.range.compareStart(i.end.row,i.end.column)<0&&(this.start.row=i.start.row,this.start.column=i.start.column)}else if(i.start.row==this.end.row)this.folds.push(i),this.end.row=i.end.row,this.end.column=i.end.column;else if(i.end.row==this.start.row)this.folds.unshift(i),this.start.row=i.start.row,this.start.column=i.start.column;else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");i.foldLine=this},f.prototype.containsRow=function(i){return i>=this.start.row&&i<=this.end.row},f.prototype.walk=function(i,d,n){var o=0,a=this.folds,l,u,h,p=!0;d==null&&(d=this.end.row,n=this.end.column);for(var g=0;g<a.length;g++){if(l=a[g],u=l.range.compareStart(d,n),u==-1){i(null,d,n,o,p);return}if(h=i(null,l.start.row,l.start.column,o,p),h=!h&&i(l.placeholder,l.start.row,l.start.column,o),h||u===0)return;p=!l.sameRow,o=l.end.column}i(null,d,n,o,p)},f.prototype.getNextFoldTo=function(i,d){for(var n,o,a=0;a<this.folds.length;a++){if(n=this.folds[a],o=n.range.compareEnd(i,d),o==-1)return{fold:n,kind:"after"};if(o===0)return{fold:n,kind:"inside"}}return null},f.prototype.addRemoveChars=function(i,d,n){var o=this.getNextFoldTo(i,d),a,l;if(o){if(a=o.fold,o.kind=="inside"&&a.start.column!=d&&a.start.row!=i)window.console&&window.console.log(i,d,a);else if(a.start.row==i){l=this.folds;var u=l.indexOf(a);for(u===0&&(this.start.column+=n),u;u<l.length;u++){if(a=l[u],a.start.column+=n,!a.sameRow)return;a.end.column+=n}this.end.column+=n}}},f.prototype.split=function(i,d){var n=this.getNextFoldTo(i,d);if(!n||n.kind=="inside")return null;var o=n.fold,a=this.folds,l=this.foldData,u=a.indexOf(o),h=a[u-1];this.end.row=h.end.row,this.end.column=h.end.column,a=a.splice(u,a.length-u);var p=new f(l,a);return l.splice(l.indexOf(this)+1,0,p),p},f.prototype.merge=function(i){for(var d=i.folds,n=0;n<d.length;n++)this.addFold(d[n]);var o=this.foldData;o.splice(o.indexOf(i),1)},f.prototype.toString=function(){var i=[this.range.toString()+": ["];return this.folds.forEach(function(d){i.push("  "+d.toString())}),i.push("]"),i.join(`
190`)},f.prototype.idxToPosition=function(i){for(var d=0,n=0;n<this.folds.length;n++){var o=this.folds[n];if(i-=o.start.column-d,i<0)return{row:o.start.row,column:o.start.column+i};if(i-=o.placeholder.length,i<0)return o.start;d=o.end.column}return{row:this.end.row,column:this.end.column+i}},f}();e.FoldLine=c});ace.define("ace/range_list",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=t("./range").Range,c=s.comparePoints,f=function(){function i(){this.ranges=[],this.$bias=1}return i.prototype.pointIndex=function(d,n,o){for(var a=this.ranges,l=o||0;l<a.length;l++){var u=a[l],h=c(d,u.end);if(!(h>0)){var p=c(d,u.start);return h===0?n&&p!==0?-l-2:l:p>0||p===0&&!n?l:-l-1}}return-l-1},i.prototype.add=function(d){var n=!d.isEmpty(),o=this.pointIndex(d.start,n);o<0&&(o=-o-1);var a=this.pointIndex(d.end,n,o);return a<0?a=-a-1:a++,this.ranges.splice(o,a-o,d)},i.prototype.addList=function(d){for(var n=[],o=d.length;o--;)n.push.apply(n,this.add(d[o]));return n},i.prototype.substractPoint=function(d){var n=this.pointIndex(d);if(n>=0)return this.ranges.splice(n,1)},i.prototype.merge=function(){var d=[],n=this.ranges;n=n.sort(function(h,p){return c(h.start,p.start)});for(var o=n[0],a,l=1;l<n.length;l++){a=o,o=n[l];var u=c(a.end,o.start);u<0||u==0&&!a.isEmpty()&&!o.isEmpty()||(c(a.end,o.end)<0&&(a.end.row=o.end.row,a.end.column=o.end.column),n.splice(l,1),d.push(o),o=a,l--)}return this.ranges=n,d},i.prototype.contains=function(d,n){return this.pointIndex({row:d,column:n})>=0},i.prototype.containsPoint=function(d){return this.pointIndex(d)>=0},i.prototype.rangeAtPoint=function(d){var n=this.pointIndex(d);if(n>=0)return this.ranges[n]},i.prototype.clipRows=function(d,n){var o=this.ranges;if(o[0].start.row>n||o[o.length-1].start.row<d)return[];var a=this.pointIndex({row:d,column:0});a<0&&(a=-a-1);var l=this.pointIndex({row:n,column:0},a);l<0&&(l=-l-1);for(var u=[],h=a;h<l;h++)u.push(o[h]);return u},i.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},i.prototype.attach=function(d){this.session&&this.detach(),this.session=d,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},i.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},i.prototype.$onChange=function(d){for(var n=d.start,o=d.end,a=n.row,l=o.row,u=this.ranges,h=0,p=u.length;h<p;h++){var g=u[h];if(g.end.row>=a)break}if(d.action=="insert")for(var m=l-a,y=-n.column+o.column;h<p;h++){var g=u[h];if(g.start.row>a)break;if(g.start.row==a&&g.start.column>=n.column&&(g.start.column==n.column&&this.$bias<=0||(g.start.column+=y,g.start.row+=m)),g.end.row==a&&g.end.column>=n.column){if(g.end.column==n.column&&this.$bias<0)continue;g.end.column==n.column&&y>0&&h<p-1&&g.end.column>g.start.column&&g.end.column==u[h+1].start.column&&(g.end.column-=y),g.end.column+=y,g.end.row+=m}}else for(var m=a-l,y=n.column-o.column;h<p;h++){var g=u[h];if(g.start.row>l)break;g.end.row<l&&(a<g.end.row||a==g.end.row&&n.column<g.end.column)?(g.end.row=a,g.end.column=n.column):g.end.row==l?g.end.column<=o.column?(m||g.end.column>n.column)&&(g.end.column=n.column,g.end.row=n.row):(g.end.column+=y,g.end.row+=m):g.end.row>l&&(g.end.row+=m),g.start.row<l&&(a<g.start.row||a==g.start.row&&n.column<g.start.column)?(g.start.row=a,g.start.column=n.column):g.start.row==l?g.start.column<=o.column?(m||g.start.column>n.column)&&(g.start.column=n.column,g.start.row=n.row):(g.start.column+=y,g.start.row+=m):g.start.row>l&&(g.start.row+=m)}if(m!=0&&h<p)for(;h<p;h++){var g=u[h];g.start.row+=m,g.end.row+=m}},i}();f.prototype.comparePoints=c,e.RangeList=f});ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var a=function(l,u){return a=Object.
190setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(h[g]=p[g])},a(l,u)};return function(l,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");a(l,u);function h(){this.constructor=l}l.prototype=u===null?Object.create(u):(h.prototype=u.prototype,new h)}}(),c=t("../range_list").RangeList,f=function(a){s(l,a);function l(u,h){var p=a.call(this)||this;return p.foldLine=null,p.placeholder=h,p.range=u,p.start=u.start,p.end=u.end,p.sameRow=u.start.row==u.end.row,p.subFolds=p.ranges=[],p}return l.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},l.prototype.setFoldLine=function(u){this.foldLine=u,this.subFolds.forEach(function(h){h.setFoldLine(u)})},l.prototype.clone=function(){var u=this.range.clone(),h=new l(u,this.placeholder);return this.subFolds.forEach(function(p){h.subFolds.push(p.clone())}),h.collapseChildren=this.collapseChildren,h},l.prototype.addSubFold=function(u){if(!this.range.isEqual(u)){d(u,this.start);for(var y=u.start.row,b=u.start.column,h=0,p=-1;h<this.subFolds.length&&(p=this.subFolds[h].range.compare(y,b),p==1);h++);var g=this.subFolds[h],m=0;if(p==0){if(g.range.containsRange(u))return g.addSubFold(u);m=1}for(var y=u.range.end.row,b=u.range.end.column,C=h,p=-1;C<this.subFolds.length&&(p=this.subFolds[C].range.compare(y,b),p==1);C++);p==0&&C++;for(var E=this.subFolds.splice(h,C-h,u),w=p==0?E.length-1:E.length,k=m;k<w;k++)u.addSubFold(E[k]);return u.setFoldLine(this.foldLine),u}},l.prototype.restoreRange=function(u){return o(u,this.start)},l}(c);function i(a,l){a.row-=l.row,a.row==0&&(a.column-=l.column)}function d(a,l){i(a.start,l),i(a.end,l)}function n(a,l){a.row==0&&(a.column+=l.column),a.row+=l.row}function o(a,l){n(a.start,l),n(a.end,l)}e.Fold=f});ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(t,e,r){"use strict";var s=t("../range").Range,c=t("./fold_line").FoldLine,f=t("./fold").Fold,i=t("../token_iterator").TokenIterator,d=t("../mouse/mouse_event").MouseEvent;function n(){this.getFoldAt=function(o,a,l){var u=this.getFoldLine(o);if(!u)return null;for(var h=u.folds,p=0;p<h.length;p++){var g=h[p].range;if(g.contains(o,a)){if(l==1&&g.isEnd(o,a)&&!g.isEmpty())continue;if(l==-1&&g.isStart(o,a)&&!g.isEmpty())continue;return h[p]}}},this.getFoldsInRange=function(o){var a=o.start,l=o.end,u=this.$foldData,h=[];a.column+=1,l.column-=1;for(var p=0;p<u.length;p++){var g=u[p].range.compareRange(o);if(g!=2){if(g==-2)break;for(var m=u[p].folds,y=0;y<m.length;y++){var b=m[y];if(g=b.range.compareRange(o),g==-2)break;if(g==2)continue;if(g==42)break;h.push(b)}}}return a.column-=1,l.column+=1,h},this.getFoldsInRangeList=function(o){if(Array.isArray(o)){var a=[];o.forEach(function(l){a=a.concat(this.getFoldsInRange(l))},this)}else var a=this.getFoldsInRange(o);return a},this.getAllFolds=function(){for(var o=[],a=this.$foldData,l=0;l<a.length;l++)for(var u=0;u<a[l].folds.length;u++)o.push(a[l].folds[u]);return o},this.getFoldStringAt=function(o,a,l,u){if(u=u||this.getFoldLine(o),!u)return null;for(var h={end:{column:0}},p,g,m=0;m<u.folds.length;m++){g=u.folds[m];var y=g.range.compareEnd(o,a);if(y==-1){p=this.getLine(g.start.row).substring(h.end.column,g.start.column);break}else if(y===0)return null;h=g}return p||(p=this.getLine(g.start.row).substring(h.end.column)),l==-1?p.substring(0,a-h.end.column):l==1?p.substring(a-h.end.column):p},this.getFoldLine=function(o,a){var l=this.$foldData,u=0;for(a&&(u=l.indexOf(a)),u==-1&&(u=0),u;u<l.length;u++){var h=l[u];if(h.start.row<=o&&h.end.row>=o)return h;if(h.end.row>o)return null}return null},this.getNextFoldLine=function(o,a){var l=this.$foldData,u=0;for(a&&(u=l.indexOf(a)),u==-1&&(u=0),u;u<l.length;u++){var h=l[u];if(h.end.row>=o)return h}return null},this.getFoldedRowCount=function(o,a){for(var l=this.$foldData,u=a-o+1,h=0;h<l.length;h++){var p=l[h],g=p.end.row,m=p.start.row;if(g>=a){m<a&&(m>=o?u-=a-m:u=0);break}else g>=o&&(m>=o?u-=g-m:u-=g-o+1)}return u},this.$addFoldLine=function(o){return this.$foldData.push(o),this.$foldData.sort(function(a,l){return a.start.row-l.start.row}),o},this.addFold=function(o,a){var l=this.$foldData,u=!1,h;o instanceof f?h=o:(h=new f(a,o),h.collapseChildren=a.collapseChildren),this.$clipRangeToDocument(h.range);var p=h.start.row,g=h.start.column,m=h.end.row,y=h.end.column,b=this.getFoldAt(p,g,1),C=this.getFoldAt(m,y,-1);if(b&&C==b)return b.addSubFold(h);b&&!b.range.isStart(p,g)&&this.removeFold(b),C&&!C.range.isEnd(m,y)&&this.removeFold(C);var E=this.getFoldsInRange(h.range);E.length>
1900&&(this.removeFolds(E),h.collapseChildren||E.forEach(function(L){h.addSubFold(L)}));for(var w=0;w<l.length;w++){var k=l[w];if(m==k.start.row){k.addFold(h),u=!0;break}else if(p==k.end.row){if(k.addFold(h),u=!0,!h.sameRow){var I=l[w+1];if(I&&I.start.row==m){k.merge(I);break}}break}else if(m<=k.start.row)break}return u||(k=this.$addFoldLine(new c(this.$foldData,h))),this.$useWrapMode?this.$updateWrapData(k.start.row,k.start.row):this.$updateRowLengthCache(k.start.row,k.start.row),this.$modified=!0,this._signal("changeFold",{data:h,action:"add"}),h},this.addFolds=function(o){o.forEach(function(a){this.addFold(a)},this)},this.removeFold=function(o){var a=o.foldLine,l=a.start.row,u=a.end.row,h=this.$foldData,p=a.folds;if(p.length==1)h.splice(h.indexOf(a),1);else if(a.range.isEnd(o.end.row,o.end.column))p.pop(),a.end.row=p[p.length-1].end.row,a.end.column=p[p.length-1].end.column;else if(a.range.isStart(o.start.row,o.start.column))p.shift(),a.start.row=p[0].start.row,a.start.column=p[0].start.column;else if(o.sameRow)p.splice(p.indexOf(o),1);else{var g=a.split(o.start.row,o.start.column);p=g.folds,p.shift(),g.start.row=p[0].start.row,g.start.column=p[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(l,u):this.$updateRowLengthCache(l,u)),this.$modified=!0,this._signal("changeFold",{data:o,action:"remove"})},this.removeFolds=function(o){for(var a=[],l=0;l<o.length;l++)a.push(o[l]);a.forEach(function(u){this.removeFold(u)},this),this.$modified=!0},this.expandFold=function(o){this.removeFold(o),o.subFolds.forEach(function(a){o.restoreRange(a),this.addFold(a)},this),o.collapseChildren>0&&this.foldAll(o.start.row+1,o.end.row,o.collapseChildren-1),o.subFolds=[]},this.expandFolds=function(o){o.forEach(function(a){this.expandFold(a)},this)},this.unfold=function(o,a){var l,u;if(o==null)l=new s(0,0,this.getLength(),0),a==null&&(a=!0);else if(typeof o=="number")l=new s(o,0,o,this.getLine(o).length);else if("row"in o)l=s.fromPoints(o,o);else{if(Array.isArray(o))return u=[],o.forEach(function(p){u=u.concat(this.unfold(p))},this),u;l=o}u=this.getFoldsInRangeList(l);for(var h=u;
190u.length==1&&s.comparePoints(u[0].start,l.start)<0&&s.comparePoints(u[0].end,l.end)>0;)this.expandFolds(u),u=this.getFoldsInRangeList(l);if(a!=!1?this.removeFolds(u):this.expandFolds(u),h.length)return h},this.isRowFolded=function(o,a){return!!this.getFoldLine(o,a)},this.getRowFoldEnd=function(o,a){var l=this.getFoldLine(o,a);return l?l.end.row:o},this.getRowFoldStart=function(o,a){var l=this.getFoldLine(o,a);return l?l.start.row:o},this.getFoldDisplayLine=function(o,a,l,u,h){u==null&&(u=o.start.row),h==null&&(h=0),a==null&&(a=o.end.row),l==null&&(l=this.getLine(a).length);var p=this.doc,g="";return o.walk(function(m,y,b,C){if(!(y<u)){if(y==u){if(b<h)return;C=Math.max(h,C)}m!=null?g+=m:g+=p.getLine(y).substring(C,b)}},a,l),g},this.getDisplayLine=function(o,a,l,u){var h=this.getFoldLine(o);if(h)return this.getFoldDisplayLine(h,o,a,l,u);var p;return p=this.doc.getLine(o),p.substring(u||0,a||p.length)},this.$cloneFoldData=function(){var o=[];return o=this.$foldData.map(function(a){var l=a.folds.map(function(u){return u.clone()});return new c(o,l)}),o},this.toggleFold=function(o){var a=this.selection,l=a.getRange(),u,h;if(l.isEmpty()){var p=l.start;if(u=this.getFoldAt(p.row,p.column),u){this.expandFold(u);return}else if(o){var g=this.getFoldLine(p.row);g&&this.expandFolds(g.folds);return}else(h=this.findMatchingBracket(p))?l.comparePoint(h)==1?l.end=h:(l.start=h,l.start.column++,l.end.column--):(h=this.findMatchingBracket({row:p.row,column:p.column+1}))?(l.comparePoint(h)==1?l.end=h:l.start=h,l.start.column++):l=this.getCommentFoldRange(p.row,p.column)||l}else{var m=this.getFoldsInRange(l);if(o&&m.length){this.expandFolds(m);return}else m.length==1&&(u=m[0])}if(u||(u=this.getFoldAt(l.start.row,l.start.column)),u&&u.range.toString()==l.toString()){this.expandFold(u);return}var y="...";if(!l.isMultiLine()){if(y=this.getTextRange(l),y.length<4)return;y=y.trim().substring(0,2)+".."}this.addFold(y,l)},this.getCommentFoldRange=function(o,a,l){var u=new i(this,o,a),h=u.getCurrentToken(),p=h&&h.type;if(h&&/^comment|string/.test(p)){p=p.match(/comment|string/)[0],p=="comment"&&(p+="|doc-start|\\.doc");var g=new RegExp(p),m=new s;if(l!=1){do h=u.stepBackward();while(h&&g.test(h.type));h=u.stepForward()}m.start.row=u.getCurrentTokenRow(),m.start.column=u.getCurrentTokenColumn()+h.value.length,u=new i(this,o,a);var y=this.getState(u.$row);if(l!=-1){var b=-1;do if(h=u.stepForward(),b==-1){var C=this.getState(u.$row);y.toString()!==C.toString()&&(b=u.$row)}else if(u.$row>b)break;while(h&&g.test(h.type));h=u.stepBackward()}else h=u.getCurrentToken();return m.end.row=u.getCurrentTokenRow(),m.end.column=u.getCurrentTokenColumn(),m.start.row==m.end.row&&m.start.column>m.end.column?void 0:m}},this.foldAll=function(o,a,l,u){l==null&&(l=1e5);var h=this.foldWidgets;if(h){a=a||this.getLength(),o=o||0;for(var p=o;p<a;p++)if(h[p]==null&&(h[p]=this.getFoldWidget(p)),h[p]=="start"&&!(u&&!u(p))){var g=this.getFoldWidgetRange(p);g&&g.isMultiLine()&&g.end.row<=a&&g.start.row>=o&&(p=g.end.row,g.collapseChildren=l,this.addFold("...",g))}}},this.foldToLevel=function(o){for(this.foldAll();o-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var o=this;this.foldAll(null,null,null,function(a){for(var l=o.getTokens(a),u=0;u<l.length;u++){var h=l[u];if(!(h.type=="text"&&/^\s+$/.test(h.value)))return!!/comment/.test(h.type)}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(o){if(!this.$foldStyles[o])throw new Error("invalid fold style: "+o+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=o){this.$foldStyle=o,o=="manual"&&this.unfold();var a=this.$foldMode;this.$setFolding(null),this.$setFolding(a)}},this.$setFolding=function(o){if(this.$foldMode!=o){if(this.$foldMode=o,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!o||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=o.getFoldWidget.bind(o,this,this.$foldStyle),this.getFoldWidgetRange=o.getFoldWidgetRange.bind(o,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(o,a){var l=this.foldWidgets;if(!l||a&&l[o])return{};for(var u=o-1,h;u>=0;){var p=l[u];if(p==null&&(p=l[u]=this.getFoldWidget(u)),p=="start"){var g=this.getFoldWidgetRange(u);if(h||(h=g),g&&g.end.row>=o)break}u--}return{range:u!==-1&&g,firstRange:h}},this.onFoldWidgetClick=function(o,a){a instanceof d&&(a=a.domEvent);var l={children:a.shiftKey,all:a.ctrlKey||a.metaKey,siblings:a.altKey},u=this.$toggleFoldWidget(o,l);if(!u){var h=a.target||a.srcElement;h&&/ace_fold-widget/.test(h.className)&&(h.className+=" ace_invalid")}},this.$toggleFoldWidget=function(o,a){if(this.getFoldWidget){var l=this.getFoldWidget(o),u=this.getLine(o),h=l==="end"?-1:1,p=this.getFoldAt(o,h===-1?0:u.length,h);if(p)return a.children||a.all?this.removeFold(p):this.expandFold(p),p;var g=this.getFoldWidgetRange(o,!0);if(g&&!g.isMultiLine()&&(p=this.getFoldAt(g.start.row,g.start.column,1),p&&g.isEqual(p.range)))return this.removeFold(p),p;if(a.siblings){var m=this.getParentFoldRangeData(o);if(m.range)var y=m.range.start.row+1,b=m.range.end.row;this.foldAll(y,b,a.all?1e4:0)}else a.children?(b=g?g.end.row:this.getLength(),this.foldAll(o+1,b,a.all?1e4:0)):g&&(a.all&&(g.collapseChildren=1e4),this.addFold("...",g));return g}},this.toggleFoldWidget=function(o){var a=this.selection.getCursor().row;a=this.getRowFoldStart(a);var l=this.$toggleFoldWidget(a,{});if(!l){var u=this.getParentFoldRangeData(a,!0);if(l=u.range||u.firstRange,l){a=l.start.row;var h=this.getFoldAt(a,this.getLine(a).length,1);h?this.removeFold(h):this.addFold("...",l)}}},this.updateFoldWidgets=function(o){var a=o.start.row,l=o.end.row-a;if(l===0)this.foldWidgets[a]=null;else if(o.action=="remove")this.foldWidgets.splice(a,l+1,null);else{var u=Array(l+1);u.unshift(a,1),this.foldWidgets.splice.apply(this.foldWidgets,u)}},this.tokenizerUpdateFoldWidgets=function(o){var a=o.data;a.first!=a.last&&this.foldWidgets.length>a.first&&this.foldWidgets.splice(a.first,this.foldWidgets.length)}}e.Folding=n});ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(t,e,r){"use strict";var s=t("../token_iterator").TokenIterator,c=t("../range").Range;function f(){this.findMatchingBracket=function(i,d){if(i.column==0)return null;var n=d||this.getLine(i.row).charAt(i.column-1);if(n=="")return null;var o=n.match(/([\(\[\{])|([\)\]\}])/);return o?o[1]?this.$findClosingBracket(o[1],i):this.$findOpeningBracket(o[2],i):null},this.getBracketRange=function(i){var d=this.getLine(i.row),n=!0,o,a=d.charAt(i.column-1),l=a&&a.match(/([\(\[\{])|([\)\]\}])/);if(l||(a=d.charAt(i.column),i={row:i.row,column:i.column+1},l=a&&a.match(/([\(\[\{])|([\)\]\}])/),n=!1),!l)return null;if(l[1]){var u=this.$findClosingBracket(l[1],i);if(!u)return null;o=c.fromPoints(i,u),n||(o.end.column++,o.start.column--),o.cursor=o.end}else{var u=this.$findOpeningBracket(l[2],i);if(!u)return null;o=c.fromPoints(u,i),n||(o.start.column++,o.end.column--),o.cursor=o.start}return o},this.getMatchingBracketRanges=function(i,d){var n=this.getLine(i.row),o=/([\(\[\{])|([\)\]\}])/,a=!d&&n.charAt(i.column-1),l=a&&a.match(o);if(l||(a=(d===void 0||d)&&n.charAt(i.column),i={row:i.row,column:i.column+1}
190,l=a&&a.match(o)),!l)return null;var u=new c(i.row,i.column-1,i.row,i.column),h=l[1]?this.$findClosingBracket(l[1],i):this.$findOpeningBracket(l[2],i);if(!h)return[u];var p=new c(h.row,h.column,h.row,h.column+1);return[u,p]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(i,d,n){var o=this.$brackets[i],a=1,l=new s(this,d.row,d.column),u=l.getCurrentToken();if(u||(u=l.stepForward()),!!u){n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var h=d.column-l.getCurrentTokenColumn()-2,p=u.value;;){for(;h>=0;){var g=p.charAt(h);if(g==o){if(a-=1,a==0)return{row:l.getCurrentTokenRow(),column:h+l.getCurrentTokenColumn()}}else g==i&&(a+=1);h-=1}do u=l.stepBackward();while(u&&!n.test(u.type));if(u==null)break;p=u.value,h=p.length-1}return null}},this.$findClosingBracket=function(i,d,n){var o=this.$brackets[i],a=1,l=new s(this,d.row,d.column),u=l.getCurrentToken();if(u||(u=l.stepForward()),!!u){n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var h=d.column-l.getCurrentTokenColumn();;){for(var p=u.value,g=p.length;h<g;){var m=p.charAt(h);if(m==o){if(a-=1,a==0)return{row:l.getCurrentTokenRow(),column:h+l.getCurrentTokenColumn()}}else m==i&&(a+=1);h+=1}do u=l.stepForward();while(u&&!n.test(u.type));if(u==null)break;h=0}return null}},this.getMatchingTags=function(i){var d=new s(this,i.row,i.column),n=this.$findTagName(d);if(n){var o=d.stepBackward();return o.value==="<"?this.$findClosingTag(d,n):this.$findOpeningTag(d,n)}},this.$findTagName=function(i){var d=i.getCurrentToken(),n=!1,o=!1;if(d&&d.type.indexOf("tag-name")===-1)do o?d=i.stepBackward():d=i.stepForward(),d&&(d.value==="/>"?o=!0:d.type.indexOf("tag-name")!==-1&&(n=!0));while(d&&!n);return d},this.$findClosingTag=function(i,d){var n,o=d.value,a=d.value,l=0,u=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);d=i.stepForward();var h=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+d.value.length),p=!1;do{if(n=d,n.type.indexOf("tag-close")!==-1&&!p){var g=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);p=!0}if(d=i.stepForward(),d){if(d.value===">"&&!p){var g=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);p=!0}if(d.type.indexOf("tag-name")!==-1){if(o=d.value,a===o){if(n.value==="<")l++;else if(n.value==="</"&&(l--,l<0)){i.stepBackward();var m=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+2);d=i.stepForward();var y=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+d.value.length);if(d.type.indexOf("tag-close")===-1&&(d=i.stepForward()),d&&d.value===">")var b=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);else return}}}else if(a===o&&d.value==="/>"&&(l--,l<0))var m=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+2),y=m,b=y,g=new c(h.end.row,h.end.column,h.end.row,h.end.column+1)}}while(d&&l>=0);if(u&&g&&m&&b&&h&&y)return{openTag:new c(u.start.row,u.start.column,g.end.row,g.end.column),closeTag:new c(m.start.row,m.start.column,b.end.row,b.end.column),openTagName:h,closeTagName:y}},this.$findOpeningTag=function(i,d){var n=i.getCurrentToken(),o=d.value,a=0,l=i.getCurrentTokenRow(),u=i.getCurrentTokenColumn(),h=u+2,p=new c(l,u,l,h);i.stepForward();var g=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+d.value.length);if(d.type.indexOf("tag-close")===-1&&(d=i.stepForward()),!(!d||d.value!==">")){var m=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);i.stepBackward(),i.stepBackward();do if(d=n,l=i.getCurrentTokenRow(),u=i.getCurrentTokenColumn(),h=u+d.value.length,n=i.stepBackward(),d){if(d.type.indexOf("tag-name")!==-1){if(o===d.value)if(n.value==="<"){if(a++,a>0){var y=new c(l,u,l,h),b=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1);do d=i.stepForward();while(d&&d.value!==">");var C=new c(i.getCurrentTokenRow(),i.getCurrentTokenColumn(),i.getCurrentTokenRow(),i.getCurrentTokenColumn()+1)}}else n.value==="</"&&a--}else if(d.value==="/>"){for(var E=0,w=n;w;){if(w.type.indexOf("tag-name")!==-1&&w.value===o){a--;break}else if(w.value==="<")break;w=i.stepBackward(),E++}for(var k=0;k<E;k++)i.stepForward()}}while(n&&a<=0);if(b&&C&&p&&m&&y&&g)return{openTag:new c(b.start.row,b.start.column,C.end.row,C.end.column),closeTag:new c(p.start.row,p.start.column,m.end.row,m.end.column),openTagName:y,closeTagName:g}}}}e.BracketMatch=f});ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/line_widgets","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./lib/lang"),f=t("./bidihandler").BidiHandler,i=t("./config"),d=t("./lib/event_emitter").EventEmitter,n=t("./selection").Selection,o=t("./mode/text").Mode,a=t("./range").Range,l=t("./line_widgets").LineWidgets,u=t("./document").Document,h=t("./background_tokenizer").Backgroun
190dTokenizer,p=t("./search_highlight").SearchHighlight,g=t("./undomanager").UndoManager,m=function(){function R(M,A){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$editor=null,this.prevOp={},this.$foldData=[],this.id="session"+ ++R.$uid,this.$foldData.toString=function(){return this.join(`
191`)},this.$gutterCustomWidgets={},this.bgTokenizer=new h(new o().getTokenizer(),this);var _=this;this.bgTokenizer.on("update",function(O){_._signal("tokenizerUpdate",O)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),(typeof M!="object"||!M.getLine)&&(M=new u(M)),this.setDocument(M),this.selection=new n(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new f(this),i.resetOptions(this),this.setMode(A),i._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return R.prototype.$initOperationListeners=function(){var M=this;this.curOp=null,this.on("change",function(){M.curOp||(M.startOperation(),M.curOp.selectionBefore=M.$lastSel),M.curOp.docChanged=!0},!0),this.on("changeSelection",function(){M.curOp||(M.startOperation(),M.curOp.selectionBefore=M.$lastSel),M.curOp.selectionChanged=!0},!0),this.$operationResetTimer=c.delayedCall(this.endOperation.bind(this,!0))},R.prototype.startOperation=function(M){if(this.curOp){if(!M||this.curOp.command)return;this.prevOp=this.curOp}M||(M={}),this.$operationResetTimer.schedule(),this.curOp={command:M.command||{},args:M.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",M)},R.prototype.endOperation=function(M){if(this.curOp){if(M&&M.returnValue===!1){this.curOp=null,this._signal("endOperation",M);return}if(M==!0&&this.curOp.command&&this.curOp.command.name=="mouse")return;var A=this.selection.toJSON();this.curOp.selectionAfter=A,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(A),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",M)}},R.prototype.setDocument=function(M){this.doc&&this.doc.off("change",this.$onChange),this.doc=M,M.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},R.prototype.getDocument=function(){return this.doc},Object.defineProperty(R.prototype,"widgetManager",{get:function(){var M=new l(this);return this.widgetManager=M,this.$editor&&M.attach(this.$editor),M},set:function(M){Object.defineProperty(this,"widgetManager",{writable:!0,enumerable:!0,configurable:!0,value:M})},enumerable:!1,configurable:!0}),R.prototype.$resetRowCache=function(M){if(!M){this.$docRowCache=[],this.$screenRowCache=[];return}var A=this.$docRowCache.length,_=this.$getRowCacheIndex(this.$docRowCache,M)+1;A>_&&(this.$docRowCache.splice(_,A),this.$screenRowCache.splice(_,A))},R.prototype.$getRowCacheIndex=function(M,A){for(var _=0,O=M.length-1;_<=O;){var D=_+O>>1,B=M[D];if(A>B)_=D+1;else if(A<B)O=D-1;else return D}return _-1},R.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},R.prototype.onChangeFold=function(M){var A=M.data;this.$resetRowCache(A.start.row)},R.prototype.onChange=function(M){this.$modified=!0,this.$bidiHandler.onChange(M),this.$resetRowCache(M.start.row);var A=this.$updateInternalDataOnChange(M);!this.$fromUndo&&this.$undoManager&&(A&&A.length&&(this.$undoManager.add({action:"removeFolds",folds:A},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(M,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(M),this._signal("change",M)},R.prototype.onSelectionChange=function(){this._signal("changeSelection")},R.prototype.setValue=function(M){this.doc.setValue(M),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()}
191,R.fromJSON=function(M){typeof M=="string"&&(M=JSON.parse(M));var A=new g;A.$undoStack=M.history.undo,A.$redoStack=M.history.redo,A.mark=M.history.mark,A.$rev=M.history.rev;var _=new R(M.value);return M.folds.forEach(function(O){_.addFold("...",a.fromPoints(O.start,O.end))}),_.setAnnotations(M.annotations),_.setBreakpoints(M.breakpoints),_.setMode(M.mode),_.setScrollLeft(M.scrollLeft),_.setScrollTop(M.scrollTop),_.setUndoManager(A),_.selection.fromJSON(M.selection),_},R.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(M){return M.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},R.prototype.toString=function(){return this.doc.getValue()},R.prototype.getSelection=function(){return this.selection},R.prototype.getState=function(M){return this.bgTokenizer.getState(M)},R.prototype.getTokens=function(M){return this.bgTokenizer.getTokens(M)},R.prototype.getTokenAt=function(M,A){var _=this.bgTokenizer.getTokens(M),O,D=0;if(A==null){var B=_.length-1;D=this.getLine(M).length}else for(var B=0;B<_.length&&(D+=_[B].value.length,!(D>=A));B++);return O=_[B],O?(O.index=B,O.start=D-O.value.length,O):null},R.prototype.setUndoManager=function(M){if(this.$undoManager=M,this.$informUndoManager&&this.$informUndoManager.cancel(),M){var A=this;M.addSession(this),this.$syncInformUndoManager=function(){A.$informUndoManager.cancel(),A.mergeUndoDeltas=!1},this.$informUndoManager=c.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},R.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},R.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},R.prototype.getTabString=function(){return this.getUseSoftTabs()?c.stringRepeat(" ",this.getTabSize()):"	"},R.prototype.setUseSoftTabs=function(M){this.setOption("useSoftTabs",M)},R.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},R.prototype.setTabSize=function(M){this.setOption("tabSize",M)},R.prototype.getTabSize=function(){return this.$tabSize},R.prototype.isTabStop=function(M){return this.$useSoftTabs&&M.column%this.$tabSize===0},R.prototype.setNavigateWithinSoftTabs=function(M){this.setOption("navigateWithinSoftTabs",M)},R.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs}
191,R.prototype.setOverwrite=function(M){this.setOption("overwrite",M)},R.prototype.getOverwrite=function(){return this.$overwrite},R.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},R.prototype.addGutterDecoration=function(M,A){this.$decorations[M]||(this.$decorations[M]=""),this.$decorations[M]+=" "+A,this._signal("changeBreakpoint",{})},R.prototype.removeGutterCustomWidget=function(M){this.$editor&&this.$editor.renderer.$gutterLayer.$removeCustomWidget(M)},R.prototype.addGutterCustomWidget=function(M,A){this.$editor&&this.$editor.renderer.$gutterLayer.$addCustomWidget(M,A)},R.prototype.removeGutterDecoration=function(M,A){this.$decorations[M]=(this.$decorations[M]||"").replace(" "+A,""),this._signal("changeBreakpoint",{})},R.prototype.getBreakpoints=function(){return this.$breakpoints},R.prototype.setBreakpoints=function(M){this.$breakpoints=[];for(var A=0;A<M.length;A++)this.$breakpoints[M[A]]="ace_breakpoint";this._signal("changeBreakpoint",{})},R.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},R.prototype.setBreakpoint=function(M,A){A===void 0&&(A="ace_breakpoint"),A?this.$breakpoints[M]=A:delete this.$breakpoints[M],this._signal("changeBreakpoint",{})},R.prototype.clearBreakpoint=function(M){delete this.$breakpoints[M],this._signal("changeBreakpoint",{})},R.prototype.addMarker=function(M,A,_,O){var D=this.$markerId++,B={range:M,type:_||"line",renderer:typeof _=="function"?_:null,clazz:A,inFront:!!O,id:D};return O?(this.$frontMarkers[D]=B,this._signal("changeFrontMarker")):(this.$backMarkers[D]=B,this._signal("changeBackMarker")),D},R.prototype.addDynamicMarker=function(M,A){if(M.update){var _=this.$markerId++;return M.id=_,M.inFront=!!A,A?(this.$frontMarkers[_]=M,this._signal("changeFrontMarker")):(this.$backMarkers[_]=M,this._signal("changeBackMarker")),M}},R.prototype.removeMarker=function(M){var A=this.$frontMarkers[M]||this.$backMarkers[M];if(A){var _=A.inFront?this.$frontMarkers:this.$backMarkers;delete _[M],this._signal(A.inFront?"changeFrontMarker":"changeBackMarker")}},R.prototype.getMarkers=function(M){return M?this.$frontMarkers:this.$backMarkers},R.prototype.highlight=function(M){if(!this.$searchHighlight){var A=new p(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(A)}this.$searchHighlight.setRegexp(M)},R.prototype.highlightLines=function(M,A,_,O){typeof A!="number"&&(_=A,A=M),_||(_="ace_step");var D=new a(M,0,A,1/0);return D.id=this.addMarker(D,_,"fullLine",O),D},R.prototype.setAnnotations=function(M){this.$annotations=M,this._signal("changeAnnotation",{})},R.prototype.getAnnotations=function(){return this.$annotations||[]},R.prototype.clearAnnotations=function(){this.setAnnotations([])},R.prototype.$detectNewLine=function(M){var A=M.match(/^.*?(\r?\n)/m);A?this.$autoNewLine=A[1]:this.$autoNewLine=`
192`},R.prototype.getWordRange=function(M,A){var _=this.getLine(M),O=!1;if(A>0&&(O=!!_.charAt(A-1).match(this.tokenRe)),O||(O=!!_.charAt(A).match(this.tokenRe)),O)var D=this.tokenRe;else if(/^\s+$/.test(_.slice(A-1,A+1)))var D=/\s/;else var D=this.nonTokenRe;var B=A;if(B>0){do B--;while(B>=0&&_.charAt(B).match(D));B++}for(var P=A;P<_.length&&_.charAt(P).match(D);)P++;return new a(M,B,M,P)},R.prototype.getAWordRange=function(M,A){for(var _=this.getWordRange(M,A),O=this.getLine(_.end.row);O.charAt(_.end.column).match(/[ \t]/);)_.end.column+=1;return _},R.prototype.setNewLineMode=function(M){this.doc.setNewLineMode(M)},R.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},R.prototype.setUseWorker=function(M){this.setOption("useWorker",M)},R.prototype.getUseWorker=function(){return this.$useWorker},R.prototype.onReloadTokenizer=function(M){var A=M.data;this.bgTokenizer.start(A.first),this._signal("tokenizerUpdate",M)},R.prototype.setMode=function(M,A){if(M&&typeof M=="object"){if(M.getTokenizer)return this.$onChangeMode(M);var _=M,O=_.path}else O=M||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new o),this.$modes[O]&&!_){this.$onChangeMode(this.$modes[O]),A&&A();return}
192this.$modeId=O,i.loadModule(["mode",O],function(D){if(!this.destroyed){if(this.$modeId!==O)return A&&A();this.$modes[O]&&!_?this.$onChangeMode(this.$modes[O]):D&&D.Mode&&(D=new D.Mode(_),_||(this.$modes[O]=D,D.$id=O),this.$onChangeMode(D)),A&&A()}}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},R.prototype.$onChangeMode=function(M,A){if(A||(this.$modeId=M.$id),this.$mode!==M){var _=this.$mode;this.$mode=M,this.$stopWorker(),this.$useWorker&&this.$startWorker();var O=M.getTokenizer();if(O.on!==void 0){var D=this.onReloadTokenizer.bind(this);O.on("update",D)}this.bgTokenizer.setTokenizer(O),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=M.tokenRe,this.nonTokenRe=M.nonTokenRe,A||(M.attachToSession&&M.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(M.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:_,mode:M}))}},R.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},R.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(M){i.warn("Could not load worker",M),this.$worker=null}},R.prototype.getMode=function(){return this.$mode},R.prototype.setScrollTop=function(M){this.$scrollTop===M||isNaN(M)||(this.$scrollTop=M,this._signal("changeScrollTop",M))},R.prototype.getScrollTop=function(){return this.$scrollTop},R.prototype.setScrollLeft=function(M){this.$scrollLeft===M||isNaN(M)||(this.$scrollLeft=M,this._signal("changeScrollLeft",M))},R.prototype.getScrollLeft=function(){return this.$scrollLeft},R.prototype.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},R.prototype.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var M=0;return this.lineWidgets.forEach(function(A){A&&A.screenWidth>M&&(M=A.screenWidth)}),this.lineWidgetWidth=M},R.prototype.$computeWidth=function(M){if(this.$modified||M){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var A=this.doc.getAllLines(),_=this.$rowLengthCache,O=0,D=0,B=this.$foldData[D],P=B?B.start.row:1/0,H=A.length,W=0;W<H;W++){if(W>P){if(W=B.end.row+1,W>=H)break;B=this.$foldData[D++],P=B?B.start.row:1/0}_[W]==null&&(_[W]=this.$getStringScreenWidth(A[W])[0]),_[W]>O&&(O=_[W])}this.screenWidth=O}},R.prototype.getLine=function(M){return this.doc.getLine(M)},R.prototype.getLines=function(M,A){return this.doc.getLines(M,A)},R.prototype.getLength=function(){return this.doc.getLength()},R.prototype.getTextRange=function(M){return this.doc.getTextRange(M||this.selection.getRange())},R.prototype.insert=function(M,A){return this.doc.insert(M,A)},R.prototype.remove=function(M){return this.doc.remove(M)},R.prototype.removeFullLines=function(M,A){return this.doc.removeFullLines(M,A)},R.prototype.undoChanges=function(M,A){if(M.length){this.$fromUndo=!0;for(var _=M.length-1;_!=-1;_--){var O=M[_];O.action=="insert"||O.action=="remove"?this.doc.revertDelta(O):O.folds&&this.addFolds(O.folds)}!A&&this.$undoSelect&&(M.selectionBefore?this.selection.fromJSON(M.selectionBefore):this.selection.setRange(this.$getUndoSelection(M,!0))),this.$fromUndo=!1}},R.prototype.redoChanges=function(M,A){if(M.length){this.$fromUndo=!0;for(var _=0;_<M.length;_++){var O=M[_];(O.action=="insert"||O.action=="remove")&&this.doc.$safeApplyDelta(O)}!A&&this.$undoSelect&&(M.selectionAfter?this.selection.fromJSON(M.selectionAfter):this.selection.setRange(this.$getUndoSelection(M,!1))),this.$fromUndo=!1}},R.prototype.setUndoSelect=function(M){this.$undoSelect=M},R.prototype.$getUndoSelection=function(M,A){function _(H){return A?H.action!=="insert":H.action==="insert"}for(var O,D,B=0;B<M.length;B++){var P=M[B];if(P.start){if(!O){_(P)?O=a.fromPoints(P.start,P.end):O=a.fromPoints(P.start,P.start);continue}_(P)?(D=P.start,O.compare(D.row,D.column)==-1&&O.setStart(D),D=P.end,O.compare(D.row,D.column)==1&&O.setEnd(D)):(D=P.start,O.compare(D.row,D.column)==-1&&(O=a.fromPoints(P.start,P.start)))}}return O},R.prototype.replace=function(M,A){return this.doc.replace(M,A)},R.prototype.moveText=function(M,A,_){var O=this.getTextRange(M),D=this.getFoldsInRange(M),B=a.fromPoints(A,A);if(!_){this.remove(M);var P=M.start.row-M.end.row,H=P?-M.end.column:M.start.column-M.end.column;H&&(B.start.row==M.end.row&&B.start.column>M.end.column&&(B.start.column+=H),B.end.row==M.end.row&&B.end.column>M.end.column&&(B.end.column+=H)),P&&B.start.row>=M.end.row&&(B.start.row+=P,B.end.row+=P)}if(B.end=this.insert(B.start,O),D.length){var W=M.start,K=B.start,P=K.row-W.row,H=K.column-W.column;this.addFolds(D.map(function(Z){return Z=Z.clone(),Z.start.row==W.row&&(Z.start.column+=H),Z.end.row==W.row&&(Z.end.column+=H),Z.start.row+=P,Z.end.row+=P,Z}))}return B},R.prototype.indentRows=function(M,A,_){_=_.replace(/\t/g,this.getTabString());for(var O=M;O<=A;O++)this.doc.insertInLine({row:O,column:0},_)},R.prototype.outdentRows=function(M){for(var A=M.collapseRows(),_=new a(0,0,0,0),O=this.getTabSize(),D=A.start.row;D<=A.end.row;++D){var B=this.getLine(D);_.start.row=D,_.end.row=D;for(var P=0;P<O&&B.charAt(P)==" ";++P);P<O&&B.charAt(P)=="	"?(_.start.column=P,_.end.column=P+1):(_.start.column=0,_.end.column=P),this.remove(_)}},R.prototype.$moveLines=function(M,A,_){if(M=this.getRowFoldStart(M),A=this.getRowFoldEnd(A),_<0){var O=this.getRowFoldStart(M+_);if(O<0)return 0;var D=O-M}else if(_>0){var O=this.getRowFoldEnd(A+_);if(O>this.doc.getLength()-1)return 0;var D=O-A}
192else{M=this.$clipRowToDocument(M),A=this.$clipRowToDocument(A);var D=A-M+1}var B=new a(M,0,A,Number.MAX_VALUE),P=this.getFoldsInRange(B).map(function(W){return W=W.clone(),W.start.row+=D,W.end.row+=D,W}),H=_==0?this.doc.getLines(M,A):this.doc.removeFullLines(M,A);return this.doc.insertFullLines(M+D,H),P.length&&this.addFolds(P),D},R.prototype.moveLinesUp=function(M,A){return this.$moveLines(M,A,-1)},R.prototype.moveLinesDown=function(M,A){return this.$moveLines(M,A,1)},R.prototype.duplicateLines=function(M,A){return this.$moveLines(M,A,0)},R.prototype.$clipRowToDocument=function(M){return Math.max(0,Math.min(M,this.doc.getLength()-1))},R.prototype.$clipColumnToRow=function(M,A){return A<0?0:Math.min(this.doc.getLine(M).length,A)},R.prototype.$clipPositionToDocument=function(M,A){if(A=Math.max(0,A),M<0)M=0,A=0;else{var _=this.doc.getLength();M>=_?(M=_-1,A=this.doc.getLine(_-1).length):A=Math.min(this.doc.getLine(M).length,A)}return{row:M,column:A}},R.prototype.$clipRangeToDocument=function(M){M.start.row<0?(M.start.row=0,M.start.column=0):M.start.column=this.$clipColumnToRow(M.start.row,M.start.column);var A=this.doc.getLength()-1;return M.end.row>A?(M.end.row=A,M.end.column=this.doc.getLine(A).length):M.end.column=this.$clipColumnToRow(M.end.row,M.end.column),M},R.prototype.setUseWrapMode=function(M){if(M!=this.$useWrapMode){if(this.$useWrapMode=M,this.$modified=!0,this.$resetRowCache(0),M){var A=this.getLength();this.$wrapData=Array(A),this.$updateWrapData(0,A-1)}this._signal("changeWrapMode")}},R.prototype.getUseWrapMode=function(){return this.$useWrapMode},R.prototype.setWrapLimitRange=function(M,A){(this.$wrapLimitRange.min!==M||this.$wrapLimitRange.max!==A)&&(this.$wrapLimitRange={min:M,max:A},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},R.prototype.adjustWrapLimit=function(M,A){var _=this.$wrapLimitRange;_.max<0&&(_={min:A,max:A});var O=this.$constrainWrapLimit(M,_.min,_.max);return O!=this.$wrapLimit&&O>1?(this.$wrapLimit=O,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},R.prototype.$constrainWrapLimit=function(M,A,_){return A&&(M=Math.max(A,M)),_&&(M=Math.min(_,M)),M},R.prototype.getWrapLimit=function(){return this.$wrapLimit},R.prototype.setWrapLimit=function(M){this.setWrapLimitRange(M,M)},R.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},R.prototype.$updateInternalDataOnChange=function(M){var A=this.$useWrapMode,_=M.action,O=M.start,D=M.end,B=O.row,P=D.row,H=P-B,W=null;if(this.$updating=!0,H!=0)if(_==="remove"){this[A?"$wrapData":"$rowLengthCache"].splice(B,H);var K=this.$foldData;W=this.getFoldsInRange(M),this.removeFolds(W);var G=this.getFoldLine(D.row),X=0;if(G){G.addRemoveChars(D.row,D.column,O.column-D.column),G.shiftRow(-H);var Z=this.getFoldLine(B);Z&&Z!==G&&(Z.merge(G),G=Z),X=K.indexOf(G)+1}for(X;X<K.length;X++){var G=K[X];G.start.row>=D.row&&G.shiftRow(-H)}P=B}else{var q=Array(H);q.unshift(B,0);var Q=A?this.$wrapData:this.$rowLengthCache;Q.splice.apply(Q,q);var K=this.$foldData,G=this.getFoldLine(B),X=0;if(G){var ie=G.range.compareInside(O.row,O.column);ie==0?(G=G.split(O.row,O.column),G&&(G.shiftRow(H),G.addRemoveChars(P,0,D.column-O.column))):ie==-1&&(G.addRemoveChars(B,0,D.column-O.column),G.shiftRow(H)),X=K.indexOf(G)+1}for(X;X<K.length;X++){var G=K[X];G.start.row>=B&&G.shiftRow(H)}}else{H=Math.abs(M.start.column-M.end.column),_==="remove"&&(W=this.getFoldsInRange(M),this.removeFolds(W),H=-H);var G=this.getFoldLine(B);G&&G.addRemoveChars(B,O.column,H)}return A&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,A?this.$updateWrapData(B,P):this.$updateRowLengthCache(B,P),W},R.prototype.$updateRowLengthCache=function(M,A){this.$rowLengthCache[M]=null,this.$rowLengthCache[A]=null},R.prototype.$updateWrapData=function(M,A){var _=this.doc.getAllLines(),O=this.getTabSize(),D=this.$wrapData,B=this.$wrapLimit,P,H,W=M;for(A=Math.min(A,_.length-1);W<=A;)H=this.getFoldLine(W,H),H?(P=[],H.walk(function(K,G,X,Z){var q;if(K!=null){q=this.$getDisplayTokens(K,P.length),q[0]=C;for(var Q=1;Q<q.length;Q++)q[Q]=E}else q=this.$getDisplayTokens(_[G].substring(Z,X),P.length);P=P.concat(q)}.bind(this),H.end.row,_[H.end.row].length+1),D[H.start.row]=this.$computeWrapSplits(P,B,O),W=H.end.row+1):(P=this.$getDisplayTokens(_[W]),D[W]=this.$computeWrapSplits(P,B,O),W++)},R.prototype.$computeWrapSplits=function(M,A,_){if(M.length==0)return[];var O=[],D=M.length,B=0,P=0,H=this.$wrapAsCode,W=this.$indentedSoftWrap,K=A<=Math.max(2*_,8)||W===!1?0:Math.floor(A/2);function G(){var ie=0;if(K===0)return ie;if(W)for(var ae=0;ae<M.length;ae++){var oe=M[ae];if(oe==k)ie+=1;else if(oe==I)ie+=_;else{if(oe==L)continue;break}}return H&&W!==!1&&(ie+=_),Math.min(ie,K)}function X(ie){for(var ae=ie-B,oe=B;oe<ie;oe++){var fe=M[oe];(fe===12||fe===2)&&(ae-=1)}O.length||(Z=G(),O.indent=Z),P+=ae,O.push(P),B=ie}for(var Z=0;D-B>A-Z;){var q=B+A-Z;if(M[q-1]>=k&&M[q]>=k){X(q);continue}if(M[q]==C||M[q]==E){for(q;q!=B-1&&M[q]!=C;q--);if(q>B){X(q);continue}for(q=B+A,q;q<M.length&&M[q]==E;q++);if(q==M.length)break;X(q);continue}for(var Q=Math.max(q-(A-(A>>2)),B-1);q>Q&&M[q]<C;)q--;if(H){for(;q>Q&&M[q]<C;)q--;for(;q>Q&&M[q]==w;)q--}else for(;q>Q&&M[q]<k;)q--;if(q>Q){X(++q);continue}q=B+A,M[q]==b&&q--,X(q-Z)}return O},R.prototype.$getDisplayTokens=function(M,A){var _=[],O;A=A||0;for(var D=0;D<M.length;
192D++){var B=M.charCodeAt(D);if(B==9){O=this.getScreenTabSize(_.length+A),_.push(I);for(var P=1;P<O;P++)_.push(L)}else B==32?_.push(k):B>39&&B<48||B>57&&B<64?_.push(w):B>=4352&&F(B)?_.push(y,b):_.push(y)}return _},R.prototype.$getStringScreenWidth=function(M,A,_){if(A==0)return[0,0];A==null&&(A=1/0),_=_||0;var O,D;for(D=0;D<M.length&&(O=M.charCodeAt(D),O==9?_+=this.getScreenTabSize(_):O>=4352&&F(O)?_+=2:_+=1,!(_>A));D++);return[_,D]},R.prototype.getRowLength=function(M){var A=1;return this.lineWidgets&&(A+=this.lineWidgets[M]&&this.lineWidgets[M].rowCount||0),!this.$useWrapMode||!this.$wrapData[M]?A:this.$wrapData[M].length+A},R.prototype.getRowLineCount=function(M){return!this.$useWrapMode||!this.$wrapData[M]?1:this.$wrapData[M].length+1},R.prototype.getRowWrapIndent=function(M){if(this.$useWrapMode){var A=this.screenToDocumentPosition(M,Number.MAX_VALUE),_=this.$wrapData[A.row];return _.length&&_[0]<A.column?_.indent:0}else return 0},R.prototype.getScreenLastRowColumn=function(M){var A=this.screenToDocumentPosition(M,Number.MAX_VALUE);return this.documentToScreenColumn(A.row,A.column)},R.prototype.getDocumentLastRowColumn=function(M,A){var _=this.documentToScreenRow(M,A);return this.getScreenLastRowColumn(_)},R.prototype.getDocumentLastRowColumnPosition=function(M,A){var _=this.documentToScreenRow(M,A);return this.screenToDocumentPosition(_,Number.MAX_VALUE/10)},R.prototype.getRowSplitData=function(M){if(this.$useWrapMode)return this.$wrapData[M]},R.prototype.getScreenTabSize=function(M){return this.$tabSize-(M%this.$tabSize|0)},R.prototype.screenToDocumentRow=function(M,A){return this.screenToDocumentPosition(M,A).row},R.prototype.screenToDocumentColumn=function(M,A){return this.screenToDocumentPosition(M,A).column},R.prototype.screenToDocumentPosition=function(M,A,_){if(M<0)return{row:0,column:0};var O,D=0,B=0,P,H=0,W=0,K=this.$screenRowCache,G=this.$getRowCacheIndex(K,M),X=K.length;if(X&&G>=0)var H=K[G],D=this.$docRowCache[G],Z=M>K[X-1];else var Z=!X;for(var q=this.getLength()-1,Q=this.getNextFoldLine(D),ie=Q?Q.start.row:1/0;H<=M&&(W=this.getRowLength(D),!(H+W>M||D>=q));)H+=W,D++,D>ie&&(D=Q.end.row+1,Q=this.getNextFoldLine(D,Q),ie=Q?Q.start.row:1/0),Z&&(this.$docRowCache.push(D),this.$screenRowCache.push(H));if(Q&&Q.start.row<=D)O=this.getFoldDisplayLine(Q),D=Q.start.row;else{if(H+W<=M||D>q)return{row:q,column:this.getLine(q).length};O=this.getLine(D),Q=null}var ae=0,oe=Math.floor(M-H);if(this.$useWrapMode){var fe=this.$wrapData[D];fe&&(P=fe[oe],oe>0&&fe.length&&(ae=fe.indent,B=fe[oe-1]||fe[fe.length-1],O=O.substring(B)))}return _!==void 0&&this.$bidiHandler.isBidiRow(H+oe,D,oe)&&(A=this.$bidiHandler.offsetToCol(_)),B+=this.$getStringScreenWidth(O,A-ae)[1],this.$useWrapMode&&B>=P&&(B=P-1),Q?Q.idxToPosition(B):{row:D,column:B}},R.prototype.documentToScreenPosition=function(M,A){if(typeof A>"u")var _=this.$clipPositionToDocument(M.row,M.column);else _=this.$clipPositionToDocument(M,A);M=_.row,A=_.column;var O=0,D=null,B=null;B=this.getFoldAt(M,A,1),B&&(M=B.start.row,A=B.start.column);var P,H=0,W=this.$docRowCache,K=this.$getRowCacheIndex(W,M),G=W.length;if(G&&K>=0)var H=W[K],O=this.$screenRowCache[K],X=M>W[G-1];else var X=!G;for(var Z=this.getNextFoldLine(H),q=Z?Z.start.row:1/0;H<M;){if(H>=q){if(P=Z.end.row+1,P>M)break;Z=this.getNextFoldLine(P,Z),q=Z?Z.start.row:1/0}else P=H+1;O+=this.getRowLength(H),H=P,X&&(this.$docRowCache.push(H),this.$screenRowCache.push(O))}var Q="";Z&&H>=q?(Q=this.getFoldDisplayLine(Z,M,A),D=Z.start.row):(Q=this.getLine(M).substring(0,A),D=M);var ie=0;if(this.$useWrapMode){var ae=this.$wrapData[D];if(ae){for(var oe=0;Q.length>=ae[oe];)O++,oe++;Q=Q.substring(ae[oe-1]||0,Q.length),ie=oe>0?ae.indent:0}}return this.lineWidgets&&this.lineWidgets[H]&&this.lineWidgets[H].rowsAbove&&(O+=this.lineWidgets[H].rowsAbove),{row:O,column:ie+this.$getStringScreenWidth(Q)[0]}},R.prototype.documentToScreenColumn=function(M,A){return this.documentToScreenPosition(M,A).column},R.prototype.documentToScreenRow=function(M,A){return this.documentToScreenPosition(M,A).row},R.prototype.getScreenLength=function(){var M=0,A=null;if(this.$useWrapMode)for(var D=this.$wrapData.length,B=0,O=0,A=this.$foldData[O++],P=A?A.start.row:1/0;B<D;){var H=this.$wrapData[B];M+=H?H.length+1:1,B++,B>P&&(B=A.end.row+1,A=this.$foldData[O++],P=A?A.start.row:1/0)}else{M=this.getLength();for(var _=this.$foldData,O=0;O<_.length;O++)A=_[O],M-=A.end.row-A.start.row}return this.lineWidgets&&(M+=this.$getWidgetScreenLength()),M},R.prototype.$setFontMetrics=function(M){this.$enableVarChar&&(this.$getStringScreenWidth=function(A,_,O){if(_===0)return[0,0];_||(_=1/0),O=O||0;var D,B;for(B=0;B<A.length&&(D=A.charAt(B),D==="	"?O+=this.getScreenTabSize(O):O+=M.getCharacterWidth(D),!(O>_));B++);return[O,B]})},R.prototype.getPrecedingCharacter=function(){var M=this.selection.getCursor();if(M.column===0)return M.row===0?"":this.doc.getNewLineCharacter();var A=this.getLine(M.row);return A[M.column-1]},R.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("
192changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},R}();m.$uid=0,m.prototype.$modes=i.$modes,m.prototype.getValue=m.prototype.toString,m.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},m.prototype.$overwrite=!1,m.prototype.$mode=null,m.prototype.$modeId=null,m.prototype.$scrollTop=0,m.prototype.$scrollLeft=0,m.prototype.$wrapLimit=80,m.prototype.$useWrapMode=!1,m.prototype.$wrapLimitRange={min:null,max:null},m.prototype.lineWidgets=null,m.prototype.isFullWidth=F,s.implement(m.prototype,d);var y=1,b=2,C=3,E=4,w=9,k=10,I=11,L=12;function F(R){return R<4352?!1:R>=4352&&R<=4447||R>=4515&&R<=4519||R>=4602&&R<=4607||R>=9001&&R<=9002||R>=11904&&R<=11929||R>=11931&&R<=12019||R>=12032&&R<=12245||R>=12272&&R<=12283||R>=12288&&R<=12350||R>=12353&&R<=12438||R>=12441&&R<=12543||R>=12549&&R<=12589||R>=12593&&R<=12686||R>=12688&&R<=12730||R>=12736&&R<=12771||R>=12784&&R<=12830||R>=12832&&R<=12871||R>=12880&&R<=13054||R>=13056&&R<=19903||R>=19968&&R<=42124||R>=42128&&R<=42182||R>=43360&&R<=43388||R>=44032&&R<=55203||R>=55216&&R<=55238||R>=55243&&R<=55291||R>=63744&&R<=64255||R>=65040&&R<=65049||R>=65072&&R<=65106||R>=65108&&R<=65126||R>=65128&&R<=65131||R>=65281&&R<=65376||R>=65504&&R<=65510}t("./edit_session/folding").Folding.call(m.prototype),t("./edit_session/bracket_match").BracketMatch.call(m.prototype),i.defineOptions(m.prototype,"session",{wrap:{set:function(R){if(!R||R=="off"?R=!1:R=="free"?R=!0:R=="printMargin"?R=-1:typeof R=="string"&&(R=parseInt(R,10)||!1),this.$wrap!=R)if(this.$wrap=R,!R)this.setUseWrapMode(!1);else{var M=typeof R=="number"?R:null;this.setWrapLimitRange(M,M),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(R){R=R=="auto"?this.$mode.type!="text":R!="text",R!=this.$wrapAsCode&&(this.$wrapAsCode=R,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(R){this.$useWorker=R,this.$stopWorker(),R&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(R){R=parseInt(R),R>0&&this.$tabSize!==R&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=R,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(R){this.setFoldStyle(R)},handlesSet:!0},overwrite:{set:function(R){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(R){this.doc.setNewLineMode(R)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(R){this.setMode(R)},get:function(){return this.$modeId},handlesSet:!0}}),e.EditSession=m});ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(t,e,r){"use strict";var s=t("./lib/lang"),c=t("./lib/oop"),f=t("./range").Range,i=function(){function a(){this.$options={}}return a.prototype.set=function(l){return c.mixin(this.$options,l),this},a.prototype.getOptions=function(){return s.copyObject(this.$options)},a.prototype.setOptions=function(l){this.$options=l},a.prototype.find=function(l){var u=this.$options,h=this.$matchIterator(l,u);if(!h)return!1;var p=null;return h.forEach(function(g,m,y,b){return p=new f(g,m,y,b),m==b&&u.start&&u.start.start&&u.skipCurrent!=!1&&p.isEqual(u.start)?(p=null,!1):!0}),p},a.prototype.findAll=function(l){var u=this.$options;if(!u.needle)return[];this.$assembleRegExp(u);var h=u.range,p=h?l.getLines(h.start.row,h.end.row):l.doc.getAllLines(),g=[],m=u.re;if(u.$isMultiLine){var y=m.length,b=p.length-y,C;e:for(var E=m.offset||0;E<=b;E++){for(var w=0;w<y;w++)if(p[E+w].search(m[w])==-1)continue e;var k=p[E],I=p[E+y-1],L=k.length-k.match(m[0])[0].length,F=I.match(m[y-1])[0].length;C&&C.end.row===E&&C.end.column>L||(g.push(C=new f(E,L,E+y-1,F)),y>2&&(E=E+y-2))}}else for(var R,M=0;M<p.length;M++)if(this.$isMultilineSearch(u)){var A=p.length-1;if(R=this.$multiLineForward(l,m,M,A),R){var _=R.endRow<=A?R.endRow-1:A;_>M&&(M=_),g.push(new f(R.startRow,R.startCol,R.endRow,R.endCol))}}
192else{R=s.getMatchOffsets(p[M],m);for(var w=0;w<R.length;w++){var O=R[w];g.push(new f(M,O.offset,M,O.offset+O.length))}}if(h){for(var D=h.start.column,B=h.end.column,M=0,w=g.length-1;M<w&&g[M].start.column<D&&g[M].start.row==0;)M++;for(var P=h.end.row-h.start.row;M<w&&g[w].end.column>B&&g[w].end.row==P;)w--;for(g=g.slice(M,w+1),M=0,w=g.length;M<w;M++)g[M].start.row+=h.start.row,g[M].end.row+=h.start.row}return g},a.prototype.parseReplaceString=function(l){for(var u={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},h="",p=0,g=l.length;p<g;p++){var m=l.charCodeAt(p);if(m===u.Backslash){if(p++,p>=g){h+="\\";break}var y=l.charCodeAt(p);switch(y){case u.Backslash:h+="\\";break;case u.n:h+=`
193`;break;case u.t:h+="	";break}continue}if(m===u.DollarSign){if(p++,p>=g){h+="$";break}var b=l.charCodeAt(p);if(b===u.DollarSign){h+="$$";continue}if(b===u.Digit0||b===u.Ampersand){h+="$&";continue}if(u.Digit1<=b&&b<=u.Digit9){h+="$"+l[p];continue}}h+=l[p]}return h||l},a.prototype.replace=function(l,u){var h=this.$options,p=this.$assembleRegExp(h);if(h.$isMultiLine)return u;if(p){var g=this.$isMultilineSearch(h);g&&(l=l.replace(/\r\n|\r|\n/g,`
194`));var m=p.exec(l);if(!m||!g&&m[0].length!=l.length)return null;if(u=h.regExp?this.parseReplaceString(u):u.replace(/\$/g,"$$$$"),u=l.replace(p,u),h.preserveCase){u=u.split("");for(var y=Math.min(l.length,l.length);y--;){var b=l[y];b&&b.toLowerCase()!=b?u[y]=u[y].toUpperCase():u[y]=u[y].toLowerCase()}u=u.join("")}return u}},a.prototype.$assembleRegExp=function(l,u){if(l.needle instanceof RegExp)return l.re=l.needle;var h=l.needle;if(!l.needle)return l.re=!1;l.regExp||(h=s.escapeRegExp(h));var p=l.caseSensitive?"gm":"gmi";try{new RegExp(h,"u"),l.$supportsUnicodeFlag=!0,p+="u"}catch{l.$supportsUnicodeFlag=!1}if(l.wholeWord&&(h=d(h,l)),l.$isMultiLine=!u&&/[\n\r]/.test(h),l.$isMultiLine)return l.re=this.$assembleMultilineRegExp(h,p);try{var g=new RegExp(h,p)}catch{g=!1}return l.re=g},a.prototype.$assembleMultilineRegExp=function(l,u){for(var h=l.replace(/\r\n|\r|\n/g,`$
195^`).split(`
196`),p=[],g=0;g<h.length;g++)try{p.push(new RegExp(h[g],u))}catch{return!1}return p},a.prototype.$isMultilineSearch=function(l){return l.re&&/\\r\\n|\\r|\\n/.test(l.re.source)&&l.regExp&&!l.$isMultiLine},a.prototype.$multiLineForward=function(l,u,h,p){for(var g,m=o(l,h),y=h;y<=p;){for(var b=0;b<m&&!(y>p);b++){var C=l.getLine(y++);g=g==null?C:g+`
197`+C}var E=u.exec(g);if(u.lastIndex=0,E){var w=g.slice(0,E.index).split(`
198`),k=E[0].split(`
199`),I=h+w.length-1,L=w[w.length-1].length,F=I+k.length-1,R=k.length==1?L+k[0].length:k[k.length-1].length;return{startRow:I,startCol:L,endRow:F,endCol:R}}}return null},a.prototype.$multiLineBackward=function(l,u,h,p,g){for(var m,y=o(l,p),b=l.getLine(p).length-h,C=p;C>=g;){for(var E=0;E<y&&C>=g;E++){var w=l.getLine(C--);m=m==null?w:w+`
200`+m}var k=n(m,u,b);if(k){var I=m.slice(0,k.index).split(`
201`),L=k[0].split(`
202`),F=C+I.length,R=I[I.length-1].length,M=F+L.length-1,A=L.length==1?R+L[0].length:L[L.length-1].length;return{startRow:F,startCol:R,endRow:M,endCol:A}}}return null},a.prototype.$matchIterator=function(l,u){var h=this.$assembleRegExp(u);if(!h)return!1;var p=this.$isMultilineSearch(u),g=this.$multiLineForward,m=this.$multiLineBackward,y=u.backwards==!0,b=u.skipCurrent!=!1,C=h.unicode,E=u.range,w=u.start;w||(w=E?E[y?"end":"start"]:l.selection.getRange()),w.start&&(w=w[b!=y?"end":"start"]);var k=E?E.start.row:0,I=E?E.end.row:l.getLength()-1;if(y)var L=function(M){var A=w.row;if(!R(A,w.column,M)){for(A--;A>=k;A--)if(R(A,Number.MAX_VALUE,M))return;if(u.wrap!=!1){for(A=I,k=w.row;A>=k;A--)if(R(A,Number.MAX_VALUE,M))return}}};else var L=function(A){var _=w.row;if(!R(_,w.column,A)){for(_=_+1;_<=I;_++)if(R(_,0,A))return;if(u.wrap!=!1){for(_=k,I=w.row;_<=I;_++)if(R(_,0,A))return}}};if(u.$isMultiLine)var F=h.length,R=function(M,A,_){var O=y?M-F+1:M;if(!(O<0||O+F>l.getLength())){var D=l.getLine(O),B=D.search(h[0]);if(!(!y&&B<A||B===-1)){for(var P=1;P<F;P++)if(D=l.getLine(O+P),D.search(h[P])==-1)return;var H=D.match(h[F-1])[0].length;if(!(y&&H>A)&&_(O,B,O+F-1,H))return!0}}};else if(y)var R=function(A,_,O){if(p){var D=m(l,h,_,A,k);if(!D)return!1;if(O(D.startRow,D.startCol,D.endRow,D.endCol))return!0}else{var B=l.getLine(A),P=[],H,W=0;for(h.lastIndex=0;H=h.exec(B);){var K=H[0].length;if(W=H.index,!K){if(W>=B.length)break;h.lastIndex=W+=s.skipEmptyMatch(B,W,C)}if(H.index+K>_)break;P.push(H.index,K)}for(var G=P.length-1;G>=0;G-=2){var X=P[G-1],K=P[G];if(O(A,X,A,X+K))return!0}}};else var R=function(A,_,O){if(h.lastIndex=_,p){var D=g(l,h,A,I);if(D){var B=D.endRow<=I?D.endRow-1:I;B>A&&(A=B)}if(!D)return!1;if(O(D.startRow,D.startCol,D.endRow,D.endCol))return!0}else for(var P=l.getLine(A),H,W;W=h.exec(P);){var K=W[0].length;if(H=W.index,O(A,H,A,H+K))return!0;
202if(!K&&(h.lastIndex=H+=s.skipEmptyMatch(P,H,C),H>=P.length))return!1}};return{forEach:L}},a}();function d(a,l){var u=s.supportsLookbehind();function h(y,b){b===void 0&&(b=!0);var C=u&&l.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return C.test(y)||l.regExp?u&&l.$supportsUnicodeFlag?b?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var p=Array.from(a),g=p[0],m=p[p.length-1];return h(g)+a+h(m,!1)}function n(a,l,u){for(var h=null,p=0;p<=a.length;){l.lastIndex=p;var g=l.exec(a);if(!g)break;var m=g.index+g[0].length;if(m>a.length-u)break;(!h||m>h.index+h[0].length)&&(h=g),p=g.index+1}return h}function o(a,l){var u=5e3,h={row:l,column:0},p=a.doc.positionToIndex(h),g=p+u,m=a.doc.indexToPosition(g),y=m.row;return y+1}e.Search=i});ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var a=function(l,u){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(h[g]=p[g])},a(l,u)};return function(l,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");a(l,u);function h(){this.constructor=l}l.prototype=u===null?Object.create(u):(h.prototype=u.prototype,new h)}}(),c=t("../lib/keys"),f=t("../lib/useragent"),i=c.KEY_MODS,d=function(){function a(l,u){this.$init(l,u,!1)}return a.prototype.$init=function(l,u,h){this.platform=u||(f.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(l),this.$singleCommand=h},a.prototype.addCommand=function(l){this.commands[l.name]&&this.removeCommand(l),this.commands[l.name]=l,l.bindKey&&this._buildKeyHash(l)},a.prototype.removeCommand=function(l,u){var h=l&&(typeof l=="string"?l:l.name);l=this.commands[h],u||delete this.commands[h];var p=this.commandKeyBinding;for(var g in p){var m=p[g];if(m==l)delete p[g];else if(Array.isArray(m)){var y=m.indexOf(l);y!=-1&&(m.splice(y,1),m.length==1&&(p[g]=m[0]))}}},a.prototype.bindKey=function(l,u,h){if(typeof l=="object"&&l&&(h==null&&(h=l.position),l=l[this.platform]),!!l){if(typeof u=="function")return this.addCommand({exec:u,bindKey:l,name:u.name||l});l.split("|").forEach(function(p){var g="";if(p.indexOf(" ")!=-1){var m=p.split(/\s+/);p=m.pop(),m.forEach(function(C){var E=this.parseKeys(C),w=i[E.hashId]+E.key;g+=(g?" ":"")+w,this._addCommandToBinding(g,"chainKeys")},this),g+=" "}var y=this.parseKeys(p),b=i[y.hashId]+y.key;this._addCommandToBinding(g+b,u,h)},this)}},a.prototype._addCommandToBinding=function(l,u,h){var p=this.commandKeyBinding,g;if(!u)delete p[l];else if(!p[l]||this.$singleCommand)p[l]=u;else{Array.isArray(p[l])?(g=p[l].indexOf(u))!=-1&&p[l].splice(g,1):p[l]=[p[l]],typeof h!="number"&&(h=n(u));var m=p[l];for(g=0;g<m.length;g++){var y=m[g],b=n(y);if(b>h)break}m.splice(g,0,u)}},a.prototype.addCommands=function(l){l&&Object.keys(l).forEach(function(u){var h=l[u];if(h){if(typeof h=="string")return this.bindKey(h,u);typeof h=="function"&&(h={exec:h}),typeof h=="object"&&(h.name||(h.name=u),this.addCommand(h))}},this)},a.prototype.removeCommands=function(l){Object.keys(l).forEach(function(u){this.removeCommand(l[u])},this)},a.prototype.bindKeys=function(l){Object.keys(l).forEach(function(u){this.bindKey(u,l[u])},this)},a.prototype._buildKeyHash=function(l){this.bindKey(l.bindKey,l)},a.prototype.parseKeys=function(l){var u=l.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(b){return b}),h=u.pop(),p=c[h];if(c.FUNCTION_KEYS[p])h=c.FUNCTION_KEYS[p].toLowerCase();else if(u.length){if(u.length==1&&u[0]=="shift")return{key:h.toUpperCase(),hashId:-1}}else return{key:h,hashId:-1};for(var g=0,m=u.length;m--;){var y=c.KEY_MODS[u[m]];if(y==null)return typeof console<"u"&&console.error("invalid modifier "+u[m]+" in "+l),!1;g|=y}return{key:h,hashId:g}},a.prototype.findKeyCommand=function(l,u){var h=i[l]+u;return this.commandKeyBinding[h]},a.prototype.handleKeyboard=function(l,u,h,p){if(!(p<0)){var g=i[u]+h,m=this.commandKeyBinding[g];return l.$keyChain&&(l.$keyChain+=" "+g,m=this.commandKeyBinding[l.$keyChain]||m),m&&(m=="chainKeys"||m[m.length-1]=="chainKeys")?(l.$keyChain=l.$keyChain||g,{command:"null"}):(l.$keyChain&&((!u||u==4)&&h.length==1?l.$keyChain=l.$keyChain.slice(0,-g.length-1):(u==-1||p>0)&&(l.$keyChain="")),{command:m})}},a.prototype.getStatusText=function(l,u){return u.$keyChain||""},a}();function n(a){return typeof a=="object"&&a.bindKey&&a.bindKey.position||(a.isDefault?-100:0)}var o=function(a){s(l,a);function l(u,h){var p=a.call(this,u,h)||this;return p.$singleCommand=!0,p}return l}(d);o.call=function(a,l,u){d.prototype.$init.call(a,l,u,!0)},d.call=function(a,l,u){d.prototype.$init.call(a,l,u,!1)}
202,e.HashHandler=o,e.MultiHashHandler=d});ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var n=function(o,a){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var h in u)Object.prototype.hasOwnProperty.call(u,h)&&(l[h]=u[h])},n(o,a)};return function(o,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");n(o,a);function l(){this.constructor=o}o.prototype=a===null?Object.create(a):(l.prototype=a.prototype,new l)}}(),c=t("../lib/oop"),f=t("../keyboard/hash_handler").MultiHashHandler,i=t("../lib/event_emitter").EventEmitter,d=function(n){s(o,n);function o(a,l){var u=n.call(this,l,a)||this;return u.byName=u.commands,u.setDefaultHandler("exec",function(h){return h.args?h.command.exec(h.editor,h.args,h.event,!1):h.command.exec(h.editor,{},h.event,!0)}),u}return o.prototype.exec=function(a,l,u){if(Array.isArray(a)){for(var h=a.length;h--;)if(this.exec(a[h],l,u))return!0;return!1}typeof a=="string"&&(a=this.commands[a]);var p={editor:l,command:a,args:u};return this.canExecute(a,l)?(p.returnValue=this._emit("exec",p),this._signal("afterExec",p),p.returnValue!==!1):(this._signal("commandUnavailable",p),!1)},o.prototype.canExecute=function(a,l){return typeof a=="string"&&(a=this.commands[a]),!(!a||l&&l.$readOnly&&!a.readOnly||this.$checkCommandState!=!1&&a.isAvailable&&!a.isAvailable(l))},o.prototype.toggleRecording=function(a){if(!this.$inReplay)return a&&a._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(l){this.macro.push([l.command,l.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},o.prototype.replay=function(a){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(a);try{this.$inReplay=!0,this.macro.forEach(function(l){typeof l=="string"?this.exec(l,a):this.exec(l[0],a,l[1])},this)}finally{this.$inReplay=!1}}},o.prototype.trimMacro=function(a){return a.map(function(l){return typeof l[0]!="string"&&(l[0]=l[0].name),l[1]||(l=l[0]),l})},o}(f);c.implement(d.prototype,i),e.CommandManager=d});ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(t,e,r){"use strict";var s=t("../lib/lang"),c=t("../config"),f=t("../range").Range;function i(n,o){return{win:n,mac:o}}e.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:i("Ctrl-,","Command-,"),exec:function(n){c.loadModule("ace/ext/settings_menu",function(o){o.init(n),n.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:i("Alt-E","F4"),exec:function(n){c.loadModule("ace/ext/error_marker",function(o){o.showErrorMarker(n,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:i("Alt-Shift-E","Shift-F4"),exec:function(n){c.loadModule("ace/ext/error_marker",function(o){o.showErrorMarker(n,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:i("Ctrl-A","Command-A"),exec:function(n){n.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:i(null,"Ctrl-L"),exec:function(n){n.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:i("Ctrl-L","Command-L"),exec:function(n,o){typeof o=="number"&&!isNaN(o)&&n.gotoLine(o),n.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:i("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(n){n.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:i("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(n){n.session.toggleFold(!0)}
vendor: 12,413 bytes, line 202
202,multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:i("F2","F2"),exec:function(n){n.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:i("Alt-F2","Alt-F2"),exec:function(n){n.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:i(null,"Ctrl-Command-Option-0"),exec:function(n){n.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:i(null,"Ctrl-Command-Option-0"),exec:function(n){n.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:i("Alt-0","Command-Option-0"),exec:function(n){n.session.foldAll(),n.session.unfold(n.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:i("Alt-Shift-0","Command-Option-Shift-0"),exec:function(n){n.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:i("Ctrl-K","Command-G"),exec:function(n){n.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:i("Ctrl-Shift-K","Command-Shift-G"),exec:function(n){n.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:i("Alt-K","Ctrl-G"),exec:function(n){n.selection.isEmpty()?n.selection.selectWord():n.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:i("Alt-Shift-K","Ctrl-Shift-G"),exec:function(n){n.selection.isEmpty()?n.selection.selectWord():n.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:i("Ctrl-F","Command-F"),exec:function(n){c.loadModule("ace/ext/searchbox",function(o){o.Search(n)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(n){n.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:i("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(n){n.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:i("Ctrl-Home","Command-Home|Command-Up"),exec:function(n){n.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:i("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(n){n.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:i("Up","Up|Ctrl-P"),exec:function(n,o){n.navigateUp(o.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:i("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(n){n.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:i("Ctrl-End","Command-End|Command-Down"),exec:function(n){n.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:i("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(n){n.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:i("Down","Down|Ctrl-N"),exec:function(n,o){n.navigateDown(o.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:i("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(n){n.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:i("Ctrl-Left","Option-Left"),exec:function(n){n.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:i("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(n){n.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:i("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(n){n.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:i("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(n){n.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:i("Left","Left|Ctrl-B"),exec:function(n,o){n.navigateLeft(o.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:i("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(n){n.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:i("Ctrl-Right","Option-Right"),exec:function(n){n.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:i("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(n){n.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:i("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(n){n.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:i("Shift-Right","Shift-Right"),exec:function(n){n.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:i("Right","Right|Ctrl-F"),exec:function(n,o){n.navigateRight(o.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(n){n.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:i(null,"Option-PageDown"),exec:function(n){n.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:i("PageDown","PageDown|Ctrl-V"),exec:function(n){n.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(n){n.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:i(null,"Option-PageUp"),exec:function(n){n.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(n){n.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:i("Ctrl-Up",null),exec:function(n){n.renderer.scrollBy(0,-2*n.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:i("Ctrl-Down",null),exec:function(n){n.renderer.scrollBy(0,2*n.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(n){n.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(n){n.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:i("Ctrl-Alt-E","Command-Option-E"),exec:function(n){n.commands.toggleRecording(n)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:i("Ctrl-Shift-E","Command-Shift-E"),exec:function(n){n.commands.replay(n)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:i("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(n){n.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:i("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(n){n.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:i("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(n){n.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:i(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(n){},readOnly:!0},{name:"cut",description:"Cut",exec:function(n){var o=n.$copyWithEmptySelection&&n.selection.isEmpty(),a=o?n.selection.getLineRange():n.selection.getRange();n._emit("cut",a),a.isEmpty()||n.session.remove(a),n.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(n,o){n.$handlePaste(o)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:i("Ctrl-D","Command-D"),exec:function(n){n.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:i("Ctrl-Shift-D","Command-Shift-D"),exec:function(n){n.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:i("Ctrl-Alt-S","Command-Alt-S"),exec:function(n){n.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:i("Ctrl-/","Command-/"),exec:function(n){n.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:i("Ctrl-Shift-/","Command-Shift-/"),exec:function(n){n.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:i("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(n){n.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:i("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(n){n.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:i("Ctrl-H","Command-Option-F"),exec:function(n){c.loadModule("ace/ext/searchbox",function(o){o.Search(n,!0)})}},{name:"undo",description:"Undo",bindKey:i("Ctrl-Z","Command-Z"),exec:function(n){n.undo()}},{name:"redo",description:"Redo",bindKey:i("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(n){n.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:i("Alt-Shift-Up","Command-Option-Up"),exec:function(n){n.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:i("Alt-Up","Option-Up"),exec:function(n){n.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:i("Alt-Shift-Down","Command-Option-Down"),exec:function(n){n.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:i("Alt-Down","Option-Down"),exec:function(n){n.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:i("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(n){n.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:i("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(n){n.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:i("Shift-Delete",null),exec:function(n){if(n.selection.isEmpty())n.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:i("Alt-Backspace","Command-Backspace"),exec:function(n){n.removeToLineStart()}
vendor: 4,129 bytes, line 202
202,multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:i("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(n){n.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:i("Ctrl-Shift-Backspace",null),exec:function(n){var o=n.selection.getRange();o.start.column=0,n.session.remove(o)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:i("Ctrl-Shift-Delete",null),exec:function(n){var o=n.selection.getRange();o.end.column=Number.MAX_VALUE,n.session.remove(o)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:i("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(n){n.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:i("Ctrl-Delete","Alt-Delete"),exec:function(n){n.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:i("Shift-Tab","Shift-Tab"),exec:function(n){n.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:i("Tab","Tab"),exec:function(n){n.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:i("Ctrl-[","Ctrl-["),exec:function(n){n.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:i("Ctrl-]","Ctrl-]"),exec:function(n){n.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(n,o){n.insert(o)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(n,o){n.insert(s.stringRepeat(o.text||"",o.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:i(null,"Ctrl-O"),exec:function(n){n.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:i("Alt-Shift-X","Ctrl-T"),exec:function(n){n.transposeLetters()},multiSelectAction:function(n){n.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:i("Ctrl-U","Ctrl-U"),exec:function(n){n.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:i("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(n){n.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:i(null,null),exec:function(n){n.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:i("Ctrl-Shift-L","Command-Shift-L"),exec:function(n){var o=n.selection.getRange();o.start.column=o.end.column=0,o.end.row++,n.selection.setRange(o,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:i("Ctrl+F3","F3"),exec:function(n){n.openLink()}},{name:"joinlines",description:"Join lines",bindKey:i(null,null),exec:function(n){for(var o=n.selection.isBackwards(),a=o?n.selection.getSelectionLead():n.selection.getSelectionAnchor(),l=o?n.selection.getSelectionAnchor():n.selection.getSelectionLead(),u=n.session.doc.getLine(a.row).length,h=n.session.doc.getTextRange(n.selection.getRange()),p=h.replace(/\n\s*/," ").length,g=n.session.doc.getLine(a.row),m=a.row+1;m<=l.row+1;m++){var y=s.stringTrimLeft(s.stringTrimRight(n.session.doc.getLine(m)));y.length!==0&&(y=" "+y),g+=y}l.row+1<n.session.doc.getLength()-1&&(g+=n.session.doc.getNewLineCharacter()),n.clearSelection(),n.session.doc.replace(new f(a.row,0,l.row+2,0),g),p>0?(n.selection.moveCursorTo(a.row,a.column),n.selection.selectTo(a.row,a.column+p)):(u=n.session.doc.getLine(a.row).length>u?u+1:u,n.selection.moveCursorTo(a.row,u))}
202,multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:i(null,null),exec:function(n){var o=n.session.doc.getLength()-1,a=n.session.doc.getLine(o).length,l=n.selection.rangeList.ranges,u=[];l.length<1&&(l=[n.selection.getRange()]);for(var h=0;h<l.length;h++)h==l.length-1&&(l[h].end.row===o&&l[h].end.column===a||u.push(new f(l[h].end.row,l[h].end.column,o,a))),h===0?l[h].start.row===0&&l[h].start.column===0||u.push(new f(0,0,l[h].start.row,l[h].start.column)):u.push(new f(l[h-1].end.row,l[h-1].end.column,l[h].start.row,l[h].start.column));n.exitMultiSelectMode(),n.clearSelection();for(var h=0;h<u.length;h++)n.selection.addRange(u[h],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(n){n.selection.clearSelection(),n.navigateLineEnd(),n.insert(`
203`)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(n){n.selection.clearSelection();var o=n.getCursorPosition();n.selection.moveTo(o.row-1,Number.MAX_VALUE),n.insert(`
204`),o.row===0&&n.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(n){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),n.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:i("F1","F1"),exec:function(n){n.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:i(null,null),exec:function(n){n.prompt({$type:"modes"})},readOnly:!0}];for(var d=1;d<9;d++)e.commands.push({name:"foldToLevel"+d,description:"Fold To Level "+d,level:d,exec:function(n){n.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})});ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(t,e,r){"use strict";var s=t("../lib/keys"),c=t("../mouse/default_gutter_handler").GutterTooltip,f=function(){function d(n){this.editor=n,this.gutterLayer=n.renderer.$gutterLayer,this.element=n.renderer.$gutter,this.lines=n.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new c(this.editor)}return d.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},d.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},d.prototype.$onGutterKeyDown=function(n){if(this.annotationTooltip.isOpen){n.preventDefault(),n.keyCode===s.escape&&this.annotationTooltip.hideTooltip();return}if(n.target===this.element){if(n.keyCode!=s.enter)return;n.preventDefault();var o=this.editor.getCursorPosition().row;this.editor.isRowVisible(o)||this.editor.scrollToLine(o,!0,!0),setTimeout(function(){var a=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),l=this.$findNearestFoldLaneWidget(a),u=this.$findNearestAnnotation(a);if(!(l===null&&u===null)){var h=this.$findClosestNumber(l,u,a);if(h===l)if(this.activeLane="fold",this.activeRowIndex=l,this.$isCustomWidgetVisible(l)){this.$focusCustomWidget(this.activeRowIndex);return}else{this.$focusFoldWidget(this.activeRowIndex);return}else{this.activeRowIndex=u,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}}}.bind(this),10);return}this.$handleGutterKeyboardInteraction(n),setTimeout(function(){this.editor._signal("gutterkeydown",new i(n,this))}.bind(this),10)},d.prototype.$handleGutterKeyboardInteraction=function(n){if(n.keyCode===s.tab){n.preventDefault();return}if(n.keyCode===s.escape){n.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(n.keyCode===s.up){switch(n.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp();break}return}if(n.keyCode===s.down){switch(n.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown();break}return}if(n.keyCode===s.left){n.preventDefault(),this.$switchLane("annotation");return}if(n.keyCode===s.right){n.preventDefault(),this.$switchLane("fold");return}if(n.keyCode===s.enter||n.keyCode===s.space){switch(n.preventDefault(),this.activeLane){case"fold":var o=this.$rowIndexToRow(this.activeRowIndex),a=this.editor.session.$gutterCustomWidgets[o];if(a)a.callbacks&&a.callbacks.onClick&&a.callbacks.onClick(n,o);else if(this.gutterLayer.session.foldWidgets[o]==="start"){this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),n),setTimeout(function(){this.$rowIndexToRow(this.activeRowIndex)!==o&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(o),this.$focusFoldWidget(this.activeRowIndex))}.bind(this),10);break}else if(this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]==="end")break;return;case"annotation":var l=this.lines.cells[this.activeRowIndex].element.childNodes[2],u=l.getBoundingClientRect(),h=this.annotationTooltip.getElement().style;h.left=u.right+"px",h.top=u.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex));break}return}},d.prototype.$blurGutter=function(){if(this.activeRowIndex!==null)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex);break}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},d.prototype.$isFoldWidgetVisible=function(n){var o=this.editor.isRowFullyVisible(this.$rowIndexToRow(n)),a=this.$getFoldWidget(n).style.display!=="none";return o&&a},d.prototype.$isCustomWidgetVisible=function(n){var o=this.editor.isRowFullyVisible(this.$rowIndexToRow(n)),a=!!this.$getCustomWidget(n);return o&&a},d.prototype.$isAnnotationVisible=function(n){var o=this.editor.isRowFullyVisible(this.$rowIndexToRow(n)),a=this.$getAnnotation(n).style.display!=="none";return o&&a},d.prototype.$getFoldWidget=function(n){var o=this.lines.get(n),a=o.element;return a.childNodes[1]},d.prototype.$getCustomWidget=function(n){var o=this.lines.get(n),a=o.element;return a.childNodes[3]},d.prototype.$getAnnotation=function(n){var o=this.lines.get(n),a=o.element;return a.childNodes[2]},d.prototype.$findNearestFoldLaneWidget=function(n){if(this.$isCustomWidgetVisible(n)||this.$isFoldWidgetVisible(n))return n;for(var o=0;n-o>0||n+o<this.lines.getLength()-1;){if(o++,n-o>=0&&this.$isCustomWidgetVisible(n-o))return n-o;if(n+o<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(n+o))return n+o;if(n-o>=0&&this.$isFoldWidgetVisible(n-o))return n-o;if(n+o<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(n+o))return n+o}return null},d.prototype.$findNearestAnnotation=function(n){if(this.$isAnnotationVisible(n))return n;for(var o=0;n-o>0||n+o<this.lines.getLength()-1;){if(o++,n-o>=0&&this.$isAnnotationVisible(n-o))return n-o;if(n+o<=this.lines.getLength()-1&&this.$isAnnotationVisible(n+o))return n+o}return null},d.prototype.$focusFoldWidget=function(n){if(n!=null){var o=this.$getFoldWidget(n);o.classList.add(this.editor.renderer.keyboardFocusClassName),o.focus()}},d.prototype.$focusCustomWidget=function(n){if(n!=null){var o=this.$getCustomWidget(n);o&&(o.classList.add(this.editor.renderer.keyboardFocusClassName),o.focus())}},d.prototype.$focusAnnotation=function(n){if(n!=null){var o=this.$getAnnotation(n);o.classList.add(this.editor.renderer.keyboardFocusClassName),o.focus()}},d.prototype.$blurFoldWidget=function(n){var o=this.$getFoldWidget(n);o.classList.remove(this.editor.renderer.keyboardFocusClassName),o.blur()},d.prototype.$blurCustomWidget=function(n){var o=this.$getCustomWidget(n);o&&(o.classList.remove(this.editor.renderer.keyboardFocusClassName),o.blur()
204)},d.prototype.$blurAnnotation=function(n){var o=this.$getAnnotation(n);o.classList.remove(this.editor.renderer.keyboardFocusClassName),o.blur()},d.prototype.$moveFoldWidgetUp=function(){for(var n=this.activeRowIndex;n>0;)if(n--,this.$isFoldWidgetVisible(n)||this.$isCustomWidgetVisible(n)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=n,this.$isFoldWidgetVisible(n)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},d.prototype.$moveFoldWidgetDown=function(){for(var n=this.activeRowIndex;n<this.lines.getLength()-1;)if(n++,this.$isFoldWidgetVisible(n)||this.$isCustomWidgetVisible(n)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=n,this.$isFoldWidgetVisible(n)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},d.prototype.$moveAnnotationUp=function(){for(var n=this.activeRowIndex;n>0;)if(n--,this.$isAnnotationVisible(n)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=n,this.$focusAnnotation(this.activeRowIndex);return}},d.prototype.$moveAnnotationDown=function(){for(var n=this.activeRowIndex;n<this.lines.getLength()-1;)if(n++,this.$isAnnotationVisible(n)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=n,this.$focusAnnotation(this.activeRowIndex);return}},d.prototype.$findClosestNumber=function(n,o,a){return n===null?o:o===null||Math.abs(a-n)<=Math.abs(a-o)?n:o},d.prototype.$switchLane=function(n){switch(n){case"annotation":if(this.activeLane==="annotation")break;var o=this.$findNearestAnnotation(this.activeRowIndex);if(o==null)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=o,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if(this.activeLane==="fold")break;var a=this.$findNearestFoldLaneWidget(this.activeRowIndex);if(a===null)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=a,this.$isCustomWidgetVisible(a)?this.$focusCustomWidget(this.activeRowIndex):this.$focusFoldWidget(this.activeRowIndex);break}},d.prototype.$rowIndexToRow=function(n){var o=this.lines.get(n);return o?o.row:null},d.prototype.$rowToRowIndex=function(n){for(var o=0;o<this.lines.getLength();o++){var a=this.lines.get(o);if(a.row==n)return o}return null},d}();e.GutterKeyboardHandler=f;var i=function(){function d(n,o){this.gutterKeyboardHandler=o,this.domEvent=n}return d.prototype.getKey=function(){return s.keyCodeToString(this.domEvent.keyCode)},d.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},d.prototype.isInAnnotationLane=function(){return this.gutterKeyboardHandler.activeLane==="annotation"},d.prototype.isInFoldLane=function(){return this.gutterKeyboardHandler.activeLane==="fold"},d}();e.GutterKeyboardEvent=i});ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys","ace/lib/event","ace/tooltip"],function(t,e,r){"use strict";var s=this&&this.__values||function(A){var _=typeof Symbol=="function"&&Symbol.iterator,O=_&&A[_],D=0;if(O)return O.call(A);if(A&&typeof A.length=="number")return{next:function(){return A&&D>=A.length&&(A=void 0),{value:A&&A[D++],done:!A}}};throw new TypeError(_?"Object is not iterable.":"Symbol.iterator is not defined.")},c=t("./lib/oop"),f=t("./lib/dom"),i=t("./lib/lang"),d=t("./lib/useragent"),n=t("./keyboard/textinput").TextInput,o=t("./mouse/mouse_handler").MouseHandler,a=t("./mouse/fold_handler").FoldHandler,l=t("./keyboard/keybinding").KeyBinding,u=t("./edit_session").EditSession,h=t("./search").Search,p=t("./range").Range,g=t("./lib/event_emitter").EventEmitter,m=t("./commands/command_manager").CommandManager,y=t("./commands/default_commands").commands,b=t("./config"),C=t("./token_iterator").TokenIterator,E=t("./keyboard/gutter_handler").GutterKeyboardHandler,w=t("./config").nls,k=t("./clipboard"),I=t("./lib/keys"),L=t("./lib/event"),F=t("./tooltip").HoverTooltip,R=function(){function A(_,O,D){this.session,this.$toDestroy=[];var B=_.getContainerElement();this.container=B,this.renderer=_,this.id="editor"+ ++A.$uid,this.commands=new m(d.isMac?"mac":"win",y),typeof document=="object"&&(this.textInput=new n(_.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new o(this),new a(this)),this.keyBinding=new l(this),this.$search=new h().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=i.delayedCall(function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}
204.bind(this)),this.on("change",function(P,H){H._$emitInputEvent.schedule(31)}),this.setSession(O||D&&D.session||new u("")),b.resetOptions(this),D&&this.setOptions(D),b._signal("editor",this)}return A.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},A.prototype.startOperation=function(_){this.session.startOperation(_)},A.prototype.endOperation=function(_){this.session.endOperation(_)},A.prototype.onStartOperation=function(_){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,_||(this.previousCommand=null)},A.prototype.onEndOperation=function(_){if(this.curOp&&this.session){if(_&&_.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var O=this.curOp.command,D=O&&O.scrollIntoView;if(D){switch(D){case"center-animate":D="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var B=this.selection.getRange(),P=this.renderer.layerConfig;(B.start.row>=P.lastRow||B.end.row<=P.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:break}D=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},A.prototype.$historyTracker=function(_){if(this.$mergeUndoDeltas){var O=this.prevOp,D=this.$mergeableCommands,B=O.command&&_.command.name==O.command.name;if(_.command.name=="insertstring"){var P=_.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),B=B&&this.mergeNextCommand&&(!/\s/.test(P)||/\s/.test(O.args)),this.mergeNextCommand=!0}else B=B&&D.indexOf(_.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(B=!1),B?this.session.mergeUndoDeltas=!0:D.indexOf(_.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},A.prototype.setKeyboardHandler=function(_,O){if(_&&typeof _=="string"&&_!="ace"){this.$keybindingId=_;var D=this;b.loadModule(["keybinding",_],function(B){D.$keybindingId==_&&D.keyBinding.setKeyboardHandler(B&&B.handler),O&&O()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(_),O&&O()},A.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},A.prototype.setSession=function(_){if(this.session!=_){this.curOp&&this.endOperation(),this.curOp={};var O=this.session;if(O){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var D=this.session.getSelection();D.off("changeCursor",this.$onCursorChange),D.off("changeSelection",this.$onSelectionChange)}this.session=_,_?(this.$onDocumentChange=this.onDocumentChange.bind(this),_.on("change",this.$onDocumentChange),this.renderer.setSession(_),this.$onChangeMode=this.onChangeMode.bind(this),_.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),_.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),_.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),_.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),_.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),_.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=_.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(_)),this._signal("changeSession",{session:_,oldSession:O}),this.curOp=null,O&&O._signal("changeEditor",{oldEditor:this}),O&&(O.$editor=null),_&&_._signal("changeEditor",{editor:this}),_&&(_.$editor=this),_&&!_.destroyed&&_.bgTokenizer.scheduleStart()}},A.prototype.getSession=function(){return this.session},A.prototype.setValue=function(_,O){return this.session.doc.setValue(_),O?O==1?this.navigateFileEnd():O==-1&&this.navigateFileStart():this.selectAll(),_},A.prototype.getValue=function(){return this.session.getValue()},A.prototype.getSelection=function(){return this.selection},A.prototype.resize=function(_){this.renderer.onResize(_)},A.prototype.setTheme=function(_,O){this.renderer.setTheme(_,O)},A.prototype.getTheme=function(){return this.renderer.getTheme()},A.prototype.setStyle=function(_){this.renderer.setStyle(_)},A.prototype.unsetStyle=function(_){this.renderer.unsetStyle(_)},A.prototype.getFontSize=function(){return this.getOption("fontSize")||f.computedStyle(this.container).fontSize},A.prototype.setFontSize=function(_){this.setOption("fontSize",_)},A.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var _=this;this.$highlightPending=!0,setTimeout(function(){_.$highlightPending=!1;var O=_.session;if(!(!O||O.destroyed)){O.$bracketHighlight&&(O.$bracketHighlight.markerIds.forEach(function(Z){O.removeMarker(Z)}),O.$bracketHighlight=null);var D=_.getCursorPosition(),B=_.getKeyboardHandler(),P=B&&B.$getDirectionForHighlight&&B.$getDirectionForHighlight(_),H=O.getMatchingBracketRanges(D,P);if(!H){var W=new C(O,D.row,D.column),K=W.getCurrentToken();if(K&&/\b(?:tag-open|tag-name)/.test(K.type)){var G=O.getMatchingTags(D);G&&(H=[G.openTagName.isEmpty()?G.openTag:G.openTagName,G.closeTagName.isEmpty()?G.closeTag:G.closeTagName])}}if(!H&&O.$mode.getMatching&&(H=O.$mode.getMatching(_.session)),!H){_.getHighlightIndentGuides()&&_.renderer.$textLayer.$highlightIndentGuide();return}var X="ace_bracket";Array.isArray(H)?H.length==1&&(X="ace_error_bracket"):H=[H],H.length==2&&(p.c
204omparePoints(H[0].end,H[1].start)==0?H=[p.fromPoints(H[0].start,H[1].end)]:p.comparePoints(H[0].start,H[1].end)==0&&(H=[p.fromPoints(H[1].start,H[0].end)])),O.$bracketHighlight={ranges:H,markerIds:H.map(function(Z){return O.addMarker(Z,X,"text")})},_.getHighlightIndentGuides()&&_.renderer.$textLayer.$highlightIndentGuide()}},50)}},A.prototype.focus=function(){this.textInput.focus()},A.prototype.isFocused=function(){return this.textInput.isFocused()},A.prototype.blur=function(){this.textInput.blur()},A.prototype.onFocus=function(_){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",_))},A.prototype.onBlur=function(_){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",_))},A.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},A.prototype.onDocumentChange=function(_){var O=this.session.$useWrapMode,D=_.start.row==_.end.row?_.end.row:1/0;this.renderer.updateLines(_.start.row,D,O),this._signal("change",_),this.$cursorChange()},A.prototype.onTokenizerUpdate=function(_){var O=_.data;this.renderer.updateLines(O.first,O.last)},A.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},A.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},A.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},A.prototype.$updateHighlightActiveLine=function(){var _=this.getSession(),O;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(O=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(O=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(O=!1)),_.$highlightLineMarker&&!O)_.removeMarker(_.$highlightLineMarker.id),_.$highlightLineMarker=null;else if(!_.$highlightLineMarker&&O){var D=new p(O.row,O.column,O.row,1/0);D.id=_.addMarker(D,"ace_active-line","screenLine"),_.$highlightLineMarker=D}else O&&(_.$highlightLineMarker.start.row=O.row,_.$highlightLineMarker.end.row=O.row,_.$highlightLineMarker.start.column=O.column,_._signal("changeBackMarker"))},A.prototype.onSelectionChange=function(_){var O=this.session;if(O.$selectionMarker&&O.removeMarker(O.$selectionMarker),O.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var D=this.selection.getRange(),B=this.getSelectionStyle();O.$selectionMarker=O.addMarker(D,"ace_selection",B)}var P=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(P),this._signal("changeSelection")},A.prototype.$getSelectionHighLightRegexp=function(){var _=this.session,O=this.getSelectionRange();if(!(O.isEmpty()||O.isMultiLine())){var D=O.start.column,B=O.end.column,P=_.getLine(O.start.row),H=P.substring(D,B);if(!(H.length>5e3||!/[\w\d]/.test(H))){var W=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:H}),K=P.substring(D-1,B+1);if(W.test(K))return W}}},A.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},A.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},A.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},A.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},A.prototype.onChangeMode=function(_){this.renderer.updateText(),this._emit("changeMode",_)},A.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},A.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},A.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},A.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},A.prototype.getCopyText=function(){var _=this.getSelectedText(),O=this.session.doc.getNewLineCharacter(),D=!1;if(!_&&this.$copyWithEmptySelection){D=!0;for(var B=this.selection.getAllRanges(),P=0;P<B.length;P++){var H=B[P];P&&B[P-1].start.row==H.start.row||(_+=this.session.getLine(H.start.row)+O)}}var W={text:_};return this._signal("copy",W),k.lineMode=D?W.text:!1,W.text},A.prototype.onCopy=function(){this.commands.exec("copy",this)},A.prototype.onCut=function(){this.commands.exec("cut",this)},A.prototype.onPaste=function(_,O){var D={text:_,event:O};this.commands.exec("paste",this,D)},A.prototype.$handlePaste=function(_){typeof _=="string"&&(_={text:_}),this._signal("paste",_);var O=_.text,D=O===k.lineMode,B=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)D?B.insert({row:this.selection.lead.row,column:0},O):this.insert(O);
204else if(D)this.selection.rangeList.ranges.forEach(function(X){B.insert({row:X.start.row,column:0},O)});else{var P=O.split(/\r\n|\r|\n/),H=this.selection.rangeList.ranges,W=P.length==2&&(!P[0]||!P[1]);if(P.length!=H.length||W)return this.commands.exec("insertstring",this,O);for(var K=H.length;K--;){var G=H[K];G.isEmpty()||B.remove(G),B.insert(G.start,P[K])}}},A.prototype.execCommand=function(_,O){return this.commands.exec(_,this,O)},A.prototype.insert=function(_,O){var D=this.session,B=D.getMode(),P=this.getCursorPosition();if(this.getBehavioursEnabled()&&!O){var H=B.transformAction(D.getState(P.row),"insertion",this,D,_);H&&(_!==H.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),_=H.text)}if(_=="	"&&(_=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&_.indexOf(`
205`)==-1){var W=p.fromPoints(P,P);W.end.column+=_.length,this.session.remove(W)}}else{var W=this.getSelectionRange();P=this.session.remove(W),this.clearSelection()}if(_==`
206`||_==`\r
207`){var Z=D.getLine(P.row);if(P.column>Z.search(/\S|$/)){var K=Z.substr(P.column).search(/\S|$/);D.doc.removeInLine(P.row,P.column,P.column+K)}}this.clearSelection();var G=P.column,X=D.getState(P.row),Z=D.getLine(P.row),q=B.checkOutdent(X,Z,_);if(D.insert(P,_),H&&H.selection&&(H.selection.length==2?this.selection.setSelectionRange(new p(P.row,G+H.selection[0],P.row,G+H.selection[1])):this.selection.setSelectionRange(new p(P.row+H.selection[0],H.selection[1],P.row+H.selection[2],H.selection[3]))),this.$enableAutoIndent){if(D.getDocument().isNewLine(_)){var Q=B.getNextLineIndent(X,Z.slice(0,P.column),D.getTabString());D.insert({row:P.row+1,column:0},Q)}q&&B.autoOutdent(X,D,P.row)}},A.prototype.autoIndent=function(){for(var _=this.session,O=_.getMode(),D=this.selection.isEmpty()?[new p(0,0,_.doc.getLength()-1,0)]:this.selection.getAllRanges(),B="",P="",H="",W=_.getTabString(),K=0;K<D.length;K++)for(var G=D[K].start.row,X=D[K].end.row,Z=G;Z<=X;Z++){Z>0&&(B=_.getState(Z-1),P=_.getLine(Z-1),H=O.getNextLineIndent(B,P,W));var q=_.getLine(Z),Q=O.$getIndent(q);if(H!==Q){if(Q.length>0){var ie=new p(Z,0,Z,Q.length);_.remove(ie)}H.length>0&&_.insert({row:Z,column:0},H)}O.autoOutdent(B,_,Z)}},A.prototype.onTextInput=function(_,O){if(!O)return this.keyBinding.onTextInput(_);this.startOperation({command:{name:"insertstring"}});var D=this.applyComposition.bind(this,_,O);this.selection.rangeCount?this.forEachSelection(D):D(),this.endOperation()},A.prototype.applyComposition=function(_,O){if(O.extendLeft||O.extendRight){var D=this.selection.getRange();D.start.column-=O.extendLeft,D.end.column+=O.extendRight,D.start.column<0&&(D.start.row--,D.start.column+=this.session.getLine(D.start.row).length+1),this.selection.setRange(D),!_&&!D.isEmpty()&&this.remove()}if((_||!this.selection.isEmpty())&&this.insert(_,!0),O.restoreStart||O.restoreEnd){var D=this.selection.getRange();D.start.column-=O.restoreStart,D.end.column-=O.restoreEnd,this.selection.setRange(D)}},A.prototype.onCommandKey=function(_,O,D){return this.keyBinding.onCommandKey(_,O,D)},A.prototype.setOverwrite=function(_){this.session.setOverwrite(_)},A.prototype.getOverwrite=function(){return this.session.getOverwrite()},A.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},A.prototype.setScrollSpeed=function(_){this.setOption("scrollSpeed",_)},A.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},A.prototype.setDragDelay=function(_){this.setOption("dragDelay",_)},A.prototype.getDragDelay=function(){return this.getOption("dragDelay")},A.prototype.setSelectionStyle=function(_){this.setOption("selectionStyle",_)},A.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},A.prototype.setHighlightActiveLine=function(_){this.setOption("highlightActiveLine",_)},A.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},A.prototype.setHighlightGutterLine=function(_){this.setOption("highlightGutterLine",_)},A.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},A.prototype.setHighlightSelectedWord=function(_){this.setOption("highlightSelectedWord",_)},A.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},A.prototype.setAnimatedScroll=function(_){this.renderer.setAnimatedScroll(_)},A.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},A.prototype.setShowInvisibles=function(_){this.renderer.setShowInvisibles(_)},A.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},A.prototype.setDisplayIndentGuides=function(_){this.renderer.setDisplayIndentGuides(_)},A.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},A.prototype.setHighlightIndentGuides=function(_){this.renderer.setHighlightIndentGuides(_)},A.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},A.prototype.setShowPrintMargin=function(_){this.renderer.setShowPrintMargin(_)},A.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},A.prototype.setPrintMarginColumn=function(_){this.renderer.setPrintMarginColumn(_)},A.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},A.prototype.setReadOnly=function(_){this.setOption("readOnly",_)},A.prototype.getReadOnly=function(){return this.getOption("readOnly")},A.prototype.setBehavioursEnabled=function(_){this.setOption("behavioursEnabled",_)},A.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},A.prototype.setWrapBehavioursEnabled=function(_){this.setOption("wrapBehavioursEnabled",_)},A.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},A.prototype.setShowFoldWidgets=function(_){this.setOption("showFoldWidgets",_)},A.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},A.prototype.setFadeFoldWidgets=function(_){this.setOption("fadeFoldWidgets",_)},A.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},A.prototype.remove=function(_){this.selection.isEmpty()&&(_=="left"?this.selection.selectLeft():this.selection.selectRight());var O=this.getSelectionRange();if(this.getBehavioursEnabled()){var D=this.session,B=D.getState(O.start.row),P=D.getMode().transformAction(B,"deletion",this,D,O);if(O.end.column===0){var H=D.getTextRange(O);if(H[H.length-1]==`
208`){var W=D.getLine(O.end.row);/^\s+$/.test(W)&&(O.end.column=W.length)}}P&&(O=P)}this.session.remove(O),this.clearSelection()},A.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},A.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},A.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},A.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var _=this.getSelectionRange();_.start.column==_.end.column&&_.start.row==_.end.row&&(_.end.column=0,_.end.row++),this.session.remove(_),this.clearSelection()},A.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var _=this.getCursorPosition();this.insert(`
209`),this.moveCursorToPosition(_)},A.prototype.setGhostText=function(_,O){this.renderer.setGhostText(_,O)},A.prototype.removeGhostText=function(){this.renderer.removeGhostText()},A.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var _=this.getCursorPosition(),O=_.column;if(O!==0){var D=this.session.getLine(_.row),B,P;O<D.length?(B=D.charAt(O)+D.charAt(O-1),P=new p(_.row,O-1,_.row,O+1)):(B=D.charAt(O-1)+D.charAt(O-2),P=new p(_.row,O-2,_.row,O)),this.session.replace(P,B),this.session.selection.moveToPosition(P.end)}}},A.prototype.toLowerCase=function(){var _=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var O=this.getSelectionRange(),D=this.session.getTextRange(O);this.session.replace(O,D.toLowerCase()),this.selection.setSelectionRange(_)},A.prototype.toUpperCase=function(){var _=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var O=this.getSelectionRange(),D=this.session.getTextRange(O);this.session.replace(O,D.toUpperCase()),this.selection.setSelectionRange(_)},A.prototype.indent=function(){var _=this.session,O=this.getSelectionRange();if(O.start.row<O.end.row){var D=this.$getSelectedRows();_.indentRows(D.first,D.last,"	");return}else if(O.start.column<O.end.column){var B=_.getTextRange(O);
209if(!/^\s+$/.test(B)){var D=this.$getSelectedRows();_.indentRows(D.first,D.last,"	");return}}var P=_.getLine(O.start.row),H=O.start,W=_.getTabSize(),K=_.documentToScreenColumn(H.row,H.column);if(this.session.getUseSoftTabs())var G=W-K%W,X=i.stringRepeat(" ",G);else{for(var G=K%W;P[O.start.column-1]==" "&&G;)O.start.column--,G--;this.selection.setSelectionRange(O),X="	"}return this.insert(X)},A.prototype.blockIndent=function(){var _=this.$getSelectedRows();this.session.indentRows(_.first,_.last,"	")},A.prototype.blockOutdent=function(){var _=this.session.getSelection();this.session.outdentRows(_.getRange())},A.prototype.sortLines=function(){for(var _=this.$getSelectedRows(),O=this.session,D=[],B=_.first;B<=_.last;B++)D.push(O.getLine(B));D.sort(function(W,K){return W.toLowerCase()<K.toLowerCase()?-1:W.toLowerCase()>K.toLowerCase()?1:0});for(var P=new p(0,0,0,0),B=_.first;B<=_.last;B++){var H=O.getLine(B);P.start.row=B,P.end.row=B,P.end.column=H.length,O.replace(P,D[B-_.first])}},A.prototype.toggleCommentLines=function(){var _=this.session.getState(this.getCursorPosition().row),O=this.$getSelectedRows();this.session.getMode().toggleCommentLines(_,this.session,O.first,O.last)},A.prototype.toggleBlockComment=function(){var _=this.getCursorPosition(),O=this.session.getState(_.row),D=this.getSelectionRange();this.session.getMode().toggleBlockComment(O,this.session,D,_)},A.prototype.getNumberAt=function(_,O){var D=/[\-]?[0-9]+(?:\.[0-9]+)?/g;D.lastIndex=0;for(var B=this.session.getLine(_);D.lastIndex<O;){var P=D.exec(B);if(P.index<=O&&P.index+P[0].length>=O){var H={value:P[0],start:P.index,end:P.index+P[0].length};return H}}return null},A.prototype.modifyNumber=function(_){var O=this.selection.getCursor().row,D=this.selection.getCursor().column,B=new p(O,D-1,O,D),P=this.session.getTextRange(B);if(!isNaN(parseFloat(P))&&isFinite(P)){var H=this.getNumberAt(O,D);if(H){var W=H.value.indexOf(".")>=0?H.start+H.value.indexOf(".")+1:H.end,K=H.start+H.value.length-W,G=parseFloat(H.value);G*=Math.pow(10,K),W!==H.end&&D<W?_*=Math.pow(10,H.end-D-1):_*=Math.pow(10,H.end-D),G+=_,G/=Math.pow(10,K);var X=G.toFixed(K),Z=new p(O,H.start,O,H.end);this.session.replace(Z,X),this.moveCursorTo(O,Math.max(H.start+1,D+X.length-H.value.length))}}else this.toggleWord()},A.prototype.toggleWord=function(){var _=this.selection.getCursor().row,O=this.selection.getCursor().column;this.selection.selectWord();var D=this.getSelectedText(),B=this.selection.getWordRange().start.column,P=D.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),H=O-B-1;H<0&&(H=0);var W=0,K=0,G=this;D.match(/[A-Za-z0-9_]+/)&&P.forEach(function(he,xe){K=W+he.length,H>=W&&H<=K&&(D=he,G.selection.clearSelection(),G.moveCursorTo(_,W+B),G.selection.selectTo(_,K+B)),W=K});for(var X=this.$toggleWordPairs,Z,q=0;q<X.length;q++)for(var Q=X[q],ie=0;ie<=1;ie++){var ae=+!ie,oe=D.match(new RegExp("^\\s?_?("+i.escapeRegExp(Q[ie])+")\\s?$","i"));if(oe){var fe=D.match(new RegExp("([_]|^|\\s)("+i.escapeRegExp(oe[1])+")($|\\s)","g"));fe&&(Z=D.replace(new RegExp(i.escapeRegExp(Q[ie]),"i"),function(he){var xe=Q[ae];return he.toUpperCase()==he?xe=xe.toUpperCase():he.charAt(0).toUpperCase()==he.charAt(0)&&(xe=xe.substr(0,0)+Q[ae].charAt(0).toUpperCase()+xe.substr(1)),xe}),this.insert(Z),Z="")}}},A.prototype.findLinkAt=function(_,O){var D,B,P=this.session.getLine(_),H=P.split(/((?:https?|ftp):\/\/[\S]+)/),W=O;W<0&&(W=0);var K=0,G=0,X;try{for(var Z=s(H),q=Z.next();!q.done;q=Z.next()){var Q=q.value;if(G=K+Q.length,W>=K&&W<=G&&Q.match(/((?:https?|ftp):\/\/[\S]+)/)){X=Q.replace(/[\s:.,'";}\]]+$/,"");break}K=G}}catch(ie){D={error:ie}}finally{try{q&&!q.done&&(B=Z.return)&&B.call(Z)}finally{if(D)throw D.error}}return X},A.prototype.openLink=function(){var _=this.selection.getCursor(),O=this.findLinkAt(_.row,_.column);return O&&window.open(O,"_blank"),O!=null},A.prototype.removeLines=function(){var _=this.$getSelectedRows();this.session.removeFullLines(_.first,_.last),this.clearSelection()},A.prototype.duplicateSelection=function(){var _=this.selection,O=this.session,D=_.getRange(),B=_.isBackwards();if(D.isEmpty()){var P=D.start.row;O.duplicateLines(P,P)}else{var H=B?D.start:D.end,W=O.insert(H,O.getTextRange(D));D.start=H,D.end=W,_.setSelectionRange(D,B)}},A.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},A.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},A.prototype.moveText=function(_,O,D){return this.session.moveText(_,O,D)}
209,A.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},A.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},A.prototype.$moveLines=function(_,O){var D,B,P=this.selection;if(!P.inMultiSelectMode||this.inVirtualSelectionMode){var H=P.toOrientedRange();D=this.$getSelectedRows(H),B=this.session.$moveLines(D.first,D.last,O?0:_),O&&_==-1&&(B=0),H.moveBy(B,0),P.fromOrientedRange(H)}else{var W=P.rangeList.ranges;P.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var K=0,G=0,X=W.length,Z=0;Z<X;Z++){var q=Z;W[Z].moveBy(K,0),D=this.$getSelectedRows(W[Z]);for(var Q=D.first,ie=D.last;++Z<X;){G&&W[Z].moveBy(G,0);var ae=this.$getSelectedRows(W[Z]);if(O&&ae.first!=ie)break;if(!O&&ae.first>ie+1)break;ie=ae.last}for(Z--,K=this.session.$moveLines(Q,ie,O?0:_),O&&_==-1&&(q=Z+1);q<=Z;)W[q].moveBy(K,0),q++;O||(K=0),G+=K}P.fromOrientedRange(P.ranges[0]),P.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},A.prototype.$getSelectedRows=function(_){return _=(_||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(_.start.row),last:this.session.getRowFoldEnd(_.end.row)}},A.prototype.onCompositionStart=function(_){this.renderer.showComposition(_)},A.prototype.onCompositionUpdate=function(_){this.renderer.setCompositionText(_)},A.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},A.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},A.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},A.prototype.isRowVisible=function(_){return _>=this.getFirstVisibleRow()&&_<=this.getLastVisibleRow()},A.prototype.isRowFullyVisible=function(_){return _>=this.renderer.getFirstFullyVisibleRow()&&_<=this.renderer.getLastFullyVisibleRow()},A.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},A.prototype.$moveByPage=function(_,O){var D=this.renderer,B=this.renderer.layerConfig,P=_*Math.floor(B.height/B.lineHeight);O===!0?this.selection.$moveSelection(function(){this.moveCursorBy(P,0)}):O===!1&&(this.selection.moveCursorBy(P,0),this.selection.clearSelection());var H=D.scrollTop;D.scrollBy(0,P*B.lineHeight),O!=null&&D.scrollCursorIntoView(null,.5),D.animateScrolling(H)},A.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},A.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},A.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},A.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},A.prototype.scrollPageDown=function(){this.$moveByPage(1)},A.prototype.scrollPageUp=function(){this.$moveByPage(-1)},A.prototype.scrollToRow=function(_){this.renderer.scrollToRow(_)},A.prototype.scrollToLine=function(_,O,D,B){this.renderer.scrollToLine(_,O,D,B)},A.prototype.centerSelection=function(){var _=this.getSelectionRange(),O={row:Math.floor(_.start.row+(_.end.row-_.start.row)/2),column:Math.floor(_.start.column+(_.end.column-_.start.column)/2)};this.renderer.alignCursor(O,.5)},A.prototype.getCursorPosition=function(){return this.selection.getCursor()},A.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},A.prototype.getSelectionRange=function(){return this.selection.getRange()},A.prototype.selectAll=function(){this.selection.selectAll()},A.prototype.clearSelection=function(){this.selection.clearSelection()},A.prototype.moveCursorTo=function(_,O){this.selection.moveCursorTo(_,O)},A.prototype.moveCursorToPosition=function(_){this.selection.moveCursorToPosition(_)},A.prototype.jumpToMatching=function(_,O){var D=this.getCursorPosition(),B=new C(this.session,D.row,D.column),P=B.getCurrentToken(),H=0;P&&P.type.indexOf("tag-name")!==-1&&(P=B.stepBackward());var W=P||B.stepForward();if(W){var K,G=!1,X={},Z=D.column-W.start,q,Q={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(W.value.match(/[{}()\[\]]/g)){for(;Z<W.value.length&&!G;Z++)if(Q[W.value[Z]])switch(q=Q[W.value[Z]]+"."+W.type.replace("rparen","lparen"),isNaN(X[q])&&(X[q]=0),W.value[Z]){case"(":case"[":case"{":X[q]++;break;case")":case"]":case"}":X[q]--,X[q]===-1&&(K="bracket",G=!0);break}}else W.type.indexOf("tag-name")!==-1&&(isNaN(X[W.value])&&(X[W.value]=0),P.value==="<"&&H>1?X[W.value]++:P.value==="</"&&X[W.value]--,X[W.value]===-1&&(K="tag",G=!0));G||(P=W,H++,W=B.stepForward(),Z=0)}while(W&&!G);if(K){var ie,ae;if(K==="bracket")ie=this.session.getBracketRange(D),ie||(ie=new p(B.getCurrentTokenRow(),B.getCurrentTokenColumn()+Z-1,B.getCurrentTokenRow(),B.getCurrentTokenColumn()+Z-1),ae=ie.start,(O||ae.row===D.row&&Math.abs(ae.column-D.column)<2)&&(ie=this.session.getBracketRange(ae)));else if(K==="tag"){if(!W||W.type.indexOf("tag-name")===-1)return;if(ie=new p(B.getCurrentTokenRow(),B.getCurrentTokenColumn()-2,B.getCurrentTokenRow(),B.getCurrentTokenColumn()-2),ie.compare(D.row,D.column)===0){var oe=this.session.getMatchingTags(D);oe&&(oe.openTag.contains(D.row,D.column)?(ie=oe.closeTag,ae=ie.start):(ie=oe.openTag,oe.closeTag.start.row===D.row&&oe.closeTag.start.column===D.column?ae=ie.end:ae=ie.start))}ae=ae||ie.start}ae=ie&&ie.cursor||ae,ae&&(_?ie&&O?this.selection.setRange(ie):ie&&ie.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(ae.row,ae.column):this.selection.moveTo(ae.row,ae.column))}}},A.prototype.gotoLine=function(_,O,D){this.selection.clearSelection(),this.session.unfold({row:_-1,column:O||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(_-1,O||0),this.isRowFullyVisible(_-1)||this.scrollToLine(_-1,!0,D)},A.prototype.navigateTo=function(_,O){this.selection.moveTo(_,O)},A.prototype.navigateUp=function(_){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var O=this.selection.anchor.getPosition();return this.moveCursorToPosition(O)}this.selection.clearSelection(),this.selection.moveCursorBy(-_||-1,0)},A.prototype.navigateDown=function(_){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var O=this.selection.anchor.getPosition();return this.moveCursorToPosition(O)}this.selection.clearSelection(),this.selection.moveCursorBy(_||1,0)},A.prototype.navigateLeft=function(_){if(this.selection.isEmpty())for(_=_||1;_--;)this.selection.moveCursorLeft();else{var O=this.getSelectionRange().start;this.moveCursorToPosition(O)}this.clearSelection()},A.prototype.navigateRight=function(_){if(this.selection.isEmpty())for(_=_||1;_--;)this.selection.moveCursorRight();else{var O=this.getSelectionRange().end;this.moveCursorToPosition(O)}this.clearSelection()},A.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},A.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},A.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},A.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},A.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},A.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},A.prototype.replace=function(_,O){O&&this.$search.set(O);var D=this.$search.find(this.session),B=0;return D&&(this.$tryReplace(D,_)&&(B=1),this.selection.setSelectionRange(D),this.renderer.scrollSelectionIntoView(D.start,D.end)),B},A.prototype.replaceAll=function(_,O){O&&this.$search.set(O);var D=this.$search.findAll(this.session),B=0;if(!D.length)return B;var P=this.getSelectionRange();this.selection.moveTo(0,0);for(var H=D.length-1;H>=0;--H)this.$tryReplace(D[H],_)&&B++;return this.selection.setSelectionRange(P),B},A.prototype.$tryReplace=function(_,O){var D=this.session.getTextRange(_);return O=this.$search.replace(D,O),O!==null?(_.end=this.session.replace(_,O),_):null},A.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},A.prototype.find=function(_,O,D){O||(O={}),typeof _=="string"||_ instanceof RegExp?O.needle=_:typeof _=="object"&&c.mi
209xin(O,_);var B=this.selection.getRange();O.needle==null&&(_=this.session.getTextRange(B)||this.$search.$options.needle,_||(B=this.session.getWordRange(B.start.row,B.start.column),_=this.session.getTextRange(B)),this.$search.set({needle:_})),this.$search.set(O),O.start||this.$search.set({start:B});var P=this.$search.find(this.session);if(O.preventScroll)return P;if(P)return this.revealRange(P,D),P;O.backwards?B.start=B.end:B.end=B.start,this.selection.setRange(B)},A.prototype.findNext=function(_,O){this.find({skipCurrent:!0,backwards:!1},_,O)},A.prototype.findPrevious=function(_,O){this.find(_,{skipCurrent:!0,backwards:!0},O)},A.prototype.revealRange=function(_,O){this.session.unfold(_),this.selection.setSelectionRange(_);var D=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(_.start,_.end,.5),O!==!1&&this.renderer.animateScrolling(D)},A.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},A.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},A.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(_){_.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},A.prototype.setAutoScrollEditorIntoView=function(_){if(_){var O,D=this,B=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var P=this.$scrollAnchor;P.style.cssText="position:absolute",this.container.insertBefore(P,this.container.firstChild);var H=this.on("changeSelection",function(){B=!0}),W=this.renderer.on("beforeRender",function(){B&&(O=D.renderer.container.getBoundingClientRect())}),K=this.renderer.on("afterRender",function(){if(B&&O&&(D.isFocused()||D.searchBox&&D.searchBox.isFocused())){var G=D.renderer,X=G.$cursorLayer.$pixelPos,Z=G.layerConfig,q=X.top-Z.offset;X.top>=0&&q+O.top<0?B=!0:X.top<Z.height&&X.top+O.top+Z.lineHeight>window.innerHeight?B=!1:B=null,B!=null&&(P.style.top=q+"px",P.style.left=X.left+"px",P.style.height=Z.lineHeight+"px",P.scrollIntoView(B)),B=O=null}});this.setAutoScrollEditorIntoView=function(G){G||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",H),this.renderer.off("afterRender",K),this.renderer.off("beforeRender",W))}}},A.prototype.$resetCursorStyle=function(){var _=this.$cursorStyle||"ace",O=this.renderer.$cursorLayer;O&&(O.setSmoothBlinking(/smooth/.test(_)),O.isBlinking=!this.$readOnly&&_!="wide",f.setCssClass(O.element,"ace_slim-cursors",/slim/.test(_)))},A.prototype.prompt=function(_,O,D){var B=this;b.loadModule("ace/ext/prompt",function(P){P.prompt(B,_,O,D)})},A}();R.$uid=0,R.prototype.curOp=null,R.prototype.prevOp={},R.prototype.$mergeableCommands=["backspace","del","insertstring"],R.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],c.implement(R.prototype,g),b.defineOptions(R.prototype,"editor",{selectionStyle:{set:function(A){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:A})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(A){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(A){var _=this;this.textInput.setReadOnly(A),this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(D){var B=!1;if(D&&D.type=="keydown"){if(B=D&&D.key&&D.key.length==1&&!D.ctrlKey&&!D.metaKey,!B)return}else D&&D.type!=="exec"&&(B=!0);if(B){_.hoverTooltip||(_.hoverTooltip=new F);var P=f.createElement("div");P.textContent=w("editor.tooltip.disable-editing","Editing is disabled"),_.hoverTooltip.isOpen||_.hoverTooltip.showForRange(_,_.getSelectionRange(),P)}else _.hoverTooltip&&_.hoverTooltip.isOpen&&_.hoverTooltip.hide()});var O=this.textInput.getElement();A?(L.addListener(O,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(L.removeListener(O,"keydown",this.$readOnlyCallback),this.commands.off("exec",this.$readOnlyCallback),this.commands.off("
209commandUnavailable",this.$readOnlyCallback),this.hoverTooltip&&(this.hoverTooltip.destroy(),this.hoverTooltip=null))},initialValue:!1},copyWithEmptySelection:{set:function(A){this.textInput.setCopyWithEmptySelection(A)},initialValue:!1},cursorStyle:{set:function(A){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(A){this.setAutoScrollEditorIntoView(A)}},keyboardHandler:{set:function(A){this.setKeyboardHandler(A)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(A){this.session.setValue(A)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(A){this.setSession(A)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(A){this.renderer.$gutterLayer.setShowLineNumbers(A),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),A&&this.$relativeLineNumbers?M.attach(this):M.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(A){this.$showLineNumbers&&A?M.attach(this):M.detach(this)}},placeholder:{set:function(A){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var _=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(_&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),f.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!_&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),f.addCssClass(this.container,"ace_hasPlaceholder");var O=f.createElement("div");O.className="ace_placeholder",O.textContent=this.$placeholder||"",this.renderer.placeholderNode=O,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!_&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(A){var _={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(B){B.blur(),B.renderer.scroller.focus()},readOnly:!0},O=function(B){if(B.target==this.renderer.scroller&&B.keyCode===I.enter){B.preventDefault();var P=this.getCursorPosition().row;this.isRowVisible(P)||this.scrollToLine(P,!0,!0),this.focus()}},D;A?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(d.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",w("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",w("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",O.bind(this)),this.commands.addCommand(_),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",w("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",w("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),D||(D=new E(this)),D.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",O.bind(this)),this.commands.removeCommand(_),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),D&&D.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(A){this.$textInputAriaLabel=A},initialValue:""},enableMobileMenu:{set:function(A){this.$enableMobileMenu=A},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focu
209sTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var M={getText:function(A,_){return(Math.abs(A.selection.lead.row-_)||_+1+(_<9?"\xB7":""))+""},getWidth:function(A,_,O){return Math.max(_.toString().length,(O.lastRow+1).toString().length,2)*O.characterWidth},update:function(A,_){_.renderer.$loop.schedule(_.renderer.CHANGE_GUTTER)},attach:function(A){A.renderer.$gutterLayer.$renderer=this,A.on("changeSelection",this.update),this.update(null,A)},detach:function(A){A.renderer.$gutterLayer.$renderer==this&&(A.renderer.$gutterLayer.$renderer=null),A.off("changeSelection",this.update),this.update(null,A)}};e.Editor=R});ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=function(){function f(i,d){this.element=i,this.canvasHeight=d||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return f.prototype.moveContainer=function(i){s.translate(this.element,0,-(i.firstRowScreen*i.lineHeight%this.canvasHeight)-i.offset*this.$offsetCoefficient)},f.prototype.pageChanged=function(i,d){return Math.floor(i.firstRowScreen*i.lineHeight/this.canvasHeight)!==Math.floor(d.firstRowScreen*d.lineHeight/this.canvasHeight)},f.prototype.computeLineTop=function(i,d,n){var o=d.firstRowScreen*d.lineHeight,a=Math.floor(o/this.canvasHeight),l=n.documentToScreenRow(i,0)*d.lineHeight;return l-a*this.canvasHeight},f.prototype.computeLineHeight=function(i,d,n){return d.lineHeight*n.getRowLineCount(i)},f.prototype.getLength=function(){return this.cells.length},f.prototype.get=function(i){return this.cells[i]},f.prototype.shift=function(){this.$cacheCell(this.cells.shift())},f.prototype.pop=function(){this.$cacheCell(this.cells.pop())},f.prototype.push=function(i){if(Array.isArray(i)){this.cells.push.apply(this.cells,i);for(var d=s.createFragment(this.element),n=0;n<i.length;n++)d.appendChild(i[n].element);this.element.appendChild(d)}else this.cells.push(i),this.element.appendChild(i.element)},f.prototype.unshift=function(i){if(Array.isArray(i)){this.cells.unshift.apply(this.cells,i);for(var d=s.createFragment(this.element),n=0;n<i.length;n++)d.appendChild(i[n].element);this.element.firstChild?this.element.insertBefore(d,this.element.firstChild):this.element.appendChild(d)}else this.cells.unshift(i),this.element.insertAdjacentElement("afterbegin",i.element)},f.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},f.prototype.$cacheCell=function(i){i&&(i.element.remove(),this.cellCache.push(i))},f.prototype.createCell=function(i,d,n,o){var a=this.cellCache.pop();if(!a){var l=s.createElement("div");o&&o(l),this.element.appendChild(l),a={element:l,text:"",row:i}}return a.row=i,a},f}();e.Lines=c});ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=t("../lib/oop"),f=t("../lib/lang"),i=t("../lib/event_emitter").EventEmitter,d=t("./lines").Lines,n=t("../config").nls,o=function(){function l(u){this.element=s.createElement("div"),this.element.className="ace_layer ace_gutter-layer",u.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new d(this.element),this.$lines.$offsetCoefficient=1}return l.prototype.setSession=function(u){this.session&&this.session.off("change",this.$updateAnnotations),this.session=u,u&&u.on("change",this.$updateAnnotations)},l.prototype.addGutterDecoration=function(u,h){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(u,h)},l.prototype.removeGutterDecoration=function(u,h){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(u,h)},l.prototype.setAnnotations=function(u){this.$annotations=[];for(var h=0;h<u.length;h++){var p=u[h],g=p.row,m=this.$annotations[g];m||(m=this.$annotations[g]={text:[],type:[],displayText:[]});var y=p.text,b=p.text,C=p.type;y=y?f.escapeHTML(y):p.html||"",b=b||p.html||"",m.text.indexOf(y)===-1&&(m.text.push(y),m.type.push(C),m.displayText.push(b));var E=p.className;E?m.className=E:C==="error"?m.className=" ace_error":C==="security"&&!/\bace_error\b/.test(m.className)?m.className=" ace_security":C==="warning"&&!/\bace_(error|security)\b/.test(m.className)?m.className=" ace_warning":C==="info"&&!m.className?m.className=" ace_info":C==="hint"&&!m.className&&(m.className=" ace_hint")}},l.prototype.$updateAnnotations=function(u){if(this.$annotations.length){var h=u.start.row,p=u.end.row-h;if(p!==0)if(u.action=="remove")this.$annotations.splice(h,p+1,null);else{var g=new Array(p+1);g.unshift(h,1),this.$annotations.splice.apply(this.$annotations,g)}}},l.prototype.update=function(u){this.config=u;var h=this.session,p=u.firstRow,g=Math.min(u.lastRow+u.gutterOffset,h.getLength()-1);
209this.oldLastRow=g,this.config=u,this.$lines.moveContainer(u),this.$updateCursorRow();for(var m=h.getNextFoldLine(p),y=m?m.start.row:1/0,b=null,C=-1,E=p;;){if(E>y&&(E=m.end.row+1,m=h.getNextFoldLine(E,m),y=m?m.start.row:1/0),E>g){for(;this.$lines.getLength()>C+1;)this.$lines.pop();break}b=this.$lines.get(++C),b?b.row=E:(b=this.$lines.createCell(E,u,this.session,a),this.$lines.push(b)),this.$renderCell(b,u,m,E),E++}this._signal("afterRender"),this.$updateGutterWidth(u)},l.prototype.$updateGutterWidth=function(u){var h=this.session,p=h.gutterRenderer||this.$renderer,g=h.$firstLineNumber,m=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||h.$useWrapMode)&&(m=h.getLength()+g-1);var y=p?p.getWidth(h,m,u):m.toString().length*u.characterWidth,b=this.$padding||this.$computePadding();y+=b.left+b.right,y!==this.gutterWidth&&!isNaN(y)&&(this.gutterWidth=y,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",y))},l.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var u=this.session.selection.getCursor();this.$cursorRow!==u.row&&(this.$cursorRow=u.row)}},l.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var u=this.session.selection.cursor.row;if(this.$cursorRow=u,!(this.$cursorCell&&this.$cursorCell.row==u)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var h=this.$lines.cells;this.$cursorCell=null;for(var p=0;p<h.length;p++){var g=h[p];if(g.row>=this.$cursorRow){if(g.row>this.$cursorRow){var m=this.session.getFoldLine(this.$cursorRow);if(p>0&&m&&m.start.row==h[p-1].row)g=h[p-1];else break}g.element.className="ace_gutter-active-line "+g.element.className,this.$cursorCell=g;break}}}}},l.prototype.scrollLines=function(u){var h=this.config;if(this.config=u,this.$updateCursorRow(),this.$lines.pageChanged(h,u))return this.update(u);this.$lines.moveContainer(u);var p=Math.min(u.lastRow+u.gutterOffset,this.session.getLength()-1),g=this.oldLastRow;if(this.oldLastRow=p,!h||g<u.firstRow)return this.update(u);if(p<h.firstRow)return this.update(u);if(h.firstRow<u.firstRow)for(var m=this.session.getFoldedRowCount(h.firstRow,u.firstRow-1);m>0;m--)this.$lines.shift();if(g>p)for(var m=this.session.getFoldedRowCount(p+1,g);m>0;m--)this.$lines.pop();u.firstRow<h.firstRow&&this.$lines.unshift(this.$renderLines(u,u.firstRow,h.firstRow-1)),p>g&&this.$lines.push(this.$renderLines(u,g+1,p)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(u)},l.prototype.$renderLines=function(u,h,p){for(var g=[],m=h,y=this.session.getNextFoldLine(m),b=y?y.start.row:1/0;m>b&&(m=y.end.row+1,y=this.session.getNextFoldLine(m,y),b=y?y.start.row:1/0),!(m>p);){var C=this.$lines.createCell(m,u,this.session,a);this.$renderCell(C,u,y,m),g.push(C),m++}return g},l.prototype.$renderCell=function(u,h,p,g){var m=u.element,y=this.session,b=m.childNodes[0],C=m.childNodes[1],E=m.childNodes[2],w=m.childNodes[3],k=E.firstChild,I=y.$firstLineNumber,L=y.$breakpoints,F=y.$decorations,R=y.gutterRenderer||this.$renderer,M=this.$showFoldWidgets&&y.foldWidgets,A=p?p.start.row:Number.MAX_VALUE,_=h.lineHeight+"px",O=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",D=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",B=(R?R.getText(y,g):g+I).toString();if(this.$highlightGutterLine&&(g==this.$cursorRow||p&&g<this.$cursorRow&&g>=A&&this.$cursorRow<=p.end.row)&&(O+="ace_gutter-active-line ",this.$cursorCell!=u&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=u)),L[g]&&(O+=L[g]),F[g]&&(O+=F[g]),this.$annotations[g]&&g!==A&&(O+=this.$annotations[g].className),M){var P=M[g];P==null&&(P=M[g]=y.getFoldWidget(g))}if(P){var H="ace_fold-widget ace_"+P,W=P=="start"&&g==A&&g<p.end.row;if(W){H+=" ace_closed";for(var K="",G=!1,X=g+1;X<=p.end.row;X++)if(this.$annotations[X]){if(this.$annotations[X].className===" ace_error"){G=!0,K=" ace_error_fold";break}this.$annotations[X].className===" ace_security"?(G=!0,K=" ace_security_fold"):this.$annotations[X].className===" ace_warning"&&K!==" ace_security_fold"&&(G=!0,K=" ace_warning_fold")}O+=K}else H+=" ace_open";C.className!=H&&(C.className=H),s.setStyle(C.style,"height",_),s.setStyle(C.style,"display","inline-block"),C.setAttribute("role","button"),C.setAttribute("tabindex","-1");var Z=y.getFoldWidgetRange(g);Z?C.setAttribute("aria-label",n("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[Z.start.row+1,Z.end.row+1])):p?C.setAttribute("aria-label",n("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[p.start.row+1,p.end.row+1])):C.setAttribute("aria-label",n("gutter.code-folding.o
209pen.aria-label","Toggle code folding, row $0",[g+1])),W?(C.setAttribute("aria-expanded","false"),C.setAttribute("title",n("gutter.code-folding.closed.title","Unfold code"))):(C.setAttribute("aria-expanded","true"),C.setAttribute("title",n("gutter.code-folding.open.title","Fold code")))}else C&&(s.setStyle(C.style,"display","none"),C.setAttribute("tabindex","0"),C.removeAttribute("role"),C.removeAttribute("aria-label"));var q=this.session.$gutterCustomWidgets[g];if(q?this.$addCustomWidget(g,q,u):w&&this.$removeCustomWidget(g,u),G&&this.$showFoldedAnnotations){E.className="ace_gutter_annotation",k.className=D,k.className+=K,s.setStyle(k.style,"height",_),s.setStyle(E.style,"display","block"),s.setStyle(E.style,"height",_);var Q;switch(K){case" ace_error_fold":Q=n("gutter.annotation.aria-label.error","Error, read annotations row $0",[B]);break;case" ace_security_fold":Q=n("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[B]);break;case" ace_warning_fold":Q=n("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[B]);break}E.setAttribute("aria-label",Q),E.setAttribute("tabindex","-1"),E.setAttribute("role","button")}else if(this.$annotations[g]){E.className="ace_gutter_annotation",k.className=D,this.$useSvgGutterIcons?k.className+=this.$annotations[g].className:m.classList.add(this.$annotations[g].className.replace(" ","")),s.setStyle(k.style,"height",_),s.setStyle(E.style,"display","block"),s.setStyle(E.style,"height",_);var Q;switch(this.$annotations[g].className){case" ace_error":Q=n("gutter.annotation.aria-label.error","Error, read annotations row $0",[B]);break;case" ace_security":Q=n("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[B]);break;case" ace_warning":Q=n("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[B]);break;case" ace_info":Q=n("gutter.annotation.aria-label.info","Info, read annotations row $0",[B]);break;case" ace_hint":Q=n("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[B]);break}E.setAttribute("aria-label",Q),E.setAttribute("tabindex","-1"),E.setAttribute("role","button")}else s.setStyle(E.style,"display","none"),E.removeAttribute("aria-label"),E.removeAttribute("role"),E.setAttribute("tabindex","0");return B!==b.data&&(b.data=B),m.className!=O&&(m.className=O),s.setStyle(u.element.style,"height",this.$lines.computeLineHeight(g,h,y)+"px"),s.setStyle(u.element.style,"top",this.$lines.computeLineTop(g,h,y)+"px"),u.text=B,E.style.display==="none"&&C.style.display==="none"&&!q?u.element.setAttribute("aria-hidden",!0):u.element.setAttribute("aria-hidden",!1),u},l.prototype.setHighlightGutterLine=function(u){this.$highlightGutterLine=u},l.prototype.setShowLineNumbers=function(u){this.$renderer=!u&&{getWidth:function(){return 0},getText:function(){return""}}},l.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},l.prototype.setShowFoldWidgets=function(u){u?s.addCssClass(this.element,"ace_folding-enabled"):s.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=u,this.$padding=null},l.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},l.prototype.$hideFoldWidget=function(u,h){var p=h||this.$getGutterCell(u);if(p&&p.element){var g=p.element.childNodes[1];g&&s.setStyle(g.style,"display","none")}},l.prototype.$showFoldWidget=function(u,h){var p=h||this.$getGutterCell(u);if(p&&p.element){var g=p.element.childNodes[1];g&&this.session.foldWidgets&&this.session.foldWidgets[p.row]&&s.setStyle(g.style,"display","inline-block")}},l.prototype.$getGutterCell=function(u){var h=this.$lines.cells,p=this.session.documentToScreenRow(u,0);return h[u-this.config.firstRowScreen-(u-p)]},l.prototype.$addCustomWidget=function(u,h,p){var g=h.className,m=h.label,y=h.title,b=h.callbacks;this.session.$gutterCustomWidgets[u]={className:g,label:m,title:y,callbacks:b},this.$hideFoldWidget(u,p);var C=p||this.$getGutterCell(u);if(C&&C.element){var E=C.element.querySelector(".ace_custom-widget");E&&E.remove(),E=s.createElement("span"),E.className="ace_custom-widget ".concat(g),E.setAttribute("tabindex","-1"),E.setAttribute("role","button"),E.setAttribute("aria-label",m),E.setAttribute("title",y),s.setStyle(E.style,"display","inline-block"),s.setStyle(E.style,"height","inherit"),b&&b.onClick&&E.addEventListener("click",function(w){b.onClick(w,u),w.stopPropagation()}),C.element.appendChild(E)}},l.prototype.$removeCustomWidget=function(u,h){delete this.session.$gutterCustomWidgets[u],this.$showFoldWidget(u,h);var p=h||this.$getGutterCell(u);if(p&&p.element){var g=p.element.querySelector(".ace_custom-widget");g&&p.element.removeChild(g)}},l.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var u=s.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(u.borderLeftWidth)||0)+(parseInt(u.paddingLeft)||0)+1,this.$padding.right=(parseInt(u.borderRightWidth)||0)+(parseInt(u.paddingRight)||0),this.$padding},l.prototype.getRegion=function(u){var h=this.$padding||this.$computePadding(),p=this.element.getBoundingClientRect();if(u.x<h.left+p.left)return"markers";if(this.$showFoldWidgets&&u.x>p.right-h.right)return"foldWidgets"},l}();o.prototype.$fixedWidth=!1,o.prototype.$highlightGutterLine=!0,o.prototype.$renderer="",o.prototype.$showLineNumbers=!0,o.prototype.$showFoldWidgets=!0,c.implement(o.prototype,i
209);function a(l){var u=document.createTextNode("");l.appendChild(u);var h=s.createElement("span");l.appendChild(h);var p=s.createElement("span");l.appendChild(p);var g=s.createElement("span");return p.appendChild(g),l}e.Gutter=o});ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(t,e,r){"use strict";var s=t("../range").Range,c=t("../lib/dom"),f=function(){function d(n){this.element=c.createElement("div"),this.element.className="ace_layer ace_marker-layer",n.appendChild(this.element)}return d.prototype.setPadding=function(n){this.$padding=n},d.prototype.setSession=function(n){this.session=n},d.prototype.setMarkers=function(n){this.markers=n},d.prototype.elt=function(n,o){var a=this.i!=-1&&this.element.childNodes[this.i];a?this.i++:(a=document.createElement("div"),this.element.appendChild(a),this.i=-1),a.style.cssText=o,a.className=n},d.prototype.update=function(n){if(n){this.config=n,this.i=0;var o;for(var a in this.markers){var l=this.markers[a];if(!l.range){l.update(o,this,this.session,n);continue}var u=l.range.clipRows(n.firstRow,n.lastRow);if(!u.isEmpty())if(u=u.toScreenRange(this.session),l.renderer){var h=this.$getTop(u.start.row,n),p=this.$padding+u.start.column*n.characterWidth;l.renderer(o,u,p,h,n)}else l.type=="fullLine"?this.drawFullLineMarker(o,u,l.clazz,n):l.type=="screenLine"?this.drawScreenLineMarker(o,u,l.clazz,n):u.isMultiLine()?l.type=="text"?this.drawTextMarker(o,u,l.clazz,n):this.drawMultiLineMarker(o,u,l.clazz,n):this.drawSingleLineMarker(o,u,l.clazz+" ace_start ace_br15",n)}if(this.i!=-1)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},d.prototype.$getTop=function(n,o){return(n-o.firstRowScreen)*o.lineHeight},d.prototype.drawTextMarker=function(n,o,a,l,u){for(var h=this.session,p=o.start.row,g=o.end.row,m=p,y=0,b=0,C=h.getScreenLastRowColumn(m),E=new s(m,o.start.column,m,b);m<=g;m++)E.start.row=E.end.row=m,E.start.column=m==p?o.start.column:h.getRowWrapIndent(m),E.end.column=C,y=b,b=C,C=m+1<g?h.getScreenLastRowColumn(m+1):m==g?0:o.end.column,this.drawSingleLineMarker(n,E,a+(m==p?" ace_start":"")+" ace_br"+i(m==p||m==p+1&&o.start.column,y<b,b>C,m==g),l,m==g?0:1,u)},d.prototype.drawMultiLineMarker=function(n,o,a,l,u){var h=this.$padding,p=l.lineHeight,g=this.$getTop(o.start.row,l),m=h+o.start.column*l.characterWidth;if(u=u||"",this.session.$bidiHandler.isBidiRow(o.start.row)){var y=o.clone();y.end.row=y.start.row,y.end.column=this.session.getLine(y.start.row).length,this.drawBidiSingleLineMarker(n,y,a+" ace_br1 ace_start",l,null,u)}else this.elt(a+" ace_br1 ace_start","height:"+p+"px;right:"+h+"px;top:"+g+"px;left:"+m+"px;"+(u||""));if(this.session.$bidiHandler.isBidiRow(o.end.row)){var y=o.clone();y.start.row=y.end.row,y.start.column=0,this.drawBidiSingleLineMarker(n,y,a+" ace_br12",l,null,u)}else{g=this.$getTop(o.end.row,l);var b=o.end.column*l.characterWidth;this.elt(a+" ace_br12","height:"+p+"px;width:"+b+"px;top:"+g+"px;left:"+h+"px;"+(u||""))}if(p=(o.end.row-o.start.row-1)*l.lineHeight,!(p<=0)){g=this.$getTop(o.start.row+1,l);var C=(o.start.column?1:0)|(o.end.column?0:8);this.elt(a+(C?" ace_br"+C:""),"height:"+p+"px;right:"+h+"px;top:"+g+"px;left:"+h+"px;"+(u||""))}},d.prototype.drawSingleLineMarker=function(n,o,a,l,u,h){if(this.session.$bidiHandler.isBidiRow(o.start.row))return this.drawBidiSingleLineMarker(n,o,a,l,u,h);var p=l.lineHeight,g=(o.end.column+(u||0)-o.start.column)*l.characterWidth,m=this.$getTop(o.start.row,l),y=this.$padding+o.start.column*l.characterWidth;this.elt(a,"height:"+p+"px;width:"+g+"px;top:"+m+"px;left:"+y+"px;"+(h||""))},d.prototype.drawBidiSingleLineMarker=function(n,o,a,l,u,h){var p=l.lineHeight,g=this.$getTop(o.start.row,l),m=this.$padding,y=this.session.$bidiHandler.getSelections(o.start.column,o.end.column);y.forEach(function(b){this.elt(a,"height:"+p+"px;width:"+(b.width+(u||0))+"px;top:"+g+"px;left:"+(m+b.left)+"px;"+(h||""))},this)},d.prototype.drawFullLineMarker=function(n,o,a,l,u){var h=this.$getTop(o.start.row,l),p=l.lineHeight;o.start.row!=o.end.row&&(p+=this.$getTop(o.end.row,l)-h),this.elt(a,"he
209ight:"+p+"px;top:"+h+"px;left:0;right:0;"+(u||""))},d.prototype.drawScreenLineMarker=function(n,o,a,l,u){var h=this.$getTop(o.start.row,l),p=l.lineHeight;this.elt(a,"height:"+p+"px;top:"+h+"px;left:0;right:0;"+(u||""))},d}();f.prototype.$padding=0;function i(d,n,o,a){return(d?1:0)|(n?2:0)|(o?4:0)|(a?8:0)}e.Marker=f});ace.define("ace/layer/text_util",["require","exports","module"],function(t,e,r){var s=new Set(["text","rparen","lparen"]);e.isTextToken=function(c){return s.has(c)}});ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/dom"),f=t("../lib/lang"),i=t("./lines").Lines,d=t("../lib/event_emitter").EventEmitter,n=t("../config").nls,o=t("./text_util").isTextToken,a=function(){function l(u){this.dom=c,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",u.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new i(this.element)}return l.prototype.$updateEolChar=function(){var u=this.session.doc,h=u.getNewLineCharacter()==`
210`&&u.getNewLineMode()!="windows",p=h?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=p)return this.EOL_CHAR=p,!0},l.prototype.setPadding=function(u){this.$padding=u,this.element.style.margin="0 "+u+"px"},l.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},l.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},l.prototype.$setFontMetrics=function(u){this.$fontMetrics=u,this.$fontMetrics.on("changeCharacterSize",function(h){this._signal("changeCharacterSize",h)}.bind(this)),this.$pollSizeChanges()},l.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},l.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},l.prototype.setSession=function(u){this.session=u,u&&this.$computeTabString()},l.prototype.setShowInvisibles=function(u){return this.showInvisibles==u?!1:(this.showInvisibles=u,typeof u=="string"?(this.showSpaces=/tab/i.test(u),this.showTabs=/space/i.test(u),this.showEOL=/eol/i.test(u)):this.showSpaces=this.showTabs=this.showEOL=u,this.$computeTabString(),!0)},l.prototype.setDisplayIndentGuides=function(u){return this.displayIndentGuides==u?!1:(this.displayIndentGuides=u,this.$computeTabString(),!0)},l.prototype.setHighlightIndentGuides=function(u){return this.$highlightIndentGuides===u?!1:(this.$highlightIndentGuides=u,u)},l.prototype.$computeTabString=function(){var u=this.session.getTabSize();this.tabSize=u;for(var h=this.$tabStrings=[0],p=1;p<u+1;p++)if(this.showTabs){var g=this.dom.createElement("span");g.className="ace_invisible ace_invisible_tab",g.textContent=f.stringRepeat(this.TAB_CHAR,p),h.push(g)}else h.push(this.dom.createTextNode(f.stringRepeat(" ",p),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var m="ace_indent-guide",y=this.showSpaces?" ace_invisible ace_invisible_space":"",b=this.showSpaces?f.stringRepeat(this.SPACE_CHAR,this.tabSize):f.stringRepeat(" ",this.tabSize),C=this.showTabs?" ace_invisible ace_invisible_tab":"",E=this.showTabs?f.stringRepeat(this.TAB_CHAR,this.tabSize):b,g=this.dom.createElement("span");g.className=m+y,g.textContent=b,this.$tabStrings[" "]=g;var g=this.dom.createElement("span");g.className=m+C,g.textContent=E,this.$tabStrings["	"]=g}},l.prototype.updateLines=function(u,h,p){if(this.config.lastRow!=u.lastRow||this.config.firstRow!=u.firstRow)return this.update(u);this.config=u;for(var g=Math.max(h,u.firstRow),m=Math.min(p,u.lastRow),y=this.element.childNodes,b=0,E=u.firstRow;E<g;E++){var w=this.session.getFoldLine(E);if(w)if(w.containsRow(g)){g=w.start.row;break}else E=w.end.row;b++}for(var C=!1,E=g,w=this.session.getNextFoldLine(E),k=w?w.start.row:1/0;E>k&&(E=w.end.row+1,w=this.session.getNextFoldLine(E,w),k=w?w.start.row:1/0),!(E>m);){var I=y[b++];if(I){this.dom.removeChildren(I),this.$renderLine(I,E,E==k?w:!1),C&&(I.style.top=this.$lines.computeLineTop(E,u,this.session)+"px");var L=u.lineHeight*this.session.getRowLength(E)+"px";I.style.height!=L&&(C=!0,I.style.height=L)}E++}if(C)for(;b<this.$lines.cells.length;){var F=this.$lines.cells[b++];F.element.style.top=this.$lines.computeLineTop(F.row,u,this.session)+"px"}},l.prototype.scrollLines=function(u){var h=this.config;if(this.config=u,this.$lines.pageChanged(h,u))return this.update(u);
210this.$lines.moveContainer(u);var p=u.lastRow,g=h?h.lastRow:-1;if(!h||g<u.firstRow)return this.update(u);if(p<h.firstRow)return this.update(u);if(!h||h.lastRow<u.firstRow)return this.update(u);if(u.lastRow<h.firstRow)return this.update(u);if(h.firstRow<u.firstRow)for(var m=this.session.getFoldedRowCount(h.firstRow,u.firstRow-1);m>0;m--)this.$lines.shift();if(h.lastRow>u.lastRow)for(var m=this.session.getFoldedRowCount(u.lastRow+1,h.lastRow);m>0;m--)this.$lines.pop();u.firstRow<h.firstRow&&this.$lines.unshift(this.$renderLinesFragment(u,u.firstRow,h.firstRow-1)),u.lastRow>h.lastRow&&this.$lines.push(this.$renderLinesFragment(u,h.lastRow+1,u.lastRow)),this.$highlightIndentGuide()},l.prototype.$renderLinesFragment=function(u,h,p){for(var g=[],m=h,y=this.session.getNextFoldLine(m),b=y?y.start.row:1/0;m>b&&(m=y.end.row+1,y=this.session.getNextFoldLine(m,y),b=y?y.start.row:1/0),!(m>p);){var C=this.$lines.createCell(m,u,this.session),E=C.element;this.dom.removeChildren(E),c.setStyle(E.style,"height",this.$lines.computeLineHeight(m,u,this.session)+"px"),c.setStyle(E.style,"top",this.$lines.computeLineTop(m,u,this.session)+"px"),this.$renderLine(E,m,m==b?y:!1),this.$useLineGroups()?E.className="ace_line_group":E.className="ace_line",g.push(C),m++}return g},l.prototype.update=function(u){this.$lines.moveContainer(u),this.config=u;for(var h=u.firstRow,p=u.lastRow,g=this.$lines;g.getLength();)g.pop();g.push(this.$renderLinesFragment(u,h,p))},l.prototype.$renderToken=function(u,h,p,g){for(var m=this,y=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,b=this.dom.createFragment(this.element),C,E=0;C=y.exec(g);){var w=C[1],k=C[2],I=C[3],L=C[4],F=C[5];if(!(!m.showSpaces&&k)){var R=E!=C.index?g.slice(E,C.index):"";if(E=C.index+C[0].length,R&&b.appendChild(this.dom.createTextNode(R,this.element)),w){var M=m.session.getScreenTabSize(h+C.index);b.appendChild(m.$tabStrings[M].cloneNode(!0)),h+=M-1}else if(k)if(m.showSpaces){var A=this.dom.createElement("span");A.className="ace_invisible ace_invisible_space",A.textContent=f.stringRepeat(m.SPACE_CHAR,k.length),b.appendChild(A)}else b.appendChild(this.dom.createTextNode(k,this.element));else if(I){var A=this.dom.createElement("span");A.className="ace_invisible ace_invisible_space ace_invalid",A.textContent=f.stringRepeat(m.SPACE_CHAR,I.length),b.appendChild(A)}else if(L){h+=1;var A=this.dom.createElement("span");A.style.width=m.config.characterWidth*2+"px",A.className=m.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",A.textContent=m.showSpaces?m.SPACE_CHAR:L,b.appendChild(A)}else if(F){h+=1;var A=this.dom.createElement("span");A.style.width=m.config.characterWidth*2+"px",A.className="ace_cjk",A.textContent=F,b.appendChild(A)}}}if(b.appendChild(this.dom.createTextNode(E?g.slice(E):g,this.element)),o(p.type))u.appendChild(b);else{var _="ace_"+p.type.replace(/\./g," ace_"),A=this.dom.createElement("span");p.type=="fold"&&(A.style.width=p.value.length*this.config.characterWidth+"px",A.setAttribute("title",n("inline-fold.closed.title","Unfold code"))),A.className=_,A.appendChild(b),u.appendChild(A)}return h+g.length},l.prototype.renderIndentGuide=function(u,h,p){var g=h.search(this.$indentGuideRe);if(g<=0||g>=p)return h;if(h[0]==" "){g-=g%this.tabSize;for(var m=g/this.tabSize,y=0;y<m;y++)u.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),h.substr(g)}else if(h[0]=="	"){for(var y=0;y<g;y++)u.appendChild(this.$tabStrings["	"].cloneNode(!0));return this.$highlightIndentGuide(),h.substr(g)}return this.$highlightIndentGuide(),h},l.prototype.$highlightIndentGuide=function(){if(!(!this.$highlightIndentGuides||!this.displayIndentGuides)){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var u=this.session.doc.$lines;if(u){var h=this.session.selection.getCursor(),p=/^\s*/.exec(this.session.doc.getLine(h.row))[0].length,g=Math.floor(p/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:g,start:h.row};var m=this.session.$bracketHighlight;if(m){for(var y=this.session.$bracketHighlight.ranges,b=0;b<y.length;b++)if(h.row!==y[b].start.row){this.$highlightIndentGuideMarker.end=y[b].start.row+1,h.row>y[b].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&u[h.row]!==""&&h.column===u[h.row].length){this.$highlightIndentGuideMarker.dir=1;for(var b=h.row+1;b<u.length;b++){var C=u[b],E=/^\s*/.exec(C)[0].length;if(C!==""&&(this.$highlightIndentGuideMarker.end=b,E<=p))break}}this.$renderHighlightIndentGuide()}}},l.prototype.$clearActiveIndentGuide=function(){for(var u=this.element.querySelectorAll(".ace_indent-guide-active"),h=0;h<u.length;h++)u[h].classList.remove("ace_indent-guide-active")},l.prototype.$setIndentGuideActive=function(u,h){var p=this.session.doc.getLine(u.row);if(p!==""){var g=u.element;if(u.element.classList&&u.element.classList.contains("ace_line_group"))if(u.element.childNodes.length>0)g=u.element.childNodes[0];else return;var m=g.childNodes;if(m){var y=m[h-1];y&&y.classList&&y.classList.contains("ace_indent-guide")&&y.classList.add("ace_indent-guide-active")}}},l.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var u=this.$lines.cells;this.$clearActiveIndentGuide();var h=this.$highlightIndentGuideMarker.indentLevel;if(h!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var p=0;p<u.length;p++){var g=u[p];if(this.$highlightIndentGuideMarker.end&&g.row>=this.$highlightIndentGuideMarker.start+1){if(g.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(g,h)}}else for(var p=u.length-1;p>=0;p--){var g=u[p];if(this.$highlightIndentGuideMarker.end&&g.row<this.$highlightIndentGuideMarker.start){if(g.row<this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(g,h)}}}},l.prototype.$createLineElement=function(u){var h=this.dom.createElement("div");return h.className="ace_line",h.style.height=this.config.lineHeight+"px",h},l.prototype.$renderWrappedLine=function(u,h,p){var g=0,m=0,y=p[0],b=0,C=this.$createLineElement();u.appendChild(C);for(var E=0;E<h.length;E++){var w=h[E],k=w.value;if(E==0&&this.displayIndentGuides){if(g=k.length,k=this.renderIndentGuide(C,k,y),!k)continue;g-=k.length}if(g+k.length<y)b=this.$renderToken(C,b,w,k),g+=k.length;else{for(;g+k.length>=y;)b=this.$renderToken(C,b,w,k.substring(0,y-g)),k=k.substring(y-g),g=y,C=this.$createLineElement(),u.appendChild(C),C.appendChild(this.dom.createTextNode(f.stringRepeat("\xA0",p.indent),this.element)),m++,b=0,y=p[m]||Number.MAX_VALUE;k.length!=0&&(g+=k.length,b=this.$renderToken(C,b,w,k))}}p[p.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(C,b,null,"",!0)}
210,l.prototype.$renderSimpleLine=function(u,h){for(var p=0,g=0;g<h.length;g++){var m=h[g],y=m.value;if(!(g==0&&this.displayIndentGuides&&(y=this.renderIndentGuide(u,y),!y))){if(p+y.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(u,p,m,y);p=this.$renderToken(u,p,m,y)}}},l.prototype.$renderOverflowMessage=function(u,h,p,g,m){p&&this.$renderToken(u,h,p,g.slice(0,this.MAX_LINE_LENGTH-h));var y=this.dom.createElement("span");y.className="ace_inline_button ace_keyword ace_toggle_wrap",y.textContent=m?"<hide>":"<click to see more...>",u.appendChild(y)},l.prototype.$renderLine=function(u,h,p){if(!p&&p!=!1&&(p=this.session.getFoldLine(h)),p)var g=this.$getFoldLineTokens(h,p);else var g=this.session.getTokens(h);var m=u;if(g.length){var y=this.session.getRowSplitData(h);if(y&&y.length){this.$renderWrappedLine(u,g,y);var m=u.lastChild}else{var m=u;this.$useLineGroups()&&(m=this.$createLineElement(),u.appendChild(m)),this.$renderSimpleLine(m,g)}}else this.$useLineGroups()&&(m=this.$createLineElement(),u.appendChild(m));if(this.showEOL&&m){p&&(h=p.end.row);var b=this.dom.createElement("span");b.className="ace_invisible ace_invisible_eol",b.textContent=h==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,m.appendChild(b)}},l.prototype.$getFoldLineTokens=function(u,h){var p=this.session,g=[];function m(b,C,E){for(var w=0,k=0;k+b[w].value.length<C;)if(k+=b[w].value.length,w++,w==b.length)return;if(k!=C){var I=b[w].value.substring(C-k);I.length>E-C&&(I=I.substring(0,E-C)),g.push({type:b[w].type,value:I}),k=C+I.length,w+=1}for(;k<E&&w<b.length;){var I=b[w].value;I.length+k>E?g.push({type:b[w].type,value:I.substring(0,E-k)}):g.push(b[w]),k+=I.length,w+=1}}var y=p.getTokens(u);return h.walk(function(b,C,E,w,k){b!=null?g.push({type:"fold",value:b}):(k&&(y=p.getTokens(C)),y.length&&m(y,w,E))},h.end.row,this.session.getLine(h.end.row).length),g},l.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},l}();a.prototype.EOF_CHAR="\xB6",a.prototype.EOL_CHAR_LF="\xAC",a.prototype.EOL_CHAR_CRLF="\xA4",a.prototype.EOL_CHAR=a.prototype.EOL_CHAR_LF,a.prototype.TAB_CHAR="\u2014",a.prototype.SPACE_CHAR="\xB7",a.prototype.$padding=0,a.prototype.MAX_LINE_LENGTH=1e4,a.prototype.showInvisibles=!1,a.prototype.showSpaces=!1,a.prototype.showTabs=!1,a.prototype.showEOL=!1,a.prototype.displayIndentGuides=!0,a.prototype.$highlightIndentGuides=!0,a.prototype.$tabStrings=[],a.prototype.destroy={},a.prototype.onChangeTabSize=a.prototype.$computeTabString,s.implement(a.prototype,d),e.Text=a});ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=function(){function f(i){this.element=s.createElement("div"),this.element.className="ace_layer ace_cursor-layer",i.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),s.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return f.prototype.$updateOpacity=function(i){for(var d=this.cursors,n=d.length;n--;)s.setStyle(d[n].style,"opacity",i?"":"0")},f.prototype.$startCssAnimation=function(){for(var i=this.cursors,d=i.length;d--;)i[d].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout(function(){this.$isAnimating&&s.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},f.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,s.removeCssClass(this.element,"ace_animate-blinking")},f.prototype.setPadding=function(i){this.$padding=i},f.prototype.setSession=function(i){this.session=i},f.prototype.setBlinking=function(i){i!=this.isBlinking&&(this.isBlinking=i,this.restartTimer())},f.prototype.setBlinkInterval=function(i){i!=this.blinkInterval&&(this.blinkInterval=i,this.restartTimer())},f.prototype.setSmoothBlinking=function(i){i!=this.smoothBlinking&&(this.smoothBlinking=i,s.setCssClass(this.element,"ace_smooth-blinking",i),this.$updateCursors(!0),this.restartTimer())},f.prototype.addCursor=function(){var i=s.createElement("div");return i.className="ace_cursor",this.element.appendChild(i),this.cursors.push(i),i},f.prototype.removeCursor=function(){if(this.cursors.length>1){var i=this.cursors.pop();return i.parentNode.removeChild(i),i}},f.prototype.hideCursor=function(){this.isVisible=!1,s.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},f.prototype.showCursor=function(){this.isVisible=!0,s.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},f.prototype.restartTimer=function(){var i=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,s.removeCssClass(this.element,"ace_smooth-blinking")),i(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout(function(){this.$isSmoothBlinking&&s.addCssClass(this.element,"ace_smooth-blinking")}.bind(this))),s.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var d=function(){this.timeoutId=setTimeout(function(){i(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){i(!0),d()},this.blinkInterval),d()}},f.prototype.getPixelPosition=function(i,d){if(!this.config||!this.session)return{left:0,top:0};i||(i=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(i),o=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,i.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),a=(n.row-(d?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:o,top:a}},f.prototype.isCursorInView=function(i,d){return i.top>=0&&i.top<d.maxHeight},f.prototype.update=function(i){this.config=i;var d=this.session.$selectionMarkers,n=0,o=0;(d===void 0||d.length===0)&&(d=[{cursor:null}]);for(var n=0,a=d.length;n<a;n++){var l=this.getPixelPosition(d[n].cursor,!0);if(!((l.top>i.height+i.offset||l.top<0)&&n>1)){var u=this.cursors[o++]||this.addCursor(),h=u.style;this.drawCursor?this.drawCursor(u,l,i,d[n],this.session):this.isCursorInView(l,i)?(s.setStyle(h,"display","block"),s.translate(u,l.left,l.top),s.setStyle(h,"width",Math.round(i.characterWidth)+"px"),s.setStyle(h,"height",i.lineHeight+"px")):s.setStyle(h,"display","none")}}for(;this.cursors.length>o;
210)this.removeCursor();var p=this.session.getOverwrite();this.$setOverwrite(p),this.$pixelPos=l,this.restartTimer()},f.prototype.$setOverwrite=function(i){i!=this.overwrite&&(this.overwrite=i,i?s.addCssClass(this.element,"ace_overwrite-cursors"):s.removeCssClass(this.element,"ace_overwrite-cursors"))},f.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},f}();c.prototype.$padding=0,c.prototype.drawCursor=null,e.Cursor=c});ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var u=function(h,p){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,m){g.__proto__=m}||function(g,m){for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(g[y]=m[y])},u(h,p)};return function(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");u(h,p);function g(){this.constructor=h}h.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}}(),c=t("./lib/oop"),f=t("./lib/dom"),i=t("./lib/event"),d=t("./lib/event_emitter").EventEmitter,n=32768,o=function(){function u(h,p){this.element=f.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+p,this.inner=f.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\xA0",this.element.appendChild(this.inner),h.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,i.addListener(this.element,"scroll",this.onScroll.bind(this)),i.addListener(this.element,"mousedown",i.preventDefault)}return u.prototype.setVisible=function(h){this.element.style.display=h?"":"none",this.isVisible=h,this.coeff=1},u}();c.implement(o.prototype,d);var a=function(u){s(h,u);function h(p,g){var m=u.call(this,p,"-v")||this;return m.scrollTop=0,m.scrollHeight=0,g.$scrollbarWidth=m.width=f.scrollbarWidth(p.ownerDocument),m.inner.style.width=m.element.style.width=(m.width||15)+5+"px",m.$minWidth=0,m}return h.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var p=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-p)/(this.coeff-p)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},h.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},h.prototype.setHeight=function(p){this.element.style.height=p+"px"},h.prototype.setScrollHeight=function(p){this.scrollHeight=p,p>n?(this.coeff=n/p,p=n):this.coeff!=1&&(this.coeff=1),this.inner.style.height=p+"px"},h.prototype.setScrollTop=function(p){this.scrollTop!=p&&(this.skipEvent=!0,this.scrollTop=p,this.element.scrollTop=p*this.coeff)},h}(o);a.prototype.setInnerHeight=a.prototype.setScrollHeight;var l=function(u){s(h,u);function h(p,g){var m=u.call(this,p,"-h")||this;return m.scrollLeft=0,m.height=g.$scrollbarWidth,m.inner.style.height=m.element.style.height=(m.height||15)+5+"px",m}return h.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},h.prototype.getHeight=function(){return this.isVisible?this.height:0},h.prototype.setWidth=function(p){this.element.style.width=p+"px"},h.prototype.setInnerWidth=function(p){this.inner.style.width=p+"px"},h.prototype.setScrollWidth=function(p){this.inner.style.width=p+"px"},h.prototype.setScrollLeft=function(p){this.scrollLeft!=p&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=p)},h}(o);e.ScrollBar=a,e.ScrollBarV=a,e.ScrollBarH=l,e.VScrollBar=a,e.HScrollBar=l});ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=this&&this.__extends||function(){var l=function(u,h){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,g){p.__proto__=g}||function(p,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(p[m]=g[m])},l(u,h)};return function(u,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");l(u,h);function p(){this.constructor=u}
210u.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}}(),c=t("./lib/oop"),f=t("./lib/dom"),i=t("./lib/event"),d=t("./lib/event_emitter").EventEmitter;f.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{
211  position: absolute;
212  background: rgba(128, 128, 128, 0.6);
213  -moz-box-sizing: border-box;
214  box-sizing: border-box;
215  border: 1px solid #bbb;
216  border-radius: 2px;
217  z-index: 8;
218}
219.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {
220  position: absolute;
221  z-index: 6;
222  background: none;
223  overflow: hidden!important;
224}
225.ace_editor>.ace_sb-v {
226  z-index: 6;
227  right: 0;
228  top: 0;
229  width: 12px;
230}
231.ace_editor>.ace_sb-v div {
232  z-index: 8;
233  right: 0;
234  width: 100%;
235}
236.ace_editor>.ace_sb-h {
237  bottom: 0;
238  left: 0;
239  height: 12px;
240}
241.ace_editor>.ace_sb-h div {
242  bottom: 0;
243  height: 100%;
244}
245.ace_editor>.ace_sb_grabbed {
246  z-index: 8;
247  background: #000;
248}`,"ace_scrollbar.css",!1);var n=function(){function l(u,h){this.element=f.createElement("div"),this.element.className="ace_sb"+h,this.inner=f.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,u.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,i.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return l.prototype.setVisible=function(u){this.element.style.display=u?"":"none",this.isVisible=u,this.coeff=1},l}();c.implement(n.prototype,d);var o=function(l){s(u,l);function u(h,p){var g=l.call(this,h,"-v")||this;return g.scrollTop=0,g.scrollHeight=0,g.parent=h,g.width=g.VScrollWidth,g.renderer=p,g.inner.style.width=g.element.style.width=(g.width||15)+"px",g.$minWidth=0,g}return u.prototype.onMouseDown=function(h,p){if(h==="mousedown"&&!(i.getButton(p)!==0||p.detail===2)){if(p.target===this.inner){var g=this,m=p.clientY,y=function(L){m=L.clientY},b=function(){clearInterval(k)},C=p.clientY,E=this.thumbTop,w=function(){if(m!==void 0){var L=g.scrollTopFromThumbTop(E+m-C);L!==g.scrollTop&&g._emit("scroll",{data:L})}};i.capture(this.inner,y,b);var k=setInterval(w,20);return i.preventDefault(p)}var I=p.clientY-this.element.getBoundingClientRect().top-this.thumbHe
248ight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(I)}),i.preventDefault(p)}},u.prototype.getHeight=function(){return this.height},u.prototype.scrollTopFromThumbTop=function(h){var p=h*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return p=p>>0,p<0?p=0:p>this.pageHeight-this.viewHeight&&(p=this.pageHeight-this.viewHeight),p},u.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},u.prototype.setHeight=function(h){this.height=Math.max(0,h),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},u.prototype.setScrollHeight=function(h,p){this.pageHeight===h&&!p||(this.pageHeight=h,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},u.prototype.setScrollTop=function(h){this.scrollTop=h,h<0&&(h=0),this.thumbTop=h*(this.slideHeight-this.thumbHe
248ight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},u}(n);o.prototype.setInnerHeight=o.prototype.setScrollHeight;var a=function(l){s(u,l);function u(h,p){var g=l.call(this,h,"-h")||this;return g.scrollLeft=0,g.scrollWidth=0,g.height=g.HScrollHeight,g.inner.style.height=g.element.style.height=(g.height||12)+"px",g.renderer=p,g}return u.prototype.onMouseDown=function(h,p){if(h==="mousedown"&&!(i.getButton(p)!==0||p.detail===2)){if(p.target===this.inner){var g=this,m=p.clientX,y=function(L){m=L.clientX},b=function(){clearInterval(k)},C=p.clientX,E=this.thumbLeft,w=function(){if(m!==void 0){var L=g.scrollLeftFromThumbLeft(E+m-C);L!==g.scrollLeft&&g._emit("scroll",{data:L})}};i.capture(this.inner,y,b);var k=setInterval(w,20);return i.preventDefault(p)}var I=p.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(I)}),i.preventDefault(p)}},u.prototype.getHeight=function(){return this.isVisible?this.height:0},u.prototype.scrollLeftFromThumbLeft=function(h){var p=h*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return p=p>>0,p<0?p=0:p>this.pageWidth-this.viewWidth&&(p=this.pageWidth-this.viewWidth),p},u.prototype.setWidth=function(h){this.width=Math.max(0,h),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},u.prototype.setScrollWidth=function(h,p){this.pageWidth===h&&!p||(this.pageWidth=h,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},u.prototype.setScrollLeft=function(h){this.scrollLeft=h,h<0&&(h=0),this.thumbLeft=h*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},u}(n);a.prototype.setInnerWidth=a.prototype.setScrollWidth,e.ScrollBar=o,e.ScrollBarV=o,e.ScrollBarH=a,e.VScrollBar=o,e.HScrollBar=a});ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(t,e,r){"use strict";var s=t("./lib/event"),c=function(){function f(i,d){this.onRender=i,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=d||window;var n=this;this._flush=function(o){n.pending=!1;var a=n.changes;if(a&&(s.blockIdle(100),n.changes=0,n.onRender(a)),n.changes){if(n.$recursionLimit--<0)return;n.schedule()}else n.$recursionLimit=2}}return f.prototype.schedule=function(i){this.changes=this.changes|i,this.changes&&!this.pending&&(s.nextFrame(this._flush),this.pending=!0)},f.prototype.clear=function(i){var d=this.changes;return this.changes=0,d},f}();e.RenderLoop=c});ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(t,e,r){var s=t("../lib/oop"),c=t("../lib/dom"),f=t("../lib/lang"),i=t("../lib/event"),d=t("../lib/useragent"),n=t("../lib/event_emitter").EventEmitter,o=512,a=typeof ResizeObserver=="function",l=200,u=function(){function h(p){this.el=c.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=c.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=c.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),p.appendChild(this.el),this.$measureNode.textContent=f.stringRepeat("X",o),this.$characterSize={width:0,height:0},a?this.$addObserver():this.checkForSizeChanges()}return h.prototype.$setMeasureNodeStyles=function(p,g){p.width=p.height="auto",p.left=p.top="0px",p.visibility="hidden",p.position="absolute",p.whiteSpace="pre",d.isIE<8?p["font-family"]="inherit":p.font="inherit",p.overflow=g?"hidden":"visible"},h.prototype.checkForSizeChanges=function(p){if(p===void 0&&(p=this.$measureSizes()),p&&(this.$characterSize.width!==p.width||this.$characterSize.height!==p.height)){this.$measureNode.style.fontWeight="bold";var g=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=p,this.charSizes=Object.create(null),this.allowBoldFonts=g&&g.width===p.width&&g.height===p.height,this._emit("changeCharacterSize",{data:p})}},h.prototype.$addObserver=function(){var p=this;this.$observer=new window.ResizeObserver(function(g){p.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},h.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var p=this;return this.$pollSizeChangesTimer=i.onIdle(function g(){p.checkForSizeChanges(),i.onIdle(g,500)},500)},h.prototype.setPolling=function(p){p?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},h.prototype.$measureSizes=function(p){var g={height:(p||this.$measureNode).clientHeight,width:(p||this.$measureNode).clientWidth/o};return g.width===0||g.height===0?null:g},h.prototype.$measureCharWidth=function(p){this.$main.textContent=f.stringRepeat(p,o);var g=this.$main.getBoundingClientRect();return g.width/o},h.prototype.getCharacterWidth=function(p){var g=this.charSizes[p];return g===void 0&&(g=this.charSizes[p]=this.$measureCharWidth(p)/this.$characterSize.width),g},h.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},h.prototype.$getZoom=function(p){return!p||!p.parentElement?1:(Number(window.getComputedStyle(p).zoom)||1)*this.$getZoom(p.parentElement)},h.prototype.$initTransformMeasureNodes=function(){var p=function(g,m){return["div",{style:"position: absolute;top:"+g+"px;left:"+m+"px;"}]};this.els=c.buildDom([p(0,0),p(l,0),p(0,l),p(l,l)],this.el)},h.prototype.transformCoordinates=function(p,g){if(p){var m=this.$getZoom(this.el);p=E(1/m,p)}function y(H,W,K){var G=H[1]*W[0]-H[0]*W[1];return[(-W[1]*K[0]+W[0]*K[1])/G,(+H[1]*K[0]-H[0]*K[1])/G]}function b(H,W){return[H[0]-W[0],H[1]-W[1]]}function C(H,W){return[H[0]+W[0],H[1]+W[1]]}function E(H,W){return[H*W[0],H*W[1]]}this.els||this.$initTransformMeasureNodes();function w(H){var W=H.getBoundingClientRect();return[W.left,W.top]}var k=w(this.els[0]),I=w(this.els[1]),L=w(this.els[2]),F=w(this.els[3]),R=y(b(F,I),b(F,L),b(C(I,L),C(F,k))),M=E(1+R[0],b(I,k)),A=E(1+R[1],b(L,k));if(g){var _=g,O=R[0]*_[0]/l+R[1]*_[1]/l+1,D=C(E(_[0],M),E(_[1],A));return C(E(1/O/l,D),k)}var B=b(p,k),P=y(b(M,E(R[0],B)),b(A,E(R[1],B)),B);return E(l,P)},h}();u.prototype.$characterSize={width:0,height:0},s.implement(u.prototype,n),e.FontMetrics=u});ace.define("ace/css/editor-css",["require","exports","module"],function(t,e,r){r.exports=`
249.ace_br1 {border-top-left-radius    : 3px;}
250.ace_br2 {border-top-right-radius   : 3px;}
251.ace_br3 {border-top-left-radius    : 3px; border-top-right-radius:    3px;}
252.ace_br4 {border-bottom-right-radius: 3px;}
253.ace_br5 {border-top-left-radius    : 3px; border-bottom-right-radius: 3px;}
254.ace_br6 {border-top-right-radius   : 3px; border-bottom-right-radius: 3px;}
255.ace_br7 {border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px;}
256.ace_br8 {border-bottom-left-radius : 3px;}
257.ace_br9 {border-top-left-radius    : 3px; border-bottom-left-radius:  3px;}
258.ace_br10{border-top-right-radius   : 3px; border-bottom-left-radius:  3px;}
259.ace_br11{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-left-radius:  3px;}
260.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
261.ace_br13{border-top-left-radius    : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
262.ace_br14{border-top-right-radius   : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
263.ace_br15{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}
264
265
266.ace_editor {
267    position: relative;
268    overflow: hidden;
269    padding: 0;
270    font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 's
270ource-code-pro', monospace;
271    direction: ltr;
272    text-align: left;
273    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
274    forced-color-adjust: none;
275}
276
277.ace_scroller {
278    position: absolute;
279    overflow: hidden;
280    top: 0;
281    bottom: 0;
282    background-color: inherit;
283    -ms-user-select: none;
284    -moz-user-select: none;
285    -webkit-user-select: none;
286    user-select: none;
287    cursor: text;
288}
289
290.ace_content {
291    position: absolute;
292    box-sizing: border-box;
293    min-width: 100%;
294    contain: style size layout;
295    font-variant-ligatures: no-common-ligatures;
296}
297.ace_invisible {
298    font-variant-ligatures: none;
299}
300
301.ace_keyboard-focus:focus {
302    box-shadow: inset 0 0 0 2px #5E9ED6;
303    outline: none;
304}
305
306.ace_dragging .ace_scroller:before{
307    position: absolute;
308    top: 0;
309    left: 0;
310    right: 0;
311    bottom: 0;
312    content: '';
313    background: rgba(250, 250, 250, 0.01);
314    z-index: 1000;
315}
316.ace_dragging.ace_dark .ace_scroller:before{
317    background: rgba(0, 0, 0, 0.01);
318}
319
320.ace_gutter {
321    position: absolute;
322    overflow : hidden;
323    width: auto;
324    top: 0;
325    bottom: 0;
326    left: 0;
327    cursor: default;
328    z-index: 4;
329    -ms-user-select: none;
330    -moz-user-select: none;
331    -webkit-user-select: none;
332    user-select: none;
333    contain: style size layout;
334}
335
336.ace_gutter-active-line {
337    position: absolute;
338    left: 0;
339    right: 0;
340}
341
342.ace_scroller.ace_scroll-left:after {
343    content: "";
344    position: absolute;
345    top: 0;
346    right: 0;
347    bottom: 0;
348    left: 0;
349    box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
350    pointer-events: none;
351}
352
353.ace_gutter-cell, .ace_gutter-cell_svg-icons {
354    position: absolute;
355    top: 0;
356    left: 0;
357    right: 0;
358    padding-left: 19px;
359    padding-right: 6px;
360    background-repeat: no-repeat;
361}
362
363.ace_gutter-cell_svg-icons .ace_gutter_annotation {
364    margin-left: -14px;
365    float: left;
366}
367
368.ace_gutter-cell .ace_gutter_annotation {
369    margin-left: -19px;
370    float: left;
371}
372
373.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {
374    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitm
374k2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");
375    background-repeat: no-repeat;
376    background-position: 2px center;
377}
378
379.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {
380    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");
381    background-repeat: no-repeat;
382    background-position: 2px center;
383}
384
385.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {
386    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");
387    background-repeat: no-repeat;
388    background-position: 2px center;
389}
390
391.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {
392    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");
393}
394
395.ace_icon_svg.ace_error {
396    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");
397    background-color: crimson;
398}
399.ace_icon_svg.ace_security {
400    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");
401    background-color: crimson;
402}
403.ace_icon_svg.ace_warning {
404    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");
405    background-color: darkorange;
406}
407.ace_icon_svg.ace_info {
408    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGx
408pbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");
409    background-color: royalblue;
410}
411.ace_icon_svg.ace_hint {
412    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");
413    background-color: silver;
414}
415
416.ace_icon_svg.ace_error_fold {
417    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
418    background-color: crimson;
419}
420.ace_icon_svg.ace_security_fold {
421    -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyM
421DUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
422    background-color: crimson;
423}
424.ace_icon_svg.ace_warning_fold {
425    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");
426    background-color: darkorange;
427}
428
429.ace_scrollbar {
430    contain: strict;
431    position: absolute;
432    right: 0;
433    bottom: 0;
434    z-index: 6;
435}
436
437.ace_scrollbar-inner {
438    position: absolute;
439    cursor: text;
440    left: 0;
441    top: 0;
442}
443
444.ace_scrollbar-v{
445    overflow-x: hidden;
446    overflow-y: scroll;
447    top: 0;
448}
449
450.ace_scrollbar-h {
451    overflow-x: scroll;
452    overflow-y: hidden;
453    left: 0;
454}
455
456.ace_print-margin {
457    position: absolute;
458    height: 100%;
459}
460
461.ace_text-input {
462    position: absolute;
463    z-index: 0;
464    width: 0.5em;
465    height: 1em;
466    opacity: 0;
467    background: transparent;
468    -moz-appearance: none;
469    appearance: none;
470    border: none;
471    resize: none;
472    outline: none;
473    overflow: hidden;
474    font: inherit;
475    padding: 0 1px;
476    margin: 0 -1px;
477    contain: strict;
478    -ms-user-select: text;
479    -moz-user-select: text;
480    -webkit-user-select: text;
481    user-select: text;
482    /*with \`pre-line\` chrome inserts &nbsp; instead of space*/
483    white-space: pre!important;
484}
485.ace_text-input.ace_composition {
486    background: transparent;
487    color: inherit;
488    z-index: 1000;
489    opacity: 1;
490}
491.ace_composition_placeholder { color: transparent }
492.ace_composition_marker { 
493    border-bottom: 1px solid;
494    position: absolute;
495    border-radius: 0;
496    margin-top: 1px;
497}
498
499[ace_nocontext=true] {
500    transform: none!important;
501    filter: none!important;
502    clip-path: none!important;
503    mask : none!important;
504    contain: none!important;
505    perspective: none!important;
506    mix-blend-mode: initial!important;
507    z-index: auto;
508}
509
510.ace_layer {
511    z-index: 1;
512    position: absolute;
513    overflow: hidden;
514    /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/
515    word-wrap: normal;
516    white-space: pre;
517    height: 100%;
518    width: 100%;
519    box-sizing: border-box;
520    /* setting pointer-events: auto; on node under the mouse, which changes
521        during scroll, will break mouse wheel scrolling in Safari */
522    pointer-events: none;
523}
524
525.ace_gutter-layer {
526    position: relative;
527    width: auto;
528    text-align: right;
529    pointer-events: auto;
530    height: 1000000px;
531    contain: style size layout;
532}
533
534.ace_text-layer {
535    font: inherit !important;
536    position: absolute;
537    height: 1000000px;
538    width: 1000000px;
539    contain: style size layout;
540}
541
542.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {
543    contain: style size layout;
544    position: absolute;
545    top: 0;
546    left: 0;
547    right: 0;
548}
549
550.ace_hidpi .ace_text-layer,
551.ace_hidpi .ace_gutter-layer,
552.ace_hidpi .ace_content,
553.ace_hidpi .ace_gutter {
554    contain: strict;
555}
556.ace_hidpi .ace_text-layer > .ace_line, 
557.ace_hidpi .ace_text-layer > .ace_line_group {
558    contain: strict;
559}
560
561.ace_cjk {
562    display: inline-block;
563    text-align: center;
564}
565
566.ace_cursor-layer {
567    z-index: 4;
568}
569
570.ace_cursor {
571    z-index: 4;
572    position: absolute;
573    box-sizing: border-box;
574    border-left: 2px solid;
575    /* workaround for smooth cursor repaintng whole screen in chrome */
576    transform: translatez(0);
577}
578
579.ace_multiselect .ace_cursor {
580    border-left-width: 1px;
581}
582
583.ace_slim-cursors .ace_cursor {
584    border-left-width: 1px;
585}
586
587.ace_overwrite-cursors .ace_cursor {
588    border-left-width: 0;
589    border-bottom: 1px solid;
590}
591
592.ace_hidden-cursors .ace_cursor {
593    opacity: 0.2;
594}
595
596.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {
597    opacity: 0;
598}
599
600.ace_smooth-blinking .ace_cursor {
601    transition: opacity 0.18s;
602}
603
604.ace_animate-blinking .ace_cursor {
605    animation-duration: 1000ms;
606    animation-timing-function: step-end;
607    animation-name: blink-ace-animate;
608    animation-iteration-count: infinite;
609}
610
611.ace_animate-blinking.ace_smooth-blinking .ace_cursor {
612    animation-duration: 1000ms;
613    animation-timing-function: ease-in-out;
614    animation-name: blink-ace-animate-smooth;
615}
616    
617@keyframes blink-ace-animate {
618    from, to { opacity: 1; }
619    60% { opacity: 0; }
620}
621
622@keyframes blink-ace-animate-smooth {
623    from, to { opacity: 1; }
624    45% { opacity: 1; }
625    60% { opacity: 0; }
626    85% { opacity: 0; }
627}
628
629.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
630    position: absolute;
631    z-index: 3;
632}
633
634.ace_marker-layer .ace_selection {
635    position: absolute;
636    z-index: 5;
637}
638
639.ace_marker-layer .ace_bracket {
640    position: absolute;
641    z-index: 6;
642}
643
644.ace_marker-layer .ace_error_bracket {
645    position: absolute;
646    border-bottom: 1px solid #DE5555;
647    border-radius: 0;
648}
649
650.ace_marker-layer .ace_active-line {
651    position: absolute;
652    z-index: 2;
653}
654
655.ace_marker-layer .ace_selected-word {
656    position: absolute;
657    z-index: 4;
658    box-sizing: border-box;
659}
660
661.ace_line .ace_fold {
662    box-sizing: border-box;
663
664    display: inline-block;
665    height: 11px;
666    margin-top: -2px;
667    vertical-align: middle;
668
669    background-image:
670        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
671        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");
672    background-repeat: no-repeat, repeat-x;
673    background-position: center center, top left;
674    color: transparent;
675
676    border: 1px solid black;
677    border-radius: 2px;
678
679    cursor: pointer;
680    pointer-events: auto;
681}
682
683.ace_dark .ace_fold {
684}
685
686.ace_fold:hover{
687    background-image:
688        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
689        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");
690}
691
692.ace_tooltip {
693    background-color: #f5f5f5;
694    border: 1px solid gray;
695    border-radius: 1px;
696    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
697    color: black;
698    padding: 3px 4px;
699    position: fixed;
700    z-index: 999999;
701    box-sizing: border-box;
702    cursor: default;
703    white-space: pre-wrap;
704    word-wrap: break-word;
705    line-height: normal;
706    font-style: normal;
707    font-weight: normal;
708    letter-spacing: normal;
709    pointer-events: none;
710    overflow: auto;
711    max-width: min(33em, 66vw);
712    overscroll-behavior: contain;
713}
714.ace_tooltip pre {
715    white-space: pre-wrap;
716}
717
718.ace_tooltip.ace_dark {
719    background-color: #636363;
720    color: #fff;
721}
722
723.ace_tooltip:focus {
724    outline: 1px solid #5E9ED6;
725}
726
727.ace_icon {
728    display: inline-block;
729    width: 18px;
730    vertical-align: top;
731}
732
733.ace_icon_svg {
734    display: inline-block;
735    width: 12px;
736    vertical-align: top;
737    -webkit-mask-repeat: no-repeat;
738    -webkit-mask-size: 12px;
739    -webkit-mask-position: center;
740}
741
742.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {
743    padding-right: 13px;
744}
745
746.ace_fold-widget, .ace_custom-widget {
747    box-sizing: border-box;
748
749    margin: 0 -12px 0 1px;
750    display: none;
751    width: 11px;
752    vertical-align: top;
753
754    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVo
754DBUxKAAAAABJRU5ErkJggg==");
755    background-repeat: no-repeat;
756    background-position: center;
757
758    border-radius: 3px;
759    
760    border: 1px solid transparent;
761    cursor: pointer;
762}
763
764.ace_custom-widget {
765    background: none;
766}
767
768.ace_folding-enabled .ace_fold-widget {
769    display: inline-block;   
770}
771
772.ace_fold-widget.ace_end {
773    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");
774}
775
776.ace_fold-widget.ace_closed {
777    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");
778}
779
780.ace_fold-widget:hover {
781    border: 1px solid rgba(0, 0, 0, 0.3);
782    background-color: rgba(255, 255, 255, 0.2);
783    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
784}
785
786.ace_fold-widget:active {
787    border: 1px solid rgba(0, 0, 0, 0.4);
788    background-color: rgba(0, 0, 0, 0.05);
789    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
790}
791/**
792 * Dark version for fold widgets
793 */
794.ace_dark .ace_fold-widget {
795    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
796}
797.ace_dark .ace_fold-widget.ace_end {
798    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
799}
800.ace_dark .ace_fold-widget.ace_closed {
801    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
802}
803.ace_dark .ace_fold-widget:hover {
804    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
805    background-color: rgba(255, 255, 255, 0.1);
806}
807.ace_dark .ace_fold-widget:active {
808    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
809}
810
811.ace_inline_button {
812    border: 1px solid lightgray;
813    display: inline-block;
814    margin: -1px 8px;
815    padding: 0 5px;
816    pointer-events: auto;
817    cursor: pointer;
818}
819.ace_inline_button:hover {
820    border-color: gray;
821    background: rgba(200,200,200,0.2);
822    display: inline-block;
823    pointer-events: auto;
824}
825
826.ace_fold-widget.ace_invalid {
827    background-color: #FFB4B4;
828    border-color: #DE5555;
829}
830
831.ace_fade-fold-widgets .ace_fold-widget {
832    transition: opacity 0.4s ease 0.05s;
833    opacity: 0;
834}
835
836.ace_fade-fold-widgets:hover .ace_fold-widget {
837    transition: opacity 0.05s ease 0.05s;
838    opacity:1;
839}
840
841.ace_underline {
842    text-decoration: underline;
843}
844
845.ace_bold {
846    font-weight: bold;
847}
848
849.ace_nobold .ace_bold {
850    font-weight: normal;
851}
852
853.ace_italic {
854    font-style: italic;
855}
856
857
858.ace_error-marker {
859    background-color: rgba(255, 0, 0,0.2);
860    position: absolute;
861    z-index: 9;
862}
863
864.ace_highlight-marker {
865    background-color: rgba(255, 255, 0,0.2);
866    position: absolute;
867    z-index: 8;
868}
869
870.ace_mobile-menu {
871    position: absolute;
872    line-height: 1.5;
873    border-radius: 4px;
874    -ms-user-select: none;
875    -moz-user-select: none;
876    -webkit-user-select: none;
877    user-select: none;
878    background: white;
879    box-shadow: 1px 3px 2px grey;
880    border: 1px solid #dcdcdc;
881    color: black;
882}
883.ace_dark > .ace_mobile-menu {
884    background: #333;
885    color: #ccc;
886    box-shadow: 1px 3px 2px grey;
887    border: 1px solid #444;
888
889}
890.ace_mobile-button {
891    padding: 2px;
892    cursor: pointer;
893    overflow: hidden;
894}
895.ace_mobile-button:hover {
896    background-color: #eee;
897    opacity:1;
898}
899.ace_mobile-button:active {
900    background-color: #ddd;
901}
902
903.ace_placeholder {
904    position: relative;
905    font-family: arial;
906    transform: scale(0.9);
907    transform-origin: left;
908    white-space: pre;
909    opacity: 0.7;
910    margin: 0 10px;
911    z-index: 1;
912}
913
914.ace_ghost_text {
915    opacity: 0.5;
916    font-style: italic;
917}
918
919.ace_ghost_text_container > div {
920    white-space: pre;
921}
922
923.ghost_text_line_wrapped::after {
924    content: "\u21A9";
925    position: absolute;
926}
927
928.ace_lineWidgetContainer.ace_ghost_text {
929    margin: 0px 4px
930}
931
932.ace_screenreader-only {
933    position:absolute;
934    left:-10000px;
935    top:auto;
936    width:1px;
937    height:1px;
938    overflow:hidden;
939}
940
941.ace_hidden_token {
942    display: none;
943}`});ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=t("../lib/oop"),f=t("../lib/event_emitter").EventEmitter,i=function(){function d(n,o){this.canvas=s.createElement("canvas"),this.renderer=o,this.pixelRatio=1,this.maxHeight=o.layerConfig.maxHeight,this.lineHeight=o.layerConfig.lineHeight,this.canvasHeight=n.parent.scrollHeight,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvasWidth=n.width,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},n.element.appendChild(this.canvas)}return d.prototype.$updateDecorators=function(n){var o=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;if(n){this.maxHeight=n.maxHeight,this.lineHeight=n.lineHeight,this.canvasHeight=n.height;
943var a=(n.lastRow+1)*this.lineHeight;a<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight}var l=this.canvas.getContext("2d");function u(F,R){return F.priority<R.priority?-1:F.priority>R.priority?1:0}var h=this.renderer.session.$annotations;if(l.clearRect(0,0,this.canvas.width,this.canvas.height),h){var p={info:1,warning:2,error:3};h.forEach(function(F){F.priority=p[F.type]||null}),h=h.sort(u);for(var g=this.renderer.session.$foldData,m=0;m<h.length;m++){var y=h[m].row,b=this.compensateFoldRows(y,g),C=Math.round((y-b)*this.lineHeight*this.heightRatio),E=Math.round((y-b)*this.lineHeight*this.heightRatio),w=Math.round(((y-b)*this.lineHeight+this.lineHeight)*this.heightRatio),k=w-E;if(k<this.minDecorationHeight){var I=(E+w)/2|0;I<this.halfMinDecorationHeight?I=this.halfMinDecorationHeight:I+this.halfMinDecorationHeight>this.canvasHeight&&(I=this.canvasHeight-this.halfMinDecorationHeight),E=Math.round(I-this.halfMinDecorationHeight),w=Math.round(I+this.halfMinDecorationHeight)}l.fillStyle=o[h[m].type]||null,l.fillRect(0,C,this.canvasWidth,w-E)}}var L=this.renderer.session.selection.getCursor();if(L){var b=this.compensateFoldRows(L.row,g),C=Math.round((L.row-b)*this.lineHeight*this.heightRatio);l.fillStyle="rgba(0, 0, 0, 0.5)",l.fillRect(0,C,this.canvasWidth,2)}},d.prototype.compensateFoldRows=function(n,o){var a=0;if(o&&o.length>0)for(var l=0;l<o.length;l++)n>o[l].start.row&&n<o[l].end.row?a+=n-o[l].start.row:n>=o[l].end.row&&(a+=o[l].end.row-o[l].start.row);return a},d}();c.implement(i.prototype,f),e.Decorator=i});ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(t,e,r){"use strict";var s=t("./lib/oop"),c=t("./lib/dom"),f=t("./lib/lang"),i=t("./config"),d=t("./layer/gutter").Gutter,n=t("./layer/marker").Marker,o=t("./layer/text").Text,a=t("./layer/cursor").Cursor,l=t("./scrollbar").HScrollBar,u=t("./scrollbar").VScrollBar,h=t("./scrollbar_custom").HScrollBar,p=t("./scrollbar_custom").VScrollBar,g=t("./renderloop").Ren
vendor: 4,689 bytes, line 943
943derLoop,m=t("./layer/font_metrics").FontMetrics,y=t("./lib/event_emitter").EventEmitter,b=t("./css/editor-css"),C=t("./layer/decorators").Decorator,E=t("./lib/useragent"),w=t("./layer/text_util").isTextToken;c.importCssString(b,"ace_editor.css",!1);var k=function(){function I(L,F){var R=this;this.container=L||c.createElement("div"),c.addCssClass(this.container,"ace_editor"),c.HI_DPI&&c.addCssClass(this.container,"ace_hidpi"),this.setTheme(F),i.get("useStrictCSP")==null&&i.set("useStrictCSP",!1),this.$gutter=c.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=c.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=c.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new d(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new n(this.content);var M=this.$textLayer=new o(this.content);this.canvas=M.element,this.$markerFront=new n(this.content),this.$cursorLayer=new a(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new u(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(A){R.$scrollAnimation||R.session.setScrollTop(A.data-R.scrollMargin.top)}),this.scrollBarH.on("scroll",function(A){R.$scrollAnimation||R.session.setScrollLeft(A.data-R.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new m(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(A){R.updateCharacterSize(),R.onResize(!0,R.gutterWidth,R.$size.width,R.$size.height),R._signal("changeCharacterSize",A)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!E.isIOS,this.$loop=new g(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),i.resetOptions(this),i._signal("renderer",this)}return I.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),c.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},I.prototype.setSession=function(L){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=L,L&&this.scrollMargin.top&&L.getScrollTop()<=0&&L.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(L),this.$markerBack.setSession(L),this.$markerFront.setSession(L),this.$gutterLayer.setSession(L),this.$textLayer.setSession(L),L&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},I.prototype.updateLines=function(L,F,R){if(F===void 0&&(F=1/0),this.$changedLines?(this.$changedLines.firstRow>L&&(this.$changedLines.firstRow=L),this.$changedLines.lastRow<F&&(this.$changedLines.lastRow=F)):this.$changedLines={firstRow:L,lastRow:F},this.$changedLines.lastRow<this.layerConfig.firstRow)if(R)this.$changedLines.lastRow=this.layerConfig.lastRow;else return;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},I.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},I.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},I.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},I.prototype.updateFull=function(L){L?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},I.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()}
943,I.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},I.prototype.onResize=function(L,F,R,M){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=L?1:0;var A=this.container;M||(M=A.clientHeight||A.scrollHeight),!M&&this.$maxLines&&this.lineHeight>1&&(!A.style.height||A.style.height=="0px")&&(A.style.height="1px",M=A.clientHeight||A.scrollHeight),R||(R=A.clientWidth||A.scrollWidth);var _=this.$updateCachedSize(L,F,R,M);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!R&&!M)return this.resizing=0;L&&(this.$gutterLayer.$padding=null),L?this.$renderChanges(_|this.$changes,!0):this.$loop.schedule(_|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},I.prototype.$updateCachedSize=function(L,F,R,M){M-=this.$extraHeight||0;var A=0,_=this.$size,O={width:_.width,height:_.height,scrollerHeight:_.scrollerHeight,scrollerWidth:_.scrollerWidth};if(M&&(L||_.height!=M)&&(_.height=M,A|=this.CHANGE_SIZE,_.scrollerHeight=_.height,this.$horizScroll&&(_.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(_.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",A=A|this.CHANGE_SCROLL),R&&(L||_.width!=R)){A|=this.CHANGE_SIZE,_.width=R,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,c.setStyle(this.scrollBarH.element.style,"left",F+"px"),c.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),_.scrollerWidth=Math.max(0,R-F-this.scrollBarV.getWidth()-this.margin.h),c.setStyle(this.$gutter.style,"left",this.margin.left+"px");var D=this.scrollBarV.getWidth()+"px";c.setStyle(this.scrollBarH.element.style,"right",D),c.setStyle(this.scroller.style,"right",D),c.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(_.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||L)&&(A|=this.CHANGE_FULL)}return _.$dirty=!R||!M,A&&this._signal("resize",O),A},I.prototype.onGutterResize=function(L){var F=this.$showGutter?L:0;F!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,F,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},I.prototype.adjustWrapLimit=function(){var L=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(L/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},I.prototype.setAnimatedScroll=function(L){this.setOption("animatedScroll",L)},I.prototype.getAnimatedScroll=function(){return this.$animatedScroll},I.prototype.setShowInvisibles=function(L){this.setOption("showInvisibles",L),this.session.$bidiHandler.setShowInvisibles(L)},I.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},I.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},I.prototype.setDisplayIndentGuides=function(L){this.setOption("displayIndentGuides",L)},I.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},I.prototype.setHighlightIndentGuides=function(L){this.setOption("highlightIndentGuides",L)},I.prototype.setShowPrintMargin=function(L){this.setOption("showPrintMargin",L)},I.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},I.prototype.setPrintMarginColumn=function(L){this.setOption("printMarginColumn",L)},I.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},I.prototype.getShowGutter=function(){return this.getOption("showGutter")},I.prototype.setShowGutter=function(L){return this.setOption("showGutter",L)},I.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},I.prototype.setFadeFoldWidgets=function(L){this.setOption("fadeFoldWidgets",L)},I.prototype.setHighlightGutterLine=function(L){this.setOption("highlightGutterLine",L)},I.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},I.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var L=c.createElement("div");L.className="ace_layer ace_print-margin-layer",this.$printMarginEl=c.createElement("div"),this.$printMarginEl.className="ace_print-margin",L.appendChild(this.$printMarginEl),this.content.insertBefore(L,this.content.firstChild)}var F=this.$printMarginEl.style;F.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",F.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},I.prototype.getContainerElement=function(){return this.container},I.prototype.getMouseEventTarget=function(){return this.scroller},I.prototype.getTextAreaContainer=function(){return this.container},I.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var L=this.textarea.style,F=this.$composition;
943if(!this.$keepTextAreaAtCursor&&!F){c.translate(this.textarea,-100,0);return}var R=this.$cursorLayer.$pixelPos;if(R){F&&F.markerRange&&(R=this.$cursorLayer.getPixelPosition(F.markerRange.start,!0));var M=this.layerConfig,A=R.top,_=R.left;A-=M.offset;var O=F&&F.useTextareaForIME||E.isMobile?this.lineHeight:1;if(A<0||A>M.height-O){c.translate(this.textarea,0,0);return}var D=1,B=this.$size.height-O;if(!F)A+=this.lineHeight;else if(F.useTextareaForIME){var P=this.textarea.value;D=this.characterWidth*this.session.$getStringScreenWidth(P)[0]}else A+=this.lineHeight+2;_-=this.scrollLeft,_>this.$size.scrollerWidth-D&&(_=this.$size.scrollerWidth-D),_+=this.gutterWidth+this.margin.left,c.setStyle(L,"height",O+"px"),c.setStyle(L,"width",D+"px"),c.translate(this.textarea,Math.min(_,this.$size.scrollerWidth-D),Math.min(A,B))}}},I.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},I.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},I.prototype.getLastFullyVisibleRow=function(){var L=this.layerConfig,F=L.lastRow,R=this.session.documentToScreenRow(F,0)*L.lineHeight;return R-this.session.getScrollTop()>L.height-L.lineHeight?F-1:F},I.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},I.prototype.setPadding=function(L){this.$padding=L,this.$textLayer.setPadding(L),this.$cursorLayer.setPadding(L),this.$markerFront.setPadding(L),this.$markerBack.setPadding(L),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},I.prototype.setScrollMargin=function(L,F,R,M){var A=this.scrollMargin;A.top=L|0,A.bottom=F|0,A.right=M|0,A.left=R|0,A.v=A.top+A.bottom,A.h=A.left+A.right,A.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-A.top),this.updateFull()},I.prototype.setMargin=function(L,F,R,M){var A=this.margin;A.top=L|0,A.bottom=F|0,A.right=M|0,A.left=R|0,A.v=A.top+A.bottom,A.h=A.left+A.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},I.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},I.prototype.setHScrollBarAlwaysVisible=function(L){this.setOption("hScrollBarAlwaysVisible",L)},I.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},I.prototype.setVScrollBarAlwaysVisible=function(L){this.setOption("vScrollBarAlwaysVisible",L)},I.prototype.$updateScrollBarV=function(){var L=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(L-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>L-F&&(L=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(L+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},I.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},I.prototype.freeze=function(){this.$frozen=!0},I.prototype.unfreeze=function(){this.$frozen=!1},I.prototype.$renderChanges=function(L,F){if(this.$changes&&(L|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!L&&!F){this.$changes|=L;return}if(this.$size.$dirty)return this.$changes|=L,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",L),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var R=this.layerConfig;if(L&this.CHANGE_FULL||L&this.CHANGE_SIZE||L&this.CHANGE_TEXT||L&this.CHANGE_LINES||L&this.CHANGE_SCROLL||L&this.CHANGE_H_SCROLL){if(L|=this.$computeLayerConfig()|this.$loop.clear(),R.firstRow!=this.layerConfig.firstRow&&R.firstRowScreen==this.layerConfig.firstRowScreen){var M=this.scrollTop+(R.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;M>0&&(this.scrollTop=M,L=L|this.CHANGE_SCROLL,L|=this.$computeLayerConfig()|this.$loop.clear())}R=this.layerConfig,this.$updateScrollBarV(),L&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),c.translate(this.content,-this.scrollLeft,-R.offset);var A=R.width+2*this.$padding+"px",_=R.minHeight+"px";c.setStyle(this.content.style,"width",A),c.setStyle(this.content.style,"height",_)}if(L&this.CHANGE_H_SCROLL&&(c.translate(this.content,-this.scrollLeft,-R.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),L&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(R),this.$showGutter&&this.$gutterLayer.update(R),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R),this.$markerBack.update(R),this.$markerFront.update(R),this.$curs
943orLayer.update(R),this.$moveTextAreaToCursor(),this._signal("afterRender",L);return}if(L&this.CHANGE_SCROLL){this.$changedLines=null,L&this.CHANGE_TEXT||L&this.CHANGE_LINES?this.$textLayer.update(R):this.$textLayer.scrollLines(R),this.$showGutter&&(L&this.CHANGE_GUTTER||L&this.CHANGE_LINES?this.$gutterLayer.update(R):this.$gutterLayer.scrollLines(R)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R),this.$markerBack.update(R),this.$markerFront.update(R),this.$cursorLayer.update(R),this.$moveTextAreaToCursor(),this._signal("afterRender",L);return}L&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(R),this.$showGutter&&this.$gutterLayer.update(R),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R)):L&this.CHANGE_LINES?((this.$updateLines()||L&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(R),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R)):L&this.CHANGE_TEXT||L&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(R),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R)):L&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(R),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(R)),L&this.CHANGE_CURSOR&&(this.$cursorLayer.update(R),this.$moveTextAreaToCursor()),L&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(R),L&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(R),this._signal("afterRender",L)},I.prototype.$autosize=function(){var L=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,R=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,L))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(R+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&R>this.$maxPixelHeight&&(R=this.$maxPixelHeight);var M=R<=2*this.lineHeight,A=!M&&L>F;if(R!=this.desiredHeight||this.$size.height!=this.desiredHeight||A!=this.$vScroll){A!=this.$vScroll&&(this.$vScroll=A,this.scrollBarV.setVisible(A));var _=this.container.clientWidth;this.container.style.height=R+"px",this.$updateCachedSize(!0,this.$gutterWidth,_,R),this.desiredHeight=R,this._signal("autosize")}},I.prototype.$computeLayerConfig=function(){var L=this.session,F=this.$size,R=F.height<=2*this.lineHeight,M=this.session.getScreenLength(),A=M*this.lineHeight,_=this.$getLongestLine(),O=!R&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-_-2*this.$padding<0),D=this.$horizScroll!==O;D&&(this.$horizScroll=O,this.scrollBarH.setVisible(O));var B=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),R=F.height<=2*this.lineHeight);var P=F.scrollerHeight+this.lineHeight,H=!this.$maxLines&&this.$scrollPastEnd?(F.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;A+=H;var W=this.scrollMargin;this.session.setScrollTop(Math.max(-W.top,Math.min(this.scrollTop,A-F.scrollerHeight+W.bottom))),this.session.setScrollLeft(Math.max(-W.left,Math.min(this.scrollLeft,_+2*this.$padding-F.scrollerWidth+W.right)));var K=!R&&(this.$vScrollBarAlwaysVisible||F.scrollerHeight-A+H<0||this.scrollTop>W.top),G=B!==K;G&&(this.$vScroll=K,this.scrollBarV.setVisible(K));var X=this.scrollTop%this.lineHeight,Z=Math.ceil(P/this.lineHeight)-1,q=Math.max(0,Math.round((this.scrollTop-X)/this.lineHeight)),Q=q+Z,ie,ae,oe=this.lineHeight;q=L.screenToDocumentRow(q,0);var fe=L.getFoldLine(q);fe&&(q=fe.start.row),ie=L.documentToScreenRow(q,0),ae=L.getRowLength(q)*oe,Q=Math.min(L.screenToDocumentRow(Q,0),L.getLength()-1),P=F.scrollerHeight+L.getRowLength(Q)*oe+ae,X=this.scrollTop-ie*oe;var he=0;return(this.layerConfig.width!=_||D)&&(he=this.CHANGE_H_SCROLL),(D||G)&&(he|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),G&&(_=this.$getLongestLine())),this.layerConfig={width:_,padding:this.$padding,firstRow:q,firstRowScreen:ie,lastRow:Q,lineHeight:oe,characterWidth:this.characterWidth,minHeight:P,maxHeight:A,offset:X,gutterOffset:oe?Math.max(0,Math.ceil((X+F.height-F.scrollerHeight)/oe)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(_-this.$padding),he},I.prototype.$updateLines=function(){if(this.$changedLines){var L=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var R=this.layerConfig;if(!(L>
943R.lastRow+1)&&!(F<R.firstRow)){if(F===1/0){this.$showGutter&&this.$gutterLayer.update(R),this.$textLayer.update(R);return}return this.$textLayer.updateLines(R,L,F),!0}}},I.prototype.$getLongestLine=function(){var L=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(L+=1),this.$textLayer&&L>this.$textLayer.MAX_LINE_LENGTH&&(L=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(L*this.characterWidth))},I.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},I.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},I.prototype.addGutterDecoration=function(L,F){this.$gutterLayer.addGutterDecoration(L,F)},I.prototype.removeGutterDecoration=function(L,F){this.$gutterLayer.removeGutterDecoration(L,F)},I.prototype.updateBreakpoints=function(L){this._rows=L,this.$loop.schedule(this.CHANGE_GUTTER)},I.prototype.setAnnotations=function(L){this.$gutterLayer.setAnnotations(L),this.$loop.schedule(this.CHANGE_GUTTER)},I.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},I.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},I.prototype.showCursor=function(){this.$cursorLayer.showCursor()},I.prototype.scrollSelectionIntoView=function(L,F,R){this.scrollCursorIntoView(L,R),this.scrollCursorIntoView(F,R)},I.prototype.scrollCursorIntoView=function(L,F,R){if(this.$size.scrollerHeight!==0){var M=this.$cursorLayer.getPixelPosition(L),A=M.left,_=M.top,O=R&&R.top||0,D=R&&R.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var B=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;B+O>_?(F&&B+O>_+this.lineHeight&&(_-=F*this.$size.scrollerHeight),_===0&&(_=-this.scrollMargin.top),this.session.setScrollTop(_)):B+this.$size.scrollerHeight-D<_+this.lineHeight&&(F&&B+this.$size.scrollerHeight-D<_-this.lineHeight&&(_+=F*this.$size.scrollerHeight),this.session.setScrollTop(_+this.lineHeight+D-this.$size.scrollerHeight));var P=this.scrollLeft,H=2*this.layerConfig.characterWidth;A-H<P?(A-=H,A<this.$padding+H&&(A=-this.scrollMargin.left),this.session.setScrollLeft(A)):(A+=H,P+this.$size.scrollerWidth<A+this.characterWidth?this.session.setScrollLeft(Math.round(A+this.characterWidth-this.$size.scrollerWidth)):P<=this.$padding&&A-P<this.characterWidth&&this.session.setScrollLeft(0))}},I.prototype.getScrollTop=function(){return this.session.getScrollTop()},I.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},I.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},I.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},I.prototype.scrollToRow=function(L){this.session.setScrollTop(L*this.lineHeight)},I.prototype.alignCursor=function(L,F){typeof L=="number"&&(L={row:L,column:0});var R=this.$cursorLayer.getPixelPosition(L),M=this.$size.scrollerHeight-this.lineHeight,A=R.top-M*(F||0);return this.session.setScrollTop(A),A},I.prototype.$calcSteps=function(L,F){var R=0,M=this.STEPS,A=[],_=function(O,D,B){return B*(Math.pow(O-1,3)+1)+D};for(R=0;R<M;++R)A.push(_(R/this.STEPS,L,F-L));return A},I.prototype.scrollToLine=function(L,F,R,M){var A=this.$cursorLayer.getPixelPosition({row:L,column:0}),_=A.top;F&&(_-=this.$size.scrollerHeight/2);var O=this.scrollTop;this.session.setScrollTop(_),R!==!1&&this.animateScrolling(O,M)},I.prototype.animateScrolling=function(L,F){var R=this.scrollTop;if(!this.$animatedScroll)return;var M=this;if(L==R)return;if(this.$scrollAnimation){var A=this.$scrollAnimation.steps;if(A.length&&(L=A[0],L==R))return}var _=M.$calcSteps(L,R);this.$scrollAnimation={from:L,to:R,steps:_},clearInterval(this.$timer),M.session.setScrollTop(_.shift()),M.session.$scrollTop=R;function O(){M.$timer=clearInterval(M.$timer),M.$scrollAnimation=null,M.$stopAnimation=!1,F&&F()}this.$timer=setInterval(function(){if(M.$stopAnimation){O();return}if(!M.session)return clearInterval(M.$timer);_.length?(M.session.setScrollTop(_.shift()),M.session.$scrollTop=R):R!=null?(M.session.$scrollTop=-1,M.session.setScrollTop(R),R=null):O()},10)},I.prototype.scrollToY=function(L){this.scrollTop!==L&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=L)},I.prototype.scrollToX=function(L){this.scrollLeft!==L&&(this.scrollLeft=L),this.$loop.schedule(this.CHANGE_H_SCROLL)},I.prototype.scrollTo=function(L,F){this.session.setScrollTop(F),this.session.setScrollLeft(L)},I.prototype.scrollBy=function(L,F){F&&this.session.setScrollTop(this.session.getScrollTop()+F),L&&this.session.setScrollLeft(this.session.getScrollLeft()+L)},I.prototype.isScrollableBy=function(L,F){if(F<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||F>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||L<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||L>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},I.prototype.pixelToScreenCoordinates=function(L,F){var R;if(this.$hasCssTransforms){R={top:0,left:0};var M=this.$fontMetrics.transformCoordinates([L,F]);L=M[1]-this.gutterWidth-this.margin.left,F=M[0]}else R=this.scroller.getBoundingClientRect();var A=L+this.scrollLeft-R.left-this.$padding,_=A/this.characterWidth,O=Math.floor((F+this.scrollTop-R.top)/this.lineHeight),D=this.$blockCursor?Math.floor(_):Math.round(_);return{row:O,column:D,side:_-D>0?1:-1,offsetX:A}},I.prototype.screenToTextCoordinates=function(L,F){var R;if(this.$hasCssTransforms){R={top:0,left:0};var M=this.$fontMetrics.transformCoordinates([L,F]);L=M[1]-this.gutterWidth-this.margin.left,F=M[0]}else R=this.scroller.getBoundingClientRect();var A=L+this.scrollLeft-R.left-this.$padding,_=A/this.characterWidth,O=this.$blockCursor?Math.floor(_):Math.round(_),D=Math.floor((F+this.scrollTop-R.top)/this.lineHeight);return this.session.screenToDocumentPosition(D,Math.max(O,0),A)},I.prototype.textToScreenCoordinates=function(L,F){var R=this.scroller.getBoundingClientRect(),M=this.session.documentToScreenPosition(L,F),A=this.$padding+(this.session.$bidiHandler.isBidiRow(M.row,L)?this.session.$bidiHandler.getPosLeft(M.column):Math.round(M.column*this.characterWidth)),_=M.row*this.lineHeight;return{pageX:R.left+A-this.scrollLeft,pageY:R.top+_-this.scrollTop}},I.prototype.visualizeFocus=function(){c.addCssClass(this.container,"ace_focus")},I.prototype.visualizeBlur=function(){c.removeCssClass(this.container,"ace_focus")},I.prototype.showComposition=function(L){this.$composition=L,L.cssText||(L.cssText=this.textarea.style.cssText),L.useTextareaForIME==null&&(L.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(c.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$curs
943orLayer.element.style.display="none"):L.markerId=this.session.addMarker(L.markerRange,"ace_composition_marker","text")},I.prototype.setCompositionText=function(L){var F=this.session.selection.cursor;this.addToken(L,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},I.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),c.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var L=this.session.selection.cursor;this.removeExtraToken(L.row,L.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},I.prototype.setGhostText=function(L,F){var R=this.session.selection.cursor,M=F||{row:R.row,column:R.column};this.removeGhostText();var A=this.$calculateWrappedTextChunks(L,M);this.addToken(A[0].text,"ghost_text",M.row,M.column),this.$ghostText={text:L,position:{row:M.row,column:M.column}};var _=c.createElement("div");if(A.length>1){var O=this.hideTokensAfterPosition(M.row,M.column),D;A.slice(1).forEach(function(G){var X=c.createElement("div"),Z=c.createElement("span");Z.className="ace_ghost_text",G.wrapped&&(X.className="ghost_text_line_wrapped"),G.text.length===0&&(G.text=" "),Z.appendChild(c.createTextNode(G.text)),X.appendChild(Z),_.appendChild(X),D=X}),O.forEach(function(G){var X=c.createElement("span");w(G.type)||(X.className="ace_"+G.type.replace(/\./g," ace_")),X.appendChild(c.createTextNode(G.value)),D.appendChild(X)}),this.$ghostTextWidget={el:_,row:M.row,column:M.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var B=this.$cursorLayer.getPixelPosition(M,!0),P=this.container,H=P.getBoundingClientRect().height,W=A.length*this.lineHeight,K=W<H-B.top;if(K)return;W<H?this.scrollBy(0,(A.length-1)*this.lineHeight):this.scrollToRow(M.row)}},I.prototype.$calculateWrappedTextChunks=function(L,F){var R=this.$size.scrollerWidth-this.$padding*2,M=Math.floor(R/this.characterWidth)-2;M=M<=0?60:M;for(var A=L.split(/\r?\n/),_=[],O=0;O<A.length;O++){var D=this.session.$getDisplayTokens(A[O],F.column),B=this.session.$computeWrapSplits(D,M,this.session.$tabSize);if(B.length>0){var P=0;B.push(A[O].length);for(var H=0;H<B.length;H++){var W=A[O].slice(P,B[H]);_.push({text:W,wrapped:!0}),P=B[H]}}else _.push({text:A[O],wrapped:!1})}return _},I.prototype.removeGhostText=function(){if(this.$ghostText){var L=this.$ghostText.position;this.removeExtraToken(L.row,L.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},I.prototype.addToken=function(L,F,R,M){var A=this.session;A.bgTokenizer.lines[R]=null;var _={type:F,value:L},O=A.getTokens(R);if(M==null||!O.length)O.push(_);else for(var D=0,B=0;B<O.length;B++){var P=O[B];if(D+=P.value.length,M<=D){var H=P.value.length-(D-M),W=P.value.slice(0,H),K=P.value.slice(H);O.splice(B,1,{type:P.type,value:W},_,{type:P.type,value:K});break}}this.updateLines(R,R)},I.prototype.hideTokensAfterPosition=function(L,F){for(var R=this.session.getTokens(L),M=0,A=!1,_=[],O=0;O<R.length;O++){var D=R[O];if(M+=D.value.length,D.type!=="ghost_text"){if(A){_.push({type:D.type,value:D.value}),D.type="hidden_token";continue}M===F&&(A=!0)}}return this.updateLines(L,L),_},I.prototype.removeExtraToken=function(L,F){this.session.bgTokenizer.lines[L]=null,this.updateLines(L,L)},I.prototype.setTheme=function(L,F){var R=this;if(this.$themeId=L,R._dispatchEvent("themeChange",{theme:L}),!L||typeof L=="string"){var M=L||this.$options.theme.initialValue;i.loadModule(["theme",M],A)}else A(L);function A(_){if(R.$themeId!=L)return F&&F();if(!_||!_.cssClass)throw new Error("couldn't load module "+L+" or it didn't call define");_.$id&&(R.$themeId=_.$id),c.importCssString(_.cssText,_.cssClass,R.container),R.theme&&c.removeCssClass(R.container,R.theme.cssClass);var O="padding"in _?_.padding:"padding"in(R.theme||{})?4:R.$padding;R.$padding&&O!=R.$padding&&R.setPadding(O),R.$theme=_.cssClass,R.theme=_,c.addCssClass(R.container,_.cssClass),c.setCssClass(R.c
943ontainer,"ace_dark",_.isDark),R.$size&&(R.$size.width=0,R.$updateSizeAsync()),R._dispatchEvent("themeLoaded",{theme:_}),F&&F(),E.isSafari&&R.scroller&&(R.scroller.style.background="red",R.scroller.style.background="")}},I.prototype.getTheme=function(){return this.$themeId},I.prototype.setStyle=function(L,F){c.setCssClass(this.container,L,F!==!1)},I.prototype.unsetStyle=function(L){c.removeCssClass(this.container,L)},I.prototype.setCursorStyle=function(L){c.setStyle(this.scroller.style,"cursor",L)},I.prototype.setMouseCursor=function(L){c.setStyle(this.scroller.style,"cursor",L)},I.prototype.attachToShadowRoot=function(){c.importCssString(b,"ace_editor.css",this.container)},I.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},I.prototype.$updateCustomScrollbar=function(L){var F=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,L===!0?(this.scrollBarV=new p(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(R){F.$scrollAnimation||F.session.setScrollTop(R.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(R){F.$scrollAnimation||F.session.setScrollLeft(R.data-F.scrollMargin.left)}),this.$scrollDecorator=new C(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new u(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.addEventListener("scroll",function(R){F.$scrollAnimation||F.session.setScrollTop(R.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(R){F.$scrollAnimation||F.session.setScrollLeft(R.data-F.scrollMargin.left)}))},I.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var L=this;this.$resizeTimer=f.delayedCall(function(){L.destroyed||L.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(F){var R=F[0].contentRect.width,M=F[0].c
943ontentRect.height;Math.abs(L.$size.width-R)>1||Math.abs(L.$size.height-M)>1?L.$resizeTimer.delay():L.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},I}();k.prototype.CHANGE_CURSOR=1,k.prototype.CHANGE_MARKER=2,k.prototype.CHANGE_GUTTER=4,k.prototype.CHANGE_SCROLL=8,k.prototype.CHANGE_LINES=16,k.prototype.CHANGE_TEXT=32,k.prototype.CHANGE_SIZE=64,k.prototype.CHANGE_MARKER_BACK=128,k.prototype.CHANGE_MARKER_FRONT=256,k.prototype.CHANGE_FULL=512,k.prototype.CHANGE_H_SCROLL=1024,k.prototype.$changes=0,k.prototype.$padding=null,k.prototype.$frozen=!1,k.prototype.STEPS=8,s.implement(k.prototype,y),i.defineOptions(k.prototype,"renderer",{useResizeObserver:{set:function(I){!I&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):I&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(I){this.$textLayer.setShowInvisibles(I)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(I){typeof I=="number"&&(this.$printMarginColumn=I),this.$showPrintMargin=!!I,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(I){this.$gutter.style.display=I?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(I){this.$gutterLayer.$useSvgGutterIcons=I},initialValue:!1},showFoldedAnnotations:{set:function(I){this.$gutterLayer.$showFoldedAnnotations=I},initialValue:!1},fadeFoldWidgets:{set:function(I){c.setCssClass(this.$gutter,"ace_fade-fold-widgets",I)},initialValue:!1},showFoldWidgets:{set:function(I){this.$gutterLayer.setShowFoldWidgets(I),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(I){this.$textLayer.setDisplayIndentGuides(I)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(I){this.$textLayer.setHighlightIndentGuides(I)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(I){this.$gutterLayer.setHighlightGutterLine(I),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(I){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(I){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(I){typeof I=="number"&&(I=I+"px"),this.container.style.fontSize=I,this.updateFontSize()},initialValue:12},fontFamily:{set:function(I){this.container.style.fontFamily=I,this.updateFontSize()}},maxLines:{set:function(I){this.updateFull()}},minLines:{set:function(I){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(I){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(I){I=+I||0,this.$scrollPastEnd!=I&&(this.$scrollPastEnd=I,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(I){this.$gutterLayer.$fixedWidth=!!I,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(I){this.$updateCustomScrollbar(I)},initialValue:!1},theme:{set:function(I){this.setTheme(I)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!E.isMobile&&!E.isIE}}),e.VirtualRenderer=k});ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/net"),f=t("../lib/event_emitter").EventEmitter,i=t("../config");function d(l){var u="importScripts('"+c.qualifyURL(l)+"');";try{return new Blob([u],{type:"application/javascript"})}catch{var h=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,p=new h;return p.append(u),p.getBlob("application/javascript")}}function n(l){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(i.get("loadWorkerFromBlob")){var u=d(l),h=window.URL||window.webkitURL,p=h.createObjectURL(u);return new Worker(p)}return new Worker(l)}var o=function(l){l.postMessage||(l=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=l,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){s.implement(this,f),this.$createWorkerFromOldConfig=function(l,u,h,p,g){if(t.nameToUrl&&!t.toUrl&&(t.toUrl=t.nameToUrl),i.get("packaged")||!t.toUrl)p=p||i.moduleUrl(u,"worker");else{var m=this.$normalizePath;
943p=p||m(t.toUrl("ace/worker/worker.js",null,"_"));var y={};l.forEach(function(b){y[b]=m(t.toUrl(b,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=n(p),g&&this.send("importScripts",g),this.$worker.postMessage({init:!0,tlns:y,module:u,classname:h}),this.$worker},this.onMessage=function(l){var u=l.data;switch(u.type){case"event":this._signal(u.name,{data:u.data});break;case"call":var h=this.callbacks[u.id];h&&(h(u.data),delete this.callbacks[u.id]);break;case"error":this.reportError(u.data);break;case"log":window.console&&console.log&&console.log.apply(console,u.data);break}},this.reportError=function(l){window.console&&console.error&&console.error(l)},this.$normalizePath=function(l){return c.qualifyURL(l)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(l){l.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(l,u){this.$worker.postMessage({command:l,args:u})},this.call=function(l,u,h){if(h){var p=this.callbackId++;this.callbacks[p]=h,u.push(p)}this.send(l,u)},this.emit=function(l,u){try{u.data&&u.data.err&&(u.data.err={message:u.data.err.message,stack:u.data.err.stack,code:u.data.err.code}),this.$worker&&this.$worker.postMessage({event:l,data:{data:u.data}})}catch(h){console.error(h.stack)}},this.attachToDocument=function(l){this.$doc&&this.terminate(),this.$doc=l,this.call("setValue",[l.getValue()]),l.on("change",this.changeListener,!0)},this.changeListener=function(l){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),l.action=="insert"?this.deltaQueue.push(l.start,l.lines):this.deltaQueue.push(l.start,l.end)},this.$sendDeltaQueue=function(){var l=this.deltaQueue;l&&(this.deltaQueue=null,l.length>50&&l.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:l}))}}).call(o.prototype);var a=function(l,u,h){var p=null,g=!1,m=Object.create(f),y=[],b=new o({messageBuffer:y,terminate:function(){},postMessage:function(E){y.push(E),p&&(g?setTimeout(C):C())}});b.setEmitSync=function(E){g=E};var C=function(){var E=y.shift();E.command?p[E.command].apply(p,E.args):E.event&&m._signal(E.event,E.data)};return m.postMessage=function(E){b.onMessage({data:E})},m.callback=function(E,w){this.postMessage({type:"call",id:w,data:E})},m.emit=function(E,w){this.postMessage({type:"event",name:E,data:w})},i.loadModule(["worker",u],function(E){for(p=new E[h](m);y.length;)C()}),b};e.UIWorkerClient=a,e.WorkerClient=o,e.createWorker=n});ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(t,e,r){"use strict";var s=t("./range").Range,c=t("./lib/event_emitter").EventEmitter,f=t("./lib/oop"),i=function(){function d(n,o,a,l,u,h){var p=this;this.length=o,this.session=n,this.doc=n.getDocument(),this.mainClass=u,this.othersClass=h,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=l,this.$onCursorChange=function(){setTimeout(function(){p.onCursorChange()})},this.$pos=a;var g=n.getUndoManager().$undoStack||n.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=g.length,this.setup(),n.selection.on("changeCursor",this.$onCursorChange)}return d.prototype.setup=function(){var n=this,o=this.doc,a=this.session;this.selectionBefore=a.selection.toJSON(),a.selection.inMultiSelectMode&&a.selection.toSingleRange(),this.pos=o.createAnchor(this.$pos.row,this.$pos.column);var l=this.pos;l.$insertRight=!0,l.detach(),l.markerId=a.addMarker(new s(l.row,l.column,l.row,l.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(u){var h=o.createAnchor(u.row,u.column);h.$insertRight=!0,h.detach(),n.others.push(h)}),a.setUndoSelect(!1)},d.prototype.showOtherMarkers=function(){if(!this.othersActive){var n=this.session,o=this;this.othersActive=!0,this.others.forEach(function(a){a.markerId=n.addMarker(new s(a.row,a.column,a.row,a.column+o.length),o.othersClass,null,!1)})}},d.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var n=0;n<this.others.length;n++)this.session.removeMarker(this.others[n].markerId)}},d.prototype.onUpdate=function(n){if(this.$updating)return this.updateAnchors(n);var o=n;if(o.start.row===o.end.row&&o.start.row===this.pos.row){this.$updating=!0;var a=n.action==="insert"?o.end.column-o.start.column:o.start.column-o.end.column,l=o.start.column>=this.pos.column&&o.start.column<=this.pos.column+this.length+1,u=o.start.column-this.pos.column;if(this.updateAnchors(n),l&&(this.length+=a),l&&!this.session.$fromUndo){if(n.action==="insert")for(var h=this.others.length-1;h>=0;h--){var p=this.others[h],g={row:p.row,column:p.column+u};this.doc.insertMergedLines(g,n.lines)}else if(n.action==="remove")for(var h=this.others.length-1;h>=0;h--){var p=this.others[h],g={row:p.row,column:p.column+u};this.doc.remove(new s(g.row,g.column,g.row,g.column-a))}}this.$updating=!1,this.updateMarkers()}},d.prototype.updateAnchors=function(n){this.pos.onChange(n);for(var o=this.others.length;o--;)this.others[o].onChange(n);this.updateMarkers()},d.prototype.updateMarkers=function(){if(!this.$updating){var n=this,o=this.session,a=function(u,h){o.removeMarker(u.markerId),u.markerId=o.addMarker(new s(u.row,u.column,u.row,u.column+n.length),h,null,!1)};a(this.pos,this.mainClass);for(var l=this.others.length;l--;)a(this.others[l],this.othersClass)}},d.prototype.onCursorChange=function(n){if(!(this.$updating||!this.session)){var o=this.session.selection.getCursor();o.row===this.pos.row&&o.column>=this.pos.column&&o.column<=this.pos.column+this.length?(this.showOtherMar
943kers(),this._emit("cursorEnter",n)):(this.hideOtherMarkers(),this._emit("cursorLeave",n))}},d.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},d.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var n=this.session.getUndoManager(),o=(n.$undoStack||n.$undostack).length-this.$undoStackDepth,a=0;a<o;a++)n.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},d}();f.implement(i.prototype,c),e.PlaceHolder=i});ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(t,e,r){var s=t("../lib/event"),c=t("../lib/useragent");function f(d,n){return d.row==n.row&&d.column==n.column}function i(d){var n=d.domEvent,o=n.altKey,a=n.shiftKey,l=n.ctrlKey,u=d.getAccelKey(),h=d.getButton();if(l&&c.isMac&&(h=n.button),d.editor.inMultiSelectMode&&h==2){d.editor.textInput.onContextMenu(d.domEvent);return}if(!l&&!o&&!u){h===0&&d.editor.inMultiSelectMode&&d.editor.exitMultiSelectMode();return}if(h===0){var p=d.editor,g=p.selection,m=p.inMultiSelectMode,y=d.getDocumentPosition(),b=g.getCursor(),C=d.inSelection()||g.isEmpty()&&f(y,b),E=d.x,w=d.y,k=function(W){E=W.clientX,w=W.clientY},I=p.session,L=p.renderer.pixelToScreenCoordinates(E,w),F=L,R;if(p.$mouseHandler.$enableJumpToDef)l&&o||u&&o?R=a?"block":"add":o&&p.$blockSelectEnabled&&(R="block");else if(u&&!o){if(R="add",!m&&a)return}else o&&p.$blockSelectEnabled&&(R="block");if(R&&c.isMac&&n.ctrlKey&&p.$mouseHandler.cancelContextMenu(),R=="add"){if(!m&&C)return;if(!m){var M=g.toOrientedRange();p.addSelectionMarker(M)}var A=g.rangeList.rangeAtPoint(y);p.inVirtualSelectionMode=!0,a&&(A=null,M=g.ranges[0]||M,p.removeSelectionMarker(M)),p.once("mouseup",function(){var W=g.toOrientedRange();A&&W.isEmpty()&&f(A.cursor,W.cursor)?g.substractPoint(W.cursor):(a?g.substractPoint(M.cursor):M&&(p.removeSelectionMarker(M),g.addRange(M)),g.addRange(W)),p.inVirtualSelectionMode=!1})}else if(R=="block"){d.stop(),p.inVirtualSelectionMode=!0;var _,O=[],D=function(){var W=p.renderer.pixelToScreenCoordinates(E,w),K=I.screenToDocumentPosition(W.row,W.column,W.offsetX);f(F,W)&&f(K,g.lead)||(F=W,p.selection.moveToPosition(K),p.renderer.scrollCursorIntoView(),p.removeSelectionMarkers(O),O=g.rectangularRangeBlock(F,L),p.$mouseHandler.$clickSelection&&O.length==1&&O[0].isEmpty()&&(O[0]=p.$mouseHandler.$clickSelection.clone()),O.forEach(p.addSelectionMarker,p),p.updateSelectionMarkers())};m&&!u?g.toSingleRange():!m&&u&&(_=g.toOrientedRange(),p.addSelectionMarker(_)),a?L=I.documentToScreenPosition(g.lead):g.moveToPosition(y),F={row:-1,column:-1};var B=function(W){D(),clearInterval(H),p.removeSelectionMarkers(O),O.length||(O=[g.toOrientedRange()]),_&&(p.removeSelectionMarker(_),g.toSingleRange(_));for(var K=0;K<O.length;K++)g.addRange(O[K]);p.inVirtualSelectionMode=!1,p.$mouseHandler.$clickSelection=null},P=D;s.capture(p.container,k,B);var H=setInterval(function(){P()},20);return d.preventDefault()}}}e.onMouseDown=i});ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(t,e,r){e.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(c){c.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(c){c.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(c){c.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(c){c.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(c){c.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(c){c.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(c){c.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(c){c.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(c){c.multiSelect.rangeCount>1?c.multiSelect.joinSelections():c.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(c){c.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(c){c.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(c){c.findAll(
943)},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],e.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(c){c.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(c){return c&&c.inMultiSelectMode}}];var s=t("../keyboard/hash_handler").HashHandler;e.keyboardHandler=new s(e.multiSelectCommands)});ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(t,e,r){var s=t("./range_list").RangeList,c=t("./range").Range,f=t("./selection").Selection,i=t("./mouse/multi_select_handler").onMouseDown,d=t("./lib/event"),n=t("./lib/lang"),o=t("./commands/multi_select_commands");e.commands=o.defaultCommands.concat(o.multiSelectCommands);var a=t("./search").Search,l=new a;function u(b,C,E){return l.$options.wrap=!0,l.$options.needle=C,l.$options.backwards=E==-1,l.find(b)}var h=t("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(h.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(b,C){if(b){if(!this.inMultiSelectMode&&this.rangeCount===0){var E=this.toOrientedRange();if(this.rangeList.add(E),this.rangeList.add(b),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),C||this.fromOrientedRange(b);this.rangeList.removeAll(),this.rangeList.add(E),this.$onAddRange(E)}b.cursor||(b.cursor=b.end);var w=this.rangeList.add(b);return this.$onAddRange(b),w.length&&this.$onRemoveRange(w),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),C||this.fromOrientedRange(b)}},this.toSingleRange=function(b){b=b||this.ranges[0];var C=this.rangeList.removeAll();C.length&&this.$onRemoveRange(C),b&&this.fromOrientedRange(b)},this.substractPoint=function(b){var C=this.rangeList.substractPoint(b);if(C)return this.$onRemoveRange(C),C[0]},this.mergeOverlappingRanges=function(){var b=this.rangeList.merge();b.length&&this.$onRemoveRange(b)},this.$onAddRange=function(b){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(b),this._signal("addRange",{range:b})},this.$onRemoveRange=function(b){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var C=this.rangeList.ranges.pop();b.push(C),this.rangeCount=0}for(var E=b.length;E--;){var w=this.ranges.indexOf(b[E]);this.ranges.splice(w,1)}this._signal("removeRange",{ranges:b}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),C=C||this.ranges[0],C&&!C.isEqual(this.getRange())&&this.fromOrientedRange(C)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new s,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var b=this.ranges.length?this.ranges:[this.getRange()],C=[],E=0;E<b.length;E++){var w=b[E],k=w.start.row,I=w.end.row;if(k===I)C.push(w.clone());else{for(C.push(new c(k,w.start.column,k,this.session.getLine(k).length));++k<I;)C.push(this.getLineRange(k,!0));C.push(new c(I,0,I,w.end.column))}E==0&&!this.isBackwards()&&(C=C.reverse())}this.toSingleRange();for(var E=C.length;E--;)this.addRange(C[E])},this.joinSelections=function(){var b=this.rangeList.ranges,C=b[b.length-1],E=c.fromPoints(b[0].start,C.end);this.toSingleRange(),this.setSelectionRange(E,C.cursor==C.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var b=this.rangeList.ranges,C=b[b.length-1],E=c.fromPoints(b[0].start,C.end);this.toSingleRange(),this.setSelectionRange(E,C.cursor==C.start)}else{var w=this.session.documentToScreenPosition(this.cursor),k=this.session.documentToScreenPosition(this.anchor),I=this.rectangularRangeBlock(w,k);I.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(b,C,E){var w=[],k=b.column<C.column;if(k)var I=b.column,L=C.column,F=b.offsetX,R=C.offsetX;else var I=C.column,L=b.column,F=C.offsetX,R=b.offsetX;var M=b.row<C.row;if(M)var A=b.row,_=C.row;else var A=C.row,_=b.row;I<0&&(I=0),A<0&&(A=0),A==_&&(E=!0);for(var O,D=A;D<=_;D++){var B=c.fromPoints(this.session.screenToDocumentPosition(D,I,F),this.session.screenToDocumentPosition(D,L,R));if(B.isEmpty()){if(O&&g(B.end,O))break;O=B.end}B.cursor=k?B.start:B.end,w.push(B)}if(M&&w.reverse(),!E){for(var P=w.length-1;w[P].isEmpty()&&P>0;)P--;if(P>0)for(var H=0;w[H].isEmpty();
943)H++;for(var W=P;W>=H;W--)w[W].isEmpty()&&w.splice(W,1)}return w}}.call(f.prototype);var p=t("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(b){b.cursor||(b.cursor=b.end);var C=this.getSelectionStyle();return b.marker=this.session.addMarker(b,"ace_selection",C),this.session.$selectionMarkers.push(b),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,b},this.removeSelectionMarker=function(b){if(b.marker){this.session.removeMarker(b.marker);var C=this.session.$selectionMarkers.indexOf(b);C!=-1&&this.session.$selectionMarkers.splice(C,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(b){for(var C=this.session.$selectionMarkers,E=b.length;E--;){var w=b[E];if(w.marker){this.session.removeMarker(w.marker);var k=C.indexOf(w);k!=-1&&C.splice(k,1)}}this.session.selectionMarkerCount=C.length},this.$onAddRange=function(b){this.addSelectionMarker(b.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(b){this.removeSelectionMarkers(b.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(b){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(o.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(b){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(o.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(b){var C=b.command,E=b.editor;if(E.multiSelect){if(C.multiSelectAction)C.multiSelectAction=="forEach"?w=E.forEachSelection(C,b.args):C.multiSelectAction=="forEachLine"?w=E.forEachSelection(C,b.args,!0):C.multiSelectAction=="single"?(E.exitMultiSelectMode(),w=C.exec(E,b.args||{})):w=C.multiSelectAction(E,b.args||{});else{var w=C.exec(E,b.args||{});E.multiSelect.addRange(E.multiSelect.toOrientedRange()),E.multiSelect.mergeOverlappingRanges()}return w}},this.forEachSelection=function(b,C,E){if(!this.inVirtualSelectionMode){var w=E&&E.keepOrder,k=E==!0||E&&E.$byLines,I=this.session,L=this.selection,F=L.rangeList,R=(w?L:F).ranges,M;if(!R.length)return b.exec?b.exec(this,C||{}):b(this,C||{});var A=L._eventRegistry;L._eventRegistry={};var _=new f(I);this.inVirtualSelectionMode=!0;for(var O=R.length;O--;){if(k)for(;O>0&&R[O].start.row==R[O-1].end.row;)O--;_.fromOrientedRange(R[O]),_.index=O,this.selection=I.selection=_;var D=b.exec?b.exec(this,C||{}):b(this,C||{});!M&&D!==void 0&&(M=D),_.toOrientedRange(R[O])}_.detach(),this.selection=I.selection=L,this.inVirtualSelectionMode=!1,L._eventRegistry=A,L.mergeOverlappingRanges(),L.ranges[0]&&L.fromOrientedRange(L.ranges[0]);var B=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),B&&B.from==B.to&&this.renderer.animateScrolling(B.from),M}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var b="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var C=this.multiSelect.rangeList.ranges,E=[],w=0;w<C.length;w++)E.push(this.session.getTextRange(C[w]));var k=this.session.getDocument().getNewLineCharacter();b=E.join(k),b.length==(E.length-1)*k.length&&(b="")}else this.selection.isEmpty()||(b=this.session.getTextRange(this.getSelectionRange()));return b},this.$checkMultiselectChange=function(b,C){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var E=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&C==this.multiSelect.anchor)return;var w=C==this.multiSelect.anchor?E.cursor==E.start?E.end:E.start:E.cursor;w.row!=C.row||this.session.$clipPositionToDocument(w.row,w.column).column!=C.column?this.multiSelect.toSingleRange(this.multiSelect.toOr
943ientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(b,C,E){if(C=C||{},C.needle=b||C.needle,C.needle==null){var w=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();C.needle=this.session.getTextRange(w)}this.$search.set(C);var k=this.$search.findAll(this.session);if(!k.length)return 0;var I=this.multiSelect;E||I.toSingleRange(k[0]);for(var L=k.length;L--;)I.addRange(k[L],!0);return w&&I.rangeList.rangeAtPoint(w.start)&&I.addRange(w,!0),k.length},this.selectMoreLines=function(b,C){var E=this.selection.toOrientedRange(),w=E.cursor==E.end,k=this.session.documentToScreenPosition(E.cursor);this.selection.$desiredColumn&&(k.column=this.selection.$desiredColumn);var I=this.session.screenToDocumentPosition(k.row+b,k.column);if(E.isEmpty())var F=I;else var L=this.session.documentToScreenPosition(w?E.end:E.start),F=this.session.screenToDocumentPosition(L.row+b,L.column);if(w){var R=c.fromPoints(I,F);R.cursor=R.start}else{var R=c.fromPoints(F,I);R.cursor=R.end}if(R.desiredColumn=k.column,!this.selection.inMultiSelectMode)this.selection.addRange(E);else if(C)var M=E.cursor;this.selection.addRange(R),M&&this.selection.substractPoint(M)},this.transposeSelections=function(b){for(var C=this.session,E=C.multiSelect,w=E.ranges,k=w.length;k--;){var I=w[k];if(I.isEmpty()){var L=C.getWordRange(I.start.row,I.start.column);I.start.row=L.start.row,I.start.column=L.start.column,I.end.row=L.end.row,I.end.column=L.end.column}}E.mergeOverlappingRanges();for(var F=[],k=w.length;k--;){var I=w[k];F.unshift(C.getTextRange(I))}b<0?F.unshift(F.pop()):F.push(F.shift());for(var k=w.length;k--;){var I=w[k],R=I.clone();C.replace(I,F[k]),I.start.row=R.start.row,I.start.column=R.start.column}E.fromOrientedRange(E.ranges[0])},this.selectMore=function(b,C,E){var w=this.session,k=w.multiSelect,I=k.toOrientedRange();if(!(I.isEmpty()&&(I=w.getWordRange(I.start.row,I.start.column),I.cursor=b==-1?I.start:I.end,this.multiSelect.addRange(I),E))){var L=w.getTextRange(I),F=u(w,L,b);F&&(F.cursor=b==-1?F.start:F.end,this.session.unfold(F),this.multiSelect.addRange(F),this.renderer.scrollCursorIntoView(null,.5)),C&&this.multiSelect.substractPoint(I.cursor)}},this.alignCursors=function(){var b=this.session,C=b.multiSelect,E=C.ranges,w=-1,k=E.filter(function(P){if(P.cursor.row==w)return!0;w=P.cursor.row});if(!E.length||k.length==E.length-1){var I=this.selection.getRange(),L=I.start.row,F=I.end.row,R=L==F;if(R){var M=this.session.getLength(),A;do A=this.session.getLine(F);while(/[=:]/.test(A)&&++F<M);do A=this.session.getLine(L);while(/[=:]/.test(A)&&--L>0);L<0&&(L=0),F>=M&&(F=M-1)}var _=this.session.removeFullLines(L,F);_=this.$reAlignText(_,R),this.session.insert({row:L,column:0},_.join(`
944`)+`
945`),R||(I.start.column=0,I.end.column=_[_.length-1].length),this.selection.setRange(I)}else{k.forEach(function(P){C.substractPoint(P.cursor)});var O=0,D=1/0,B=E.map(function(P){var H=P.cursor,W=b.getLine(H.row),K=W.substr(H.column).search(/\S/g);return K==-1&&(K=0),H.column>O&&(O=H.column),K<D&&(D=K),K});E.forEach(function(P,H){var W=P.cursor,K=O-W.column,G=B[H]-D;K>G?b.insert(W,n.stringRepeat(" ",K-G)):b.remove(new c(W.row,W.column,W.row,W.column-K+G)),P.start.column=P.end.column=O,P.start.row=P.end.row=W.row,P.cursor=P.end}),C.fromOrientedRange(E[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(b,C){var E=!0,w=!0,k,I,L;return b.map(function(_){var O=_.match(/(\s*)(.*?)(\s*)([=:].*)/);return O?k==null?(k=O[1].length,I=O[2].length,L=O[3].length,O):(k+I+L!=O[1].length+O[2].length+O[3].length&&(w=!1),k!=O[1].length&&(E=!1),k>O[1].length&&(k=O[1].length),I<O[2].length&&(I=O[2].length),L>O[3].length&&(L=O[3].length),O):[_]}).map(C?R:E?w?M:R:A);function F(_){return n.stringRepeat(" ",_)}function R(_){return _[2]?F(k)+_[2]+F(I-_[2].length+L)+_[4].replace(/^([=:])\s+/,"$1 "):_[0]}function M(_){return _[2]?F(k+I-_[2].length)+_[2]+F(L)+_[4].replace(/^([=:])\s+/,"$1 "):_[0]}function A(_){return _[2]?F(k)+_[2]+F(L)+_[4].replace(/^([=:])\s+/,"$1 "):_[0]}}}).call(p.prototype);function g(b,C){return b.row==C.row&&b.column==C.column}e.onSessionChange=function(b){var C=b.session;C&&!C.multiSelect&&(C.$selectionMarkers=[],C.selection.$initRangeList(
945),C.multiSelect=C.selection),this.multiSelect=C&&C.multiSelect;var E=b.oldSession;E&&(E.multiSelect.off("addRange",this.$onAddRange),E.multiSelect.off("removeRange",this.$onRemoveRange),E.multiSelect.off("multiSelect",this.$onMultiSelect),E.multiSelect.off("singleSelect",this.$onSingleSelect),E.multiSelect.lead.off("change",this.$checkMultiselectChange),E.multiSelect.anchor.off("change",this.$checkMultiselectChange)),C&&(C.multiSelect.on("addRange",this.$onAddRange),C.multiSelect.on("removeRange",this.$onRemoveRange),C.multiSelect.on("multiSelect",this.$onMultiSelect),C.multiSelect.on("singleSelect",this.$onSingleSelect),C.multiSelect.lead.on("change",this.$checkMultiselectChange),C.multiSelect.anchor.on("change",this.$checkMultiselectChange)),C&&this.inMultiSelectMode!=C.selection.inMultiSelectMode&&(C.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())};function m(b){b.$multiselectOnSessionChange||(b.$onAddRange=b.$onAddRange.bind(b),b.$onRemoveRange=b.$onRemoveRange.bind(b),b.$onMultiSelect=b.$onMultiSelect.bind(b),b.$onSingleSelect=b.$onSingleSelect.bind(b),b.$multiselectOnSessionChange=e.onSessionChange.bind(b),b.$checkMultiselectChange=b.$checkMultiselectChange.bind(b),b.$multiselectOnSessionChange(b),b.on("changeSession",b.$multiselectOnSessionChange),b.on("mousedown",i),b.commands.addCommands(o.defaultCommands),y(b))}function y(b){if(!b.textInput)return;var C=b.textInput.getElement(),E=!1;d.addListener(C,"keydown",function(k){var I=k.keyCode==18&&!(k.ctrlKey||k.shiftKey||k.metaKey);b.$blockSelectEnabled&&I?E||(b.renderer.setMouseCursor("crosshair"),E=!0):E&&w()},b),d.addListener(C,"keyup",w,b),d.addListener(C,"blur",w,b);function w(k){E&&(b.renderer.setMouseCursor(""),E=!1)}}e.MultiSelect=m,t("./config").defineOptions(p.prototype,"editor",{enableMultiselect:{set:function(b){m(this),b?this.on("mousedown",i):this.off("mousedown",i)},value:!0},enableBlockSelect:{set:function(b){this.$blockSelectEnabled=b},value:!0}})});ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=t("../../range").Range,c=e.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(f,i,d){var n=f.getLine(d);return this.foldingStartMarker.test(n)?"start":i=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(n)?"end":""},this.getFoldWidgetRange=function(f,i,d){return null},this.indentationBlock=function(f,i,d){var n=/\S/,o=f.getLine(i),a=o.search(n);if(a!=-1){for(var l=d||o.length,u=f.getLength(),h=i,p=i;++i<u;){var g=f.getLine(i).search(n);if(g!=-1){if(g<=a){var m=f.getTokenAt(i,0);if(!m||m.type!=="string")break}p=i}}if(p>h){var y=f.getLine(p).length;return new s(h,l,p,y)}}},this.openingBracketBlock=function(f,i,d,n,o){var a={row:d,column:n+1},l=f.$findClosingBracket(i,a,o);if(l){var u=f.foldWidgets[l.row];return u==null&&(u=f.getFoldWidget(l.row)),u=="start"&&l.row>a.row&&(l.row--,l.column=f.getLine(l.row).length),s.fromPoints(a,l)}},this.closingBracketBlock=function(f,i,d,n,o){var a={row:d,column:n},l=f.$findOpeningBracket(i,a);if(l)return l.column++,a.column--,s.fromPoints(l,a)}}).call(c.prototype)});ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(t,e,r){"use strict";var s=t("../lib/dom"),c=t("../range").Range,f=t("../config").nls;function i(n,o,a){for(var l=0,u=n.length-1;l<=u;){var h=l+u>>1,p=a(o,n[h]);if(p>0)l=h+1;else if(p<0)u=h-1;else return h}return-(l+1)}function d(n,o,a){var l=n.getAnnotations().sort(c.comparePoints);if(l.length){var u=i(l,{row:o,column:-1},c.comparePoints);u<0&&(u=-u-1),u>=l.length?u=a>0?0:l.length-1:u===0&&a<0&&(u=l.length-1);var h=l[u];if(!(!h||!a)){if(h.row===o){do h=l[u+=a];while(h&&h.row===o);if(!h)return l.slice()}var p=[];o=h.row;do p[a<0?"unshift":"push"](h),h=l[u+=a];while(h&&h.row==o);return p.length&&p}}}e.showErrorMarker=function(n,o){var a=n.session,l=n.getCursorPosition(),u=l.row,h=a.widgetManager.getWidgetsAtRow(u).filter(function(k){return k.type=="errorMarker"})[0];h?h.destroy():u-=o;var p=d(a,u,o),g;if(p){var m=p[0];l.column=(m.pos&&typeof m.column!="number"?m.pos.sc:m.column)||0,l.row=m.row,g=n.renderer.$gutterLayer.$annotations[l.row]}else{if(h)return;g={displayText:[f("error-marker.good-state","Looks good!")],className:"ace_ok"}}n.session.unfold(l.row),n.selection.moveToPosition(l);var y={row:l.row,fixedWidth:!0,coverGutter:!0,el:s.createElement("div"),type:"errorMarker"},b=y.el.appendChild(s.createElement("div")),C=y.el.appendChild(s.createElement("div"));C.className="error_widget_arrow "+g.className;var E=n.renderer.$cursorLayer.getPixelPosition(l).left;C.style.left=E+n.renderer.gutterWidth-5+"px",y.el.className="error_widget_wrapper",b.className="error_widget "+g.className,g.displayText.forEach(function(k,I){b.appendChild(s.createTextNode(k)),I<g.displayText.length-1&&b.appendChild(s.createElement("br"))}),b.appendChild(s.createElement("div"));
945var w=function(k,I,L){if(I===0&&(L==="esc"||L==="return"))return y.destroy(),{command:"null"}};y.destroy=function(){n.$mouseHandler.isMousePressed||(n.keyBinding.removeKeyboardHandler(w),a.widgetManager.removeLineWidget(y),n.off("changeSelection",y.destroy),n.off("changeSession",y.destroy),n.off("mouseup",y.destroy),n.off("change",y.destroy))},n.keyBinding.addKeyboardHandler(w),n.on("changeSelection",y.destroy),n.on("changeSession",y.destroy),n.on("mouseup",y.destroy),n.on("change",y.destroy),n.session.widgetManager.addLineWidget(y),y.el.onmousedown=n.focus.bind(n),n.renderer.scrollCursorIntoView(null,.5,{bottom:y.el.offsetHeight})},s.importCssString(`
946    .error_widget_wrapper {
947        background: inherit;
948        color: inherit;
949        border:none
950    }
951    .error_widget {
952        border-top: solid 2px;
953        border-bottom: solid 2px;
954        margin: 5px 0;
955        padding: 10px 40px;
956        white-space: pre-wrap;
957    }
958    .error_widget.ace_error, .error_widget_arrow.ace_error{
959        border-color: #ff5a5a
960    }
961    .error_widget.ace_warning, .error_widget_arrow.ace_warning{
962        border-color: #F1D817
963    }
964    .error_widget.ace_info, .error_widget_arrow.ace_info{
965        border-color: #5a5a5a
966    }
967    .error_widget.ace_ok, .error_widget_arrow.ace_ok{
968        border-color: #5aaa5a
969    }
970    .error_widget_arrow {
971        position: absolute;
972        border: solid 5px;
973        border-top-color: transparent!important;
974        border-right-color: transparent!important;
975        border-left-color: transparent!important;
976        top: -5px;
977    }
978`,"error_marker.css",!1)});ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(t,e,r){"use strict";t("./loader_build")(e);var s=t("./lib/dom"),c=t("./range").Range,f=t("./editor").Editor,i=t("./edit_session").EditSession,d=t("./undomanager").UndoManager,n=t("./virtual_renderer").VirtualRenderer;t("./worker/worker_client"),t("./keyboard/hash_handler"),t("./placeholder"),t("./multi_select"),t("./mode/folding/fold_mode"),t("./theme/textmate"),t("./ext/error_marker"),e.config=t("./config"),e.edit=function(a,l){if(typeof a=="string"){var u=a;if(a=document.getElementById(u),!a)throw new Error("ace.edit can't find div #"+u)}if(a&&a.env&&a.env.editor instanceof f)return a.env.editor;var h="";if(a&&/input|textarea/i.test(a.tagName)){var p=a;h=p.value,a=s.createElement("pre"),p.parentNode.replaceChild(a,p)}else a&&(h=a.textContent,a.innerHTML="");var g=e.createEditSession(h),m=new f(new n(a),g,l),y={document:g,editor:m,onResize:m.resize.bind(m,null)};return p&&(y.textarea=p),m.on("destroy",function(){y.editor.container.env=null}),m.container.env=m.env=y,m},e.createEditSession=function(a,l){var u=new i(a,l);return u.setUndoManager(new d),u},e.Range=c,e.Editor=f,e.EditSession=i,e.UndoManager=d,e.VirtualRenderer=n;var o=e.config.version;e.version=o});(function(){ace.require(["ace/ace"],function(t){t&&(t.config.init(!0),t.define=ace.define);var e=function(){return this}();!e&&typeof window<"u"&&(e=window),!e&&typeof self<"u"&&(e=self),e.ace||(e.ace=t);for(var r in t)t.hasOwnProperty(r)&&(e.ace[r]=t[r]);e.ace.default=e.ace,typeof es=="object"&&typeof Xf=="object"&&es&&(es.exports=e.ace)})})()});var Qf=Ye((Jf,ts)=>{ace.define("ace/mode/lua_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text_highlight_rules").TextHighlightRules,f=function(){var i="break|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while|or|and|not",d="true|false|nil|_G|_VERSION",n="string|xpcall|package|tostring|print|os|unpack|require|getfenv|setmetatable|next|assert|tonumber|io|rawequal|collectgarbage|getmetatable|module|rawset|math|debug|pcall|table|newproxy|type|coroutine|_G|select|gcinfo|pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|load|error|loadfile|sub|upper|len|gfind|rep|find|match|char|dump|gmatch|reverse|byte|format|gsub|lower|preload|loadlib|loaded|loaders|cpath|config|path|seeall|exit|setlocale|date|getenv|difftime|remove|time|clock|tmpname|rename|execute|lines|write|close|flush|open|output|t
978ype|read|stderr|stdin|input|stdout|popen|tmpfile|log|max|acos|huge|ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|gethook|setmetatable|setlocal|traceback|setfenv|getinfo|setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|foreachi|maxn|foreach|concat|sort|remove|resume|yield|status|wrap|create|running|__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber",o="string|package|os|io|math|debug|table|coroutine",a="setn|foreach|foreachi|gcinfo|log10|maxn",l=this.createKeywordMapper({keyword:i,"support.function":n,"keyword.deprecated":a,"constant.library":o,"constant.language":d,"variable.language":"self"},"identifier"),u="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[xX][\\dA-Fa-f]+)",p="(?:"+u+"|"+h+")",g="(?:\\.\\d+)",m="(?:\\d+)",y="(?:(?:"+m+"?"+g+")|(?:"+m+"\\.))",b="(?:"+y+")";this.$rules={start:[{stateName:"bracketedComment",onMatch:function(C,E,w){return w.unshift(this.next,C.length-2,E),"comment"},regex:/\-\-\[=*\[/,next:[{onMatch:function(C,E,w){return C.length==w[1]?(w.shift(),w.shift(),this.next=w.shift()):this.next="","comment"},regex:/\]=*\]/,next:"start"},{defaultToken:"comment.body"}]},{token:"comment",regex:"\\-\\-.*$"},{stateName:"bracketedString",onMatch:function(C,E,w){return w.unshift(this.next,C.length,E),"string.start"},regex:/\[=*\[/,next:[{onMatch:function(C,E,w){return C.length==w[1]?(w.shift(),w.shift(),this.next=w.shift()):this.next="","string.end"},regex:/\]=*\]/,next:"start"},{defaultToken:"string"}]},{token:"string",regex:'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:b},{token:"constant.numeric",regex:p+"\\b"},{token:l,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+|\\w+"}]},this.normalizeRules()};s.inherits(f,c),e.LuaHighlightRules=f});ace.define("ace/mode/folding/lua",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("./fold_mode").FoldMode,f=t("../../range").Range,i=t("../../token_iterator").TokenIterator,d=e.FoldMode=function(){};s.inherits(d,c),function(){this.foldingStartMarker=/\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/,this.foldingStopMarker=/\bend\b|^\s*}|\]=*\]/,this.getFoldWidget=function(n,o,a){var l=n.getLine(a),u=this.foldingStartMarker.test(l),h=this.foldingStopMarker.test(l);if(u&&!h){var g=l.match(this.foldingStartMarker);if(g[1]=="then"&&/\belseif\b/.test(l))return;if(g[1]){if(n.getTokenAt(a,g.index+1).type==="keyword")return"start"}else if(g[2]){var p=n.bgTokenizer.getState(a)||"";if(p[0]=="bracketedComment"||p[0]=="bracketedString")return"start"}else return"start"}if(o!="markbeginend"||!h||u&&h)return"";var g=l.match(this.foldingStopMarker);if(g[0]==="end"){if(n.getTokenAt(a,g.index+1).type==="keyword")return"end"}else if(g[0][0]==="]"){var p=n.bgTokenizer.getState(a-1)||"";if(p[0]=="bracketedComment"||p[0]=="bracketedString")return"end"}else return"end"},this.getFoldWidgetRange=function(n,o,a){var l=n.doc.getLine(a),u=this.foldingStartMarker.exec(l);if(u)return u[1]?this.luaBlock(n,a,u.index+1):u[2]?n.getCommentFoldRange(a,u.index+1):this.openingBracketBlock(n,"{",a,u.index);var u=this.foldingStopMarker.exec(l);if(u)return u[0]==="end"&&n.getTokenAt(a,u.index+1).type==="keyword"?this.luaBlock(n,a,u.index+1):u[0][0]==="]"?n.getCommentFoldRange(a,u.index+1):this.closingBracketBlock(n,"}",a,u.index+u[0].length)},this.luaBlock=function(n,w,a,l){var u=new i(n,w,a),h={function:1,do:1,then:1,elseif:-1,end:-1,repeat:1,until:-1},p=u.getCurrentToken();if(!(!p||p.type!="keyword")){var g=p.value,m=[g],y=h[g];if(y){var b=y===-1?u.getCurrentTokenColumn():n.getLine(w).length,C=w;for(u.step=y===-1?u.stepBackward:u.stepForward;p=u.step();
978)if(p.type==="keyword"){var E=y*h[p.value];if(E>0)m.unshift(p.value);else if(E<=0){if(m.shift(),!m.length&&p.value!="elseif")break;E===0&&m.unshift(p.value)}}if(!p)return null;if(l)return u.getCurrentTokenRange();var w=u.getCurrentTokenRow();return y===-1?new f(w,n.getLine(w).length,C,b):new f(C,b,w,u.getCurrentTokenColumn())}}}}.call(d.prototype)});ace.define("ace/mode/lua",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lua_highlight_rules","ace/mode/folding/lua","ace/range","ace/worker/worker_client"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text").Mode,f=t("./lua_highlight_rules").LuaHighlightRules,i=t("./folding/lua").FoldMode,d=t("../range").Range,n=t("../worker/worker_client").WorkerClient,o=function(){this.HighlightRules=f,this.foldingRules=new i,this.$behaviour=this.$defaultBehaviour};s.inherits(o,c),function(){this.lineCommentStart="--",this.blockComment={start:"--[[",end:"--]]"};var a={function:1,then:1,do:1,else:1,elseif:1,repeat:1,end:-1,until:-1},l=["else","elseif","end","until"];function u(h){for(var p=0,g=0;g<h.length;g++){var m=h[g];m.type=="keyword"?m.value in a&&(p+=a[m.value]):m.type=="paren.lparen"?p+=m.value.length:m.type=="paren.rparen"&&(p-=m.value.length)}return p<0?-1:p>0?1:0}this.getNextLineIndent=function(h,p,g){var m=this.$getIndent(p),y=0,b=this.getTokenizer().getLineTokens(p,h),C=b.tokens;return h=="start"&&(y=u(C)),y>0?m+g:y<0&&m.substr(m.length-g.length)==g&&!this.checkOutdent(h,p,`
979`)?m.substr(0,m.length-g.length):m},this.checkOutdent=function(h,p,g){if(g!=`
980`&&g!="\r"&&g!=`\r
981`)return!1;if(p.match(/^\s*[\)\}\]]$/))return!0;var m=this.getTokenizer().getLineTokens(p.trim(),h).tokens;return!m||!m.length?!1:m[0].type=="keyword"&&l.indexOf(m[0].value)!=-1},this.getMatching=function(h,p,g){if(p==null){var m=h.selection.lead;g=m.column,p=m.row}var y=h.getTokenAt(p,g);if(y&&y.value in a)return this.foldingRules.luaBlock(h,p,g,!0)},this.autoOutdent=function(h,p,g){var m=p.getLine(g),y=m.match(/^\s*/)[0].length;if(!(!y||!g)){var b=this.getMatching(p,g,y+1);if(!(!b||b.start.row==g)){var C=this.$getIndent(p.getLine(b.start.row));C.length!=y&&(p.replace(new d(g,0,g,y),C),p.outdentRows(new d(g+1,0,g+1,0)))}}},this.createWorker=function(h){var p=new n(["ace"],"ace/mode/lua_worker","Worker");return p.attachToDocument(h.getDocument()),p.on("annotate",function(g){h.setAnnotations(g.data)}),p.on("terminate",function(){h.clearAnnotations()}),p},this.$id="ace/mode/lua",this.snippetFileId="ace/snippets/lua"}.call(o.prototype),e.Mode=o});(function(){ace.require(["ace/mode/lua"],function(t){typeof ts=="object"&&typeof Jf=="object"&&ts&&(ts.exports=t)})})()});var tp=Ye((ep,ns)=>{ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/lang"),f=t("./text_highlight_rules").TextHighlightRules,i=e.supportType="align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-ju
981stify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index",d=e.supportFunction="rgb|rgba|url|attr|counter|counters",n=e.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom",o=e.supportConstantColor="aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen",a=e.supportConstantFonts="arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace",l=e.numRe="\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))",u=e.pseudoElements="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",h=e.pseudoClasses="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",p=function(){var g=this.createKeywordMapper({"supp
981ort.function":d,"support.constant":n,"support.type":i,"support.constant.color":o,"support.constant.fonts":a},"text",!0);this.$rules={start:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"ruleset"},{token:"paren.rparen",regex:"\\}"},{token:"string",regex:"@(?!viewport)",next:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"keyword",regex:"%"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant.numeric",regex:l},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],media:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"start"},{token:"paren.rparen",regex:"\\}",next:"start"},{token:"string",regex:";",next:"start"},{token:"keyword",regex:"(?:media|supports|document|charset|import|namespace|media|supports|document|page|font|keyframes|viewport|counter-style|font-feature-values|swash|ornaments|annotation|stylistic|styleset|character-variant)"}],comments:[{token:"comment",regex:"\\/\\*",push:[{token:"comment",regex:"\\*\\/",next:"pop"},{defaultToken:"comment"}]}],ruleset:[{regex:"-(webkit|ms|moz|o)-",token:"text"},{token:"punctuation.operator",regex:"[:;]"},{token:"paren.rparen",regex:"\\}",next:"start"},{include:["strings","url","comments"]},{token:["constant.numeric","keyword"],regex:"("+l+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"},{token:"constant.numeric",regex:l},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:u},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:h},{include:"url"},{token:g,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"},{token:"paren.lparen",regex:"\\{"},{caseInsensitive:!0}],url:[{token:"support.function",regex:"(?:url(:?-prefix)?|domain|regexp)\\(",push:[{token:"support.function",regex:"\\)",next:"pop"},{defaultToken:"string"}]}],strings:[{token:"string.start",regex:"'",push:[{token:"string.end",regex:"'|$",next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]},{token:"string.start",regex:'"',push:[{token:"string.end",regex:'"|$',next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]}],escapes:[{token:"constant.language.escape",regex:/\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/}]},this.normalizeRules()};s.inherits(p,f),e.CssHighlightRules=p});ace.define("ace/mode/jsdoc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:["comment.doc.tag","comment.doc.text","lparen.doc"],regex:"(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:["rparen.doc","text.doc","variable.parameter.doc","lparen.doc","variable.parameter.doc","rparen.doc"],regex:/(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,next:"pop"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","lparen.doc"],regex:"(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|implements|external|exception|throws|enum|define|extends))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:'(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|requires|param|implements|function|extends|typedef|mixes|constructor|var|memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#.:/~"\\-]*)?'},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:"(@method)(\\s+)(\\w[\\w.\\(\\)]*)"}
981,{token:"comment.doc.tag",regex:"@access\\s+(?:private|public|protected)"},{token:"comment.doc.tag",regex:"@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"},{token:"comment.doc.tag",regex:"@\\w+(?=\\s|$)"},f.getTagRule(),{defaultToken:"comment.doc.body",caseInsensitive:!0}],"doc-syntax":[{token:"operator.doc",regex:/[|:]/},{token:"paren.doc",regex:/[\[\]]/}]},this.normalizeRules()};s.inherits(f,c),f.getTagRule=function(i){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},f.getStartRule=function(i){return{token:"comment.doc",regex:/\/\*\*(?!\/)/,next:i}},f.getEndRule=function(i){return{token:"comment.doc",regex:"\\*\\/",next:i}},e.JsDocCommentHighlightRules=f});ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules,f=t("./text_highlight_rules").TextHighlightRules,i="[a-zA-Z\\$_\xA1-\uFFFF][a-zA-Z\\d\\$_\xA1-\uFFFF]*",d=function(a){var l={"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},u=this.createKeywordMapper(l,"identifier"),h="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",p="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)",g="(function)(\\s*)(\\*?)",m={token:["identifier","text","paren.lparen"],regex:"(\\b(?!"+Object.values(l).join("|")+"\\b)"+i+")(\\s*)(\\()"};this.$rules={no_regex:[c.getStartRule("doc-start"),o("no_regex"),m,{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+i+")(\\s*)(=)(\\s*)"+g+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))("+i+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+i+")(\\s*)(:)(\\s*)"+g+"(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)"+g+"(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:`from(?=\\s*('|"))`},{token:"keyword",regex:"(?:"+h+")\\b",next:"start"},{token:"support.constant",regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/},{token:u,regex:i},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"storage.type",regex:/=>/,next:"start"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/}
981,{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:"keyword.operator",regex:/=/},{token:["storage.type","text","storage.type","text","paren.lparen"],regex:g+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:"prototype"},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:i},{regex:"",token:"empty",next:"no_regex"}],start:[c.getStartRule("doc-start"),o("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/}
981,{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],default_parameter:[{token:"string",regex:"'(?=.)",push:[{token:"string",regex:"'|$",next:"pop"},{include:"qstring"}]},{token:"string",regex:'"(?=.)',push:[{token:"string",regex:'"|$',next:"pop"},{include:"qqstring"}]},{token:"constant.language",regex:"null|Infinity|NaN|undefined"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:"punctuation.operator",regex:",",next:"function_arguments"},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],function_arguments:[o("function_arguments"),{token:"variable.parameter",regex:i},{token:"punctuation.operator",regex:","},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:p},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:p},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]},(!a||!a.noES6)&&(this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(y,b,C){if(this.next=y=="{"?this.nextState:"",y=="{"&&C.length)C.unshift("start",b);else if(y=="}"&&C.length&&(C.shift(),this.next=C.shift(),this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1))return"paren.quasi.end";return y=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:p},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]},{token:["variable.parameter","text"],regex:"("+i+")(\\s*)(?=\\=>)"},{token:"paren.lparen",regex:"(\\()(?=[^\\(]+\\s*=>)",next:"function_arguments"},{token:"variable.language",regex:"(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"}),this.$rules.function_arguments.unshift({token:"keyword.operator",regex:"=",next:"default_parameter"},{token:"keyword.operator",regex:"\\.{3}"}),this.$rules.property.unshift({token:"support.function",regex:"(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"},{token:"constant.language",regex:"(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"}),(!a||a.jsx!=!1)&&n.call(this)),this.embedRules(c,"doc-",[c.getEndRule("no_regex")]),this.normalizeRules()};s.inherits(d,f);function n(){var a=i.replace("\\d","\\d\\-"),l={onMatch:function(h,p,g){var m=h.charAt(1)=="/"?2:1;return m==1?(p!=this.nextState?g.unshift(this.next,this.nextState,0):g.unshift(this.next),g[2]++):m==2&&p==this.nextState&&(g[1]--,(!g[1]||g[1]<0)&&(g.shift(),g.shift())),[{type:"meta.tag.punctuation."+(m==1?"":"end-")+"tag-open.xml",value:h.slice(0,m)},{type:"meta.tag.tag-name.xml",value:h.substr(m)}]},regex:"</?(?:"+a+"|(?=>))",next:"jsxAttributes",nextState:"jsx"};this.$rules.start.unshift(l);var u={regex:"{",token:"paren.quasi.start",push:"start"};this.$rules.jsx=[u,l,{include:"reference"},{defaultToken:"string.xml"}],this.$rules.jsxAttributes=[{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",onMatch:function(h,p,g){return p==g[0]&&g.shift(),h.length==2&&(g[0]==this.nextState&&g[1]--,(!g[1]||g[1]<0)&&g.splice(0,2)),this.next=g[0]||"start",[{type:this.token,value:h}]},nextState:"jsx"},u,o("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:a},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]}
981,l],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function o(a){return[{token:"comment",regex:/\/\*/,next:[c.getTagRule(),{token:"comment",regex:"\\*\\/",next:a||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[c.getTagRule(),{token:"comment",regex:"$|^",next:a||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}e.JavaScriptHighlightRules=d});ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text_highlight_rules").TextHighlightRules,f=function(i){var d="[_:a-zA-Z\xC0-\uFFFF][-_:.a-zA-Z0-9\xC0-\uFFFF]*";this.$rules={start:[{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:["punctuation.instruction.xml","keyword.instruction.xml"],regex:"(<\\?)("+d+")",next:"processing_instruction"},{token:"comment.start.xml",regex:"<\\!--",next:"comment"},{token:["xml-pe.doctype.xml","xml-pe.doctype.xml"],regex:"(<\\!)(DOCTYPE)(?=[\\s])",next:"doctype",caseInsensitive:!0},{include:"tag"},{token:"text.end-tag-open.xml",regex:"</"},{token:"text.tag-open.xml",regex:"<"},{include:"reference"},{defaultToken:"text.xml"}],processing_instruction:[{token:"entity.other.attribute-name.decl-attribute-name.xml",regex:d},{token:"keyword.operator.decl-attribute-equals.xml",regex:"="},{include:"whitespace"},{include:"string"},{token:"punctuation.xml-decl.xml",regex:"\\?>",next:"start"}],doctype:[{include:"whitespace"},{include:"string"},{token:"xml-pe.doctype.xml",regex:">",next:"start"},{token:"xml-pe.xml",regex:"[-_a-zA-Z0-9:]+"},{token:"punctuation.int-subset",regex:"\\[",push:"int_subset"}],int_subset:[{token:"text.xml",regex:"\\s+"},{token:"punctuation.int-subset.xml",regex:"]",next:"pop"},{token:["punctuation.markup-decl.xml","keyword.markup-decl.xml"],regex:"(<\\!)("+d+")",push:[{token:"text",regex:"\\s+"},{token:"punctuation.markup-decl.xml",regex:">",next:"pop"},{include:"string"}]}],cdata:[{token:"string.cdata.xml",regex:"\\]\\]>",next:"start"},{token:"text.xml",regex:"\\s+"},{token:"text.xml",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment.end.xml",regex:"-->",next:"start"},{defaultToken:"comment.xml"}],reference:[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],attr_reference:[{token:"constant.language.escape.reference.attribute-value.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],tag:[{token:["meta.tag.punctuation.tag-open.xml","meta.tag.punctuation.end-tag-open.xml","meta.tag.tag-name.xml"],regex:"(?:(<)|(</))((?:"+d+":)?"+d+")",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start"}]}],tag_whitespace:[{token:"text.tag-whitespace.xml",regex:"\\s+"}],whitespace:[{token:"text.whitespace.xml",regex:"\\s+"}],string:[{token:"string.xml",regex:"'",push:[{token:"string.xml",regex:"'",next:"pop"},{defaultToken:"string.xml"}]},{token:"string.xml",regex:'"',push:[{token:"string.xml",regex:'"',next:"pop"},{defaultToken:"string.xml"}]}],attributes:[{token:"entity.other.attribute-name.xml",regex:d},{token:"keyword.operator.attribute-equals.xml",regex:"="},{include:"tag_whitespace"},{include:"attribute_value"}],attribute_value:[{token:"string.attribute-value.xml",regex:"'",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]}]},this.constructor===f&&this.normalizeRules()};(function(){this.embedTagRules=function(i,d,n){this.$rules.tag.unshift({token:["meta.tag.punctuation.tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(<)("+n+"(?=\\s|>|$))",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:d+"start"}]}),this.$rules[n+"-end"]=[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start",onMatch:function(o,a,l){return l.splice(0),this.token}}],this.embedRules(i,d,[{token:["meta.tag.punctuation.end-tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(</)("+n+"(?=\\s|>|$))",next:n+"-end"},{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\["},{token:"string.cdata.xml",regex:"\\]\\]>"}])}}).call(c.prototype),s.inherits(f,c),e.XmlHighlightRules=f});ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/lang"),f=t("./css_highlight_rules").CssHighlightRules,i=t("./javascript_highlight_rules").JavaScriptHighlightRules,d=t("./xml_highlight_rules").XmlHighlightRules,n=c.createMap({a:"anchor",button:"form",form:"form",img:"image",input:"form",label:"form",option:"form",script:"script",select:"form",textarea:"form",style:"style",table:"table",tbody:"table",td:"table",tfoot:"table",th:"table",tr:"table"}),o=function(){d.call(this),this.addRules({attributes:[{include:"tag_whitespace"},{token:"entity.other.attribute-name.xml",regex:"[-_a-zA-Z0-9:.]+"},{token:"keyword.operator.attribute-equals.xml",regex:"=",push:[{include:"tag_whitespace"},{token:"string.unquoted.attribute-value.html",regex:"[^<>='\"`\\s]+",next:"pop"},{token:"empty",regex:"",next:"pop"}]},{include:"attribute_value"}],tag:[{token:function(a,l){var u=n[l];return["meta.tag.punctuation."+(a=="<"?"":"end-")+"tag-open.xml","meta.tag"+(u?"."+u:"")+".tag-name.xml"]},regex:"(</?)([-_a-zA-Z0-9:.]+)",next:"tag_stuff"}],tag_stuff:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start"}]}),this.embedTagRules(f,"css-","style"),this.embedTagRules(new i({jsx:!1}).getRules(),"js-","script"),this.constructor===o&&this.normalizeRules()};s.inherits(o,d),e.HtmlHighlightRules=o});ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"],function(t,e,r){"use strict";var s=t("../config").$modes,c=t("../lib/oop"),f=t("../lib/lang"),i=t("./text_highlight_rules").TextHighlightRules,d=t("./html_highlight_rules").HtmlHighlightRules,n=function(a){return"(?:[^"+f.escapeRegExp(a)+"\\\\]|\\\\.)*"},o=function(){d.call(this);var a={token:"support.function",regex:/^\s*(```+[^`]*|~~~+[^~]*)$/,onMatch:function(u,h,p,g){var m=u.match(/^(\s*)([`~]+)(.*)/),y=/[\w-]+|$/.exec(m[3])[0];return s[y]||(y=""),p.unshift("githubblock",[],[m[1],m[2],y],h),this.token},next:"githubblock"},l=[{token:"support.function",regex:".*",onMatch:function(u,h,p,g){var m=p[1],y=p[2][0],b=p[2][1],C=p[2][2],E=/^(\s*)(`+|~+)\s*$/.exec(u);if(E&&E[1].length<y.length+3&&E[2].length>=b.length&&E[2][0]==b[0])return p.splice(0,3),this.next=p.shift(),this.token;if(this.next="",C&&s[C]){var w=s[C].getTokenizer().getLineTokens(u,m.slice(0));return p[1]=w.state,w.tokens}return this.token}}];this.$rules.start.unshift({token:"empty_line",regex:"^$",next:"allowBlock"},{token:"markup.heading.1",regex:"^=+(?=\\s*$)"},{token:"markup.heading.2",regex:"^\\-+(?=\\s*$)"},{token:function(u){return"markup.heading."+u.length},regex:/^#{1,6}(?=\s|$)/,next:"header"},a,{token:"string.blockquote",regex:"^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",next:"blockquote"}
981,{token:"constant",regex:"^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",next:"allowBlock"},{token:"markup.list",regex:"^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",next:"listblock-start"},{include:"basic"}),this.addRules({basic:[{token:"constant.language.escape",regex:/\\[\\`*_{}\[\]()#+\-.!]/},{token:"support.function",regex:"(`+)(.*?[^`])(\\1)"},{token:["text","constant","text","url","string","text"],regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","string","text","constant","text"],regex:"(\\[)("+n("]")+")(\\]\\s*\\[)("+n("]")+")(\\])"},{token:["text","string","text","markup.underline","string","text"],regex:"(\\!?\\[)("+n("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+n('"')+'"\\s*)?(\\))'},{token:"string.strong",regex:"([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"},{token:"string.emphasis",regex:"([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"},{token:["text","url","text"],regex:`(<)((?:https?|ftp|dict):[^'">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)`}],allowBlock:[{token:"support.function",regex:"^ {4}.+",next:"allowBlock"},{token:"empty_line",regex:"^$",next:"allowBlock"},{token:"empty",regex:"",next:"start"}],header:[{regex:"$",next:"start"},{include:"basic"},{defaultToken:"heading"}],"listblock-start":[{token:"support.variable",regex:/(?:\[[ x]\])?/,next:"listblock"}],listblock:[{token:"empty_line",regex:"^$",next:"start"},{token:"markup.list",regex:"^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",next:"listblock-start"},{include:"basic",noEscape:!0},a,{defaultToken:"list"}],blockquote:[{token:"empty_line",regex:"^\\s*$",next:"start"},{token:"string.blockquote",regex:"^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",next:"blockquote"},{include:"basic",noEscape:!0},{defaultToken:"string.blockquote"}],githubblock:l}),this.normalizeRules()};c.inherits(o,i),e.MarkdownHighlightRules=o});ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("./fold_mode").FoldMode,f=t("../../range").Range,i=e.FoldMode=function(){};s.inherits(i,c),function(){this.foldingStartMarker=/^(?:[=-]+\s*$|#{1,6} |`{3})/,this.getFoldWidget=function(d,n,o){var a=d.getLine(o);return this.foldingStartMarker.test(a)?a[0]=="`"&&d.bgTokenizer.getState(o)=="start"?"end":"start":""},this.getFoldWidgetRange=function(d,n,o){var a=d.getLine(o),l=a.length,u=d.getLength(),h=o,p=o;if(!a.match(this.foldingStartMarker))return;if(a[0]=="`")if(d.bgTokenizer.getState(o)!=="start"){for(;++o<u&&(a=d.getLine(o),!(a[0]=="`"&a.substring(0,3)=="```")););return new f(h,l,o,0)}else{for(;o-- >0&&(a=d.getLine(o),!(a[0]=="`"&a.substring(0,3)=="```")););return new f(o,a.length,h,0)}var g;function m(k){return g=d.getTokens(k)[0],g&&g.type.lastIndexOf(y,0)===0}var y="markup.heading";function b(){var k=g.value[0];return k=="="?6:k=="-"?5:7-g.value.search(/[^#]|$/)}if(m(o)){for(var C=b();++o<u;)if(m(o)){var E=b();if(E>=C)break}if(p=o-(!g||["=","-"].indexOf(g.value[0])==-1?1:2),p>h)for(;p>h&&/^\s*$/.test(d.getLine(p));)p--;if(p>h){var w=d.getLine(p).length;return new f(h,l,p,w)}}}}.call(i.prototype)});ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(t,e,r){"use strict";var s=t("../range").Range,c=function(){};(function(){this.checkOutdent=function(f,i){return/^\s+$/.test(f)?/^\s*\}/.test(i):!1},this.autoOutdent=function(f,i){var d=f.getLine(i),n=d.match(/^(\s*\})/);if(!n)return 0;var o=n[1].length,a=f.findMatchingBracket({row:i,column:o});if(!a||a.row==i)return 0;var l=this.$getIndent(f.getLine(a.row));f.replace(new s(i,0,i,o-1),l)},this.$getIndent=function(f){return f.match(/^\s*/)[0]}}).call(c.prototype),e.MatchingBraceOutdent=c});ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../behaviour").Behaviour,f=t("../../token_iterator").TokenIterator;function i(n,o){return n&&n.type.lastIndexOf(o+".xml")>-1}var d=function(){this.add("string_dquotes","insertion",function(n,o,a,l,u){if(u=='"'||u=="'"){var h=u,p=l.doc.getTextRange(a.getSelectionRange());if(p!==""&&p!=="'"&&p!='"'&&a.getWrapBehavioursEnabled())return{text:h+p+h,selection:!1};var g=a.getCursorPosition(),m=l.doc.getLine(g.row),y=m.substring(g.column,g.column+1),b=new f(l,g.row,g.column),C=b.getCurrentToken();if(y==h&&(i(C,"attribute-value")||i(C,"string")))return{text:"",selection:[1,1]};if(C||(C=b.stepBackward()),!C)return;for(;i(C,"tag-whitespace")||i(C,"whitespace");)C=b.stepBackward();var E=!y||y.match(/\s/);if(i(C,"attribute-equals")&&(E||y==">")||i(C,"decl-attribute-equals")&&(E||y=="?"))return{text:h+h,selection:[1,1]}}}
981),this.add("string_dquotes","deletion",function(n,o,a,l,u){var h=l.doc.getTextRange(u);if(!u.isMultiLine()&&(h=='"'||h=="'")){var p=l.doc.getLine(u.start.row),g=p.substring(u.start.column+1,u.start.column+2);if(g==h)return u.end.column++,u}}),this.add("autoclosing","insertion",function(n,o,a,l,u){if(u==">"){var h=a.getSelectionRange().start,p=new f(l,h.row,h.column),g=p.getCurrentToken()||p.stepBackward();if(!g||!(i(g,"tag-name")||i(g,"tag-whitespace")||i(g,"attribute-name")||i(g,"attribute-equals")||i(g,"attribute-value"))||i(g,"reference.attribute-value"))return;if(i(g,"attribute-value")){var m=p.getCurrentTokenColumn()+g.value.length;if(h.column<m)return;if(h.column==m){var y=p.stepForward();if(y&&i(y,"attribute-value"))return;p.stepBackward()}}if(/^\s*>/.test(l.getLine(h.row).slice(h.column)))return;for(;!i(g,"tag-name");)if(g=p.stepBackward(),g.value=="<"){g=p.stepForward();break}var b=p.getCurrentTokenRow(),C=p.getCurrentTokenColumn();if(i(p.stepBackward(),"end-tag-open"))return;var E=g.value;return b==h.row&&(E=E.substring(0,h.column-C)),this.voidElements&&this.voidElements.hasOwnProperty(E.toLowerCase())?void 0:{text:"></"+E+">",selection:[1,1]}}}),this.add("autoindent","insertion",function(n,o,a,l,u){if(u==`
982`){var h=a.getCursorPosition(),p=l.getLine(h.row),g=new f(l,h.row,h.column),m=g.getCurrentToken();if(i(m,"")&&m.type.indexOf("tag-close")!==-1){if(m.value=="/>")return;for(;m&&m.type.indexOf("tag-name")===-1;)m=g.stepBackward();if(!m)return;var y=m.value,b=g.getCurrentTokenRow();if(m=g.stepBackward(),!m||m.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[y]||!this.voidElements){var C=l.getTokenAt(h.row,h.column+1),p=l.getLine(b),E=this.$getIndent(p),w=E+l.getTabString();return C&&C.value==="</"?{text:`
983`+w+`
984`+E,selection:[1,w.length,1,w.length]}:{text:`
985`+w}}}}})};s.inherits(d,c),e.XmlBehaviour=d});ace.define("ace/mode/behaviour/javascript",["require","exports","module","ace/lib/oop","ace/token_iterator","ace/mode/behaviour/cstyle","ace/mode/behaviour/xml"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../../token_iterator").TokenIterator,f=t("../behaviour/cstyle").CstyleBehaviour,i=t("../behaviour/xml").XmlBehaviour,d=function(){var n=new i({closeCurlyBraces:!0}).getBehaviours();this.addBehaviours(n),this.inherit(f),this.add("autoclosing-fragment","insertion",function(o,a,l,u,h){if(h==">"){var p=l.getSelectionRange().start,g=new c(u,p.row,p.column),m=g.getCurrentToken()||g.stepBackward();if(!m)return;if(m.value=="<")return{text:"></>",selection:[1,1]}}})};s.inherits(d,f),e.JavaScriptBehaviour=d});ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../../range").Range,f=t("./fold_mode").FoldMode,i=e.FoldMode=function(o,a){f.call(this),this.voidElements=o||{},this.optionalEndTags=s.mixin({},this.voidElements),a&&s.mixin(this.optionalEndTags,a)};s.inherits(i,f);var d=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};function n(o,a){return o&&o.type&&o.type.lastIndexOf(a+".xml")>-1}(function(){this.getFoldWidget=function(o,a,l){var u=this._getFirstTagInLine(o,l);return u?u.closing||!u.tagName&&u.selfClosing?a==="markbeginend"?"end":"":!u.tagName||u.selfClosing||this.voidElements.hasOwnProperty(u.tagName.toLowerCase())||this._findEndTagInLine(o,l,u.tagName,u.end.column)?"":"start":this.getCommentFoldWidget(o,l)},this.getCommentFoldWidget=function(o,a){return/comment/.test(o.getState(a))&&/<!-/.test(o.getLine(a))?"start":""},this._getFirstTagInLine=function(o,a){for(var l=o.getTokens(a),u=new d,h=0;h<l.length;h++){var p=l[h];if(n(p,"tag-open")){if(u.end.column=u.start.column+p.value.length,u.closing=n(p,"end-tag-open"),p=l[++h],!p)return null;if(u.tagName=p.value,p.value===""){if(p=l[++h],!p)return null;u.tagName=p.value}for(u.end.column+=p.value.length,h++;h<l.length;h++)if(p=l[h],u.end.column+=p.value.length,n(p,"tag-close")){u.selfClosing=p.value=="/>";break}return u}else if(n(p,"tag-close"))return u.selfClosing=p.value=="/>",u;u.start.column+=p.value.length}return null},this._findEndTagInLine=function(o,a,l,u){for(var h=o.getTokens(a),p=0,g=0;g<h.length;g++){var m=h[g];if(p+=m.value.length,!(p<u-1)&&n(m,"end-tag-open")&&(m=h[g+1],n(m,"tag-name")&&m.value===""&&(m=h[g+2]),m&&m.value==l))return!0}return!1},this.getFoldWidgetRange=function(o,a,l){var u=this._getFirstTagInLine(o,l);if(!u)return this.getCommentFoldWidget(o,l)&&o.getCommentFoldRange(l,o.getLine(l).length);var h=o.getMatchingTags({row:l,column:0});if(h)return new c(h.openTag.end.row,h.openTag.end.column,h.closeTag.start.row,h.closeTag.start.column)}}).call(i.prototype)});ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../../range").Range,f=t("./fold_mode").FoldMode,i=e.FoldMode=function(d){d&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+d.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+d.end)))};s.inherits(i,f),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(d,n,o){var a=d.getLine(o);if(this.singleLineBlockCommentRe.test(a)&&!this.startRegionRe.test(a)&&!this.tripleStarBlockCommentRe.test(a))return"";var l=this._getFoldWidgetBase(d,n,o);return!l&&this.startRegionRe.test(a)?"start":l},this.getFoldWidgetRange=function(d,n,o,a){var l=d.getLine(o);if(this.startRegionRe.test(l))return this.getCommentRegionBlock(d,l,o);var p=l.match(this.foldingStartMarker);if(p){var u=p.index;if(p[1])return this.openingBracketBlock(d,p[1],o,u);var h=d.getCommentFoldRange(o,u+p[0].length,1);return h&&!h.isMultiLine()&&(a?h=this.getSectionRange(d,o):n!="all"&&(h=null)),h}if(n!=="markbegin"){var p=l.match(this.foldingStopMarker);if(p){var u=p.index+p[0].length;return p[1]?this.closingBracketBlock(d,p[1],o,u):d.getCommentFoldRange(o,u,-1)}}}
985,this.getSectionRange=function(d,n){var o=d.getLine(n),a=o.search(/\S/),l=n,u=o.length;n=n+1;for(var h=n,p=d.getLength();++n<p;){o=d.getLine(n);var g=o.search(/\S/);if(g!==-1){if(a>g)break;var m=this.getFoldWidgetRange(d,"all",n);if(m){if(m.start.row<=l)break;if(m.isMultiLine())n=m.end.row;else if(a==g)break}h=n}}return new c(l,u,h,d.getLine(h).length)},this.getCommentRegionBlock=function(d,n,o){for(var a=n.search(/\s*$/),l=d.getLength(),u=o,h=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,p=1;++o<l;){n=d.getLine(o);var g=h.exec(n);if(g&&(g[1]?p--:p++,!p))break}var m=o;if(m>u)return new c(u,a,m,n.length)}}.call(i.prototype)});ace.define("ace/mode/folding/javascript",["require","exports","module","ace/lib/oop","ace/mode/folding/xml","ace/mode/folding/cstyle"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("./xml").FoldMode,f=t("./cstyle").FoldMode,i=e.FoldMode=function(d){d&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+d.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+d.end))),this.xmlFoldMode=new c};s.inherits(i,f),function(){this.getFoldWidgetRangeBase=this.getFoldWidgetRange,this.getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(d,n,o){var a=this.getFoldWidgetBase(d,n,o);return a||this.xmlFoldMode.getFoldWidget(d,n,o)},this.getFoldWidgetRange=function(d,n,o,a){var l=this.getFoldWidgetRangeBase(d,n,o,a);return l||this.xmlFoldMode.getFoldWidgetRange(d,n,o)}}.call(i.prototype)});ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/javascript","ace/mode/folding/javascript"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text").Mode,f=t("./javascript_highlight_rules").JavaScriptHighlightRules,i=t("./matching_brace_outdent").MatchingBraceOutdent,d=t("../wor
985ker/worker_client").WorkerClient,n=t("./behaviour/javascript").JavaScriptBehaviour,o=t("./folding/javascript").FoldMode,a=function(){this.HighlightRules=f,this.$outdent=new i,this.$behaviour=new n,this.foldingRules=new o};s.inherits(a,c),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.$quotes={'"':'"',"'":"'","`":"`"},this.$pairQuotesAfter={"`":/\w/},this.getNextLineIndent=function(l,u,h){var p=this.$getIndent(u),g=this.getTokenizer().getLineTokens(u,l),m=g.tokens,y=g.state;if(m.length&&m[m.length-1].type=="comment")return p;if(l=="start"||l=="no_regex"){var b=u.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);b&&(p+=h)}else if(l=="doc-start"&&(y=="start"||y=="no_regex"))return"";return p},this.checkOutdent=function(l,u,h){return this.$outdent.checkOutdent(u,h)},this.autoOutdent=function(l,u,h){this.$outdent.autoOutdent(u,h)},this.createWorker=function(l){var u=new d(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return u.attachToDocument(l.getDocument()),u.on("annotate",function(h){l.setAnnotations(h.data)}),u.on("terminate",function(){l.clearAnnotations()}),u},this.$id="ace/mode/javascript",this.snippetFileId="ace/snippets/javascript"}.call(a.prototype),e.Mode=a});ace.define("ace/mode/css_completions",["require","exports","module"],function(t,e,r){"use strict";var s={background:{"#$0":1},"background-color":{"#$0":1,transparent:1,fixed:1},"background-image":{"url('/$0')":1},"background-repeat":{repeat:1,"repeat-x":1,"repeat-y":1,"no-repeat":1,inherit:1},"background-position":{bottom:2,center:2,left:2,right:2,top:2,inherit:2},"background-attachment":{scroll:1,fixed:1},"background-size":{cover:1,contain:1},"background-clip":{"border-box":1,"padding-box":1,"content-box":1},"background-origin":{"border-box":1,"padding-box":1,"content-box":1},border:{"solid $0":1,"dashed $0":1,"dotted $0":1,"#$0":1},"border-color":{"#$0":1},"border-style":{solid:2,dashed:2,dotted:2,double:2,groove:2,hidden:2,inherit:2,inset:2,none:2,outset:2,ridged:2},"border-collapse":{collapse:1,separate:1},bottom:{px:1,em:1,"%":1},clear:{left:1,right:1,both:1,none:1},color:{"#$0":1,"rgb(#$00,0,0)":1},cursor:{default:1,pointer:1,move:1,text:1,wait:1,help:1,progress:1,"n-resize":1,"ne-resize":1,"e-resize":1,"se-resize":1,"s-resize":1,"sw-resize":1,"w-resize":1,"nw-resize":1},display:{none:1,block:1,inline:1,"inline-block":1,"table-cell":1},"empty-cells":{show:1,hide:1},float:{left:1,right:1,none:1},"font-family":{Arial:2,"Comic Sans MS":2,Consolas:2,"Courier New":2,Courier:2,Georgia:2,Monospace:2,"Sans-Serif":2,"Segoe UI":2,Tahoma:2,"Times New Roman":2,"Trebuchet MS":2,Verdana:1},"font-size":{px:1,em:1,"%":1},"font-weight":{bold:1,normal:1},"font-style":{italic:1,normal:1},"font-variant":{normal:1,"small-caps":1},height:{px:1,em:1,"%":1},left:{px:1,em:1,"%":1},"letter-spacing":{normal:1},"line-height":{normal:1},"list-style-type":{none:1,disc:1,circle:1,square:1,decimal:1,"decimal-leading-zero":1,"lower-roman":1,"upper-roman":1,"lower-greek":1,"lower-latin":1,"upper-latin":1,georgian:1,"lower-alpha":1,"upper-alpha":1},margin:{px:1,em:1,"%":1},"margin-right":{px:1,em:1,"%":1},"margin-left":{px:1,em:1,"%":1},"margin-top":{px:1,em:1,"%":1},"margin-bottom":{px:1,em:1,"%":1},"max-height":{px:1,em:1,"%":1},"max-width":{px:1,em:1,"%":1},"min-height":{px:1,em:1,"%":1},"min-width":{px:1,em:1,"%":1},overflow:{hidden:1,visible:1,auto:1,scroll:1},"overflow-x":{hidden:1,visible:1,auto:1,scroll:1},"overflow-y":{hidden:1,visible:1,auto:1,scroll:1},padding:{px:1,em:1,"%":1},"padding-top":{px:1,em:1,"%":1},"padding-right":{px:1,em:1,"%":1},"padding-bottom":{px:1,em:1,"%":1},"padding-left":{px:1,em:1,"%":1},"page-break-after":{auto:1,always:1,avoid:1,left:1,right:1},"page-break-before":{auto:1,always:1,avoid:1,left:1,right:1},position:{absolute:1,relative:1,fixed:1,static:1},right:{px:1,em:1,"%":1},"table-layout":{fixed:1,auto:1},"text-decoration":{none:1,underline:1,"line-through":1,blink:1},"text-align":{left:1,right:1,center:1,justify:1},"text-transform":{capitalize:1,uppercase:1,lowercase:1,none:1},top:{px:1,em:1,"%":1},"vertical-align":{top:1,bottom:1},visibility:{hidden:1,visible:1},"white-space":{nowrap:1,normal:1,pre:1,"pre-line":1,"pre-wrap":1},width:{px:1,em:1,"%":1},"word-spacing":{normal:1},filter:{"alpha(opacity=$0100)":1},"text-shadow":{"$02px 2px 2px #777":1},"text-overflow":{"ellipsis-word":1,clip:1,ellipsis:1},"-moz-border-radius":1,"-moz-border-radius-topright":1,"-moz-border-radius-bottomright":1,"-moz-border-radius-topleft":1,"-moz-border-radius-bottomleft":1,"-webkit-border-radius":1,"-webkit-border-top-right-radius":1,"-webkit-border-top-left-radius":1,"-webkit-border-bottom-right-radius":1,"-webkit-border-bottom-left-radius":1,"-moz-box-shadow":1,"-webkit-box-shadow":1,transform:{"rotate($00deg)":1,"skew($00deg)":1},"-moz-transform":{"rotate($00deg)":1,"skew($00deg)":1},"-webkit-transform":{"rotate($00deg)":1,"skew($00deg)":1}},c=function(){};(function(){this.completionsDefined=!1,this.defineCompletions=function(){if(document){var f=document.createElement("c").style;for(var i in f)if(typeof f[i]=="string"){var d=i.replace(/[A-Z]/g,function(n){return"-"+n.toLowerCase()});s.hasOwnProperty(d)||(s[d]=1)}}this.completionsDefined=!0}
985,this.getCompletions=function(f,i,d,n){if(this.completionsDefined||this.defineCompletions(),f==="ruleset"||i.$mode.$id=="ace/mode/scss"){var o=i.getLine(d.row).substr(0,d.column),a=/\([^)]*$/.test(o);return a&&(o=o.substr(o.lastIndexOf("(")+1)),/:[^;]+$/.test(o)?(/([\w\-]+):[^:]*$/.test(o),this.getPropertyValueCompletions(f,i,d,n)):this.getPropertyCompletions(f,i,d,n,a)}return[]},this.getPropertyCompletions=function(f,i,d,n,o){o=o||!1;var a=Object.keys(s);return a.map(function(l){return{caption:l,snippet:l+": $0"+(o?"":";"),meta:"property",score:1e6}})},this.getPropertyValueCompletions=function(f,i,d,n){var o=i.getLine(d.row).substr(0,d.column),a=(/([\w\-]+):[^:]*$/.exec(o)||{})[1];if(!a)return[];var l=[];return a in s&&typeof s[a]=="object"&&(l=Object.keys(s[a])),l.map(function(u){return{caption:u,snippet:u,meta:"property value",score:1e6}})}}).call(c.prototype),e.CssCompletions=c});ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("../behaviour").Behaviour,f=t("./cstyle").CstyleBehaviour,i=t("../../token_iterator").TokenIterator,d=function(){this.inherit(f),this.add("colon","insertion",function(n,o,a,l,u){if(u===":"&&a.selection.isEmpty()){var h=a.getCursorPosition(),p=new i(l,h.row,h.column),g=p.getCurrentToken();if(g&&g.value.match(/\s+/)&&(g=p.stepBackward()),g&&g.type==="support.type"){var m=l.doc.getLine(h.row),y=m.substring(h.column,h.column+1);if(y===":")return{text:"",selection:[1,1]};if(/^(\s+[^;]|\s*$)/.test(m.substring(h.column)))return{text:":;",selection:[1,1]}}}}),this.add("colon","deletion",function(n,o,a,l,u){var h=l.doc.getTextRange(u);if(!u.isMultiLine()&&h===":"){var p=a.getCursorPosition(),g=new i(l,p.row,p.column),m=g.getCurrentToken();if(m&&m.value.match(/\s+/)&&(m=g.stepBackward()),m&&m.type==="support.type"){var y=l.doc.getLine(u.start.row),b=y.substring(u.end.column,u.end.column+1);if(b===";")return u.end.column++,u}}}),this.add("semicolon","insertion",function(n,o,a,l,u){if(u===";"&&a.selection.isEmpty()){var h=a.getCursorPosition(),p=l.doc.getLine(h.row),g=p.substring(h.column,h.column+1);if(g===";")return{text:"",selection:[1,1]}}}),this.add("!important","insertion",function(n,o,a,l,u){if(u==="!"&&a.selection.isEmpty()){var h=a.getCursorPosition(),p=l.doc.getLine(h.row);if(/^\s*(;|}|$)/.test(p.substring(h.column)))return{text:"!important",selection:[10,10]}}})};s.inherits(d,f),e.CssBehaviour=d});ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text").Mode,f=t("./css_highlight_rules").CssHighlightRules,i=t("./matching_brace_outdent").MatchingBraceOutdent,d=t("../wor
985ker/worker_client").WorkerClient,n=t("./css_completions").CssCompletions,o=t("./behaviour/css").CssBehaviour,a=t("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=f,this.$outdent=new i,this.$behaviour=new o,this.$completer=new n,this.foldingRules=new a};s.inherits(l,c),function(){this.foldingRules="cStyle",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(u,h,p){var g=this.$getIndent(h),m=this.getTokenizer().getLineTokens(h,u).tokens;if(m.length&&m[m.length-1].type=="comment")return g;var y=h.match(/^.*\{\s*$/);return y&&(g+=p),g},this.checkOutdent=function(u,h,p){return this.$outdent.checkOutdent(h,p)},this.autoOutdent=function(u,h,p){this.$outdent.autoOutdent(h,p)},this.getCompletions=function(u,h,p,g){return this.$completer.getCompletions(u,h,p,g)},this.createWorker=function(u){var h=new d(["ace"],"ace/mode/css_worker","Worker");return h.attachToDocument(u.getDocument()),h.on("annotate",function(p){u.setAnnotations(p.data)}),h.on("terminate",function(){u.clearAnnotations()}),h},this.$id="ace/mode/css",this.snippetFileId="ace/snippets/css"}.call(l.prototype),e.Mode=l});ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("./fold_mode").FoldMode,f=e.FoldMode=function(i,d){this.defaultMode=i,this.subModes=d};s.inherits(f,c),function(){this.$getMode=function(i){typeof i!="string"&&(i=i[0]);for(var d in this.subModes)if(i.indexOf(d)===0)return this.subModes[d];return null},this.$tryMode=function(i,d,n,o){var a=this.$getMode(i);return a?a.getFoldWidget(d,n,o):""},this.getFoldWidget=function(i,d,n){return this.$tryMode(i.getState(n-1),i,d,n)||this.$tryMode(i.getState(n),i,d,n)||this.defaultMode.getFoldWidget(i,d,n)},this.getFoldWidgetRange=function(i,d,n){var o=this.$getMode(i.getState(n-1));return(!o||!o.getFoldWidget(i,d,n))&&(o=this.$getMode(i.getState(n))),(!o||!o.getFoldWidget(i,d,n))&&(o=this.defaultMode),o.getFoldWidgetRange(i,d,n)}}.call(f.prototype)});ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"],function(t,e,r){"use strict";var s=t("../../lib/oop"),c=t("./mixed").FoldMode,f=t("./xml").FoldMode,i=t("./cstyle").FoldMode,d=e.FoldMode=function(n,o){c.call(this,new f(n,o),{"js-":new i,"css-":new i})};s.inherits(d,c)});ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"],function(t,e,r){"use strict";var s=t("../token_iterator").TokenIterator,c=["accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","inert","itemid","itemprop","itemref","itemscope","itemtype","lang","spellcheck","style","tabindex","title","translate"],f=["onabort","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","onvolumechange","onwaiting"],i=c.concat(f),d={a:{href:1,target:{_blank:1,top:1},ping:1,rel:{nofollow:1,alternate:1,author:1,bookmark:1,help:1,license:1,next:1,noreferrer:1,prefetch:1,prev:1,search:1,tag:1},media:1,hreflang:1,type:1},abbr:{},address:{},area:{shape:1,coords:1,href:1,hreflang:1,alt:1,target:1,media:1,rel:1,ping:1,type:1},article:{pubdate:1},aside:{},audio:{src:1,autobuffer:1,autoplay:{autoplay:1},loop:{loop:1},controls:{controls:1},muted:{muted:1},preload:{auto:1,metadata:1,none:1}},b:{},base:{href:1,target:1},bdi:{},bdo:{},blockquote:{cite:1},body:{onafterprint:1,onbeforeprint:1,onbeforeunload:1,onhashchange:1,onmessage:1,onoffline:1,onpopstate:1,onredo:1,onresize:1,onstorage:1,onundo:1,onunload:1},br:{},button:{autofocus:1,disabled:{disabled:1},form:1,formaction:1,formenctype:1,formmethod:1,formnovalidate:1,formtarget:1,name:1,value:1,type:{button:1,submit:1}},canvas:{width:1,height:1},caption:{},cite:{},code:{}
985,col:{span:1},colgroup:{span:1},command:{type:1,label:1,icon:1,disabled:1,checked:1,radiogroup:1,command:1},data:{},datalist:{},dd:{},del:{cite:1,datetime:1},details:{open:1},dfn:{},dialog:{open:1},div:{},dl:{},dt:{},em:{},embed:{src:1,height:1,width:1,type:1},fieldset:{disabled:1,form:1,name:1},figcaption:{},figure:{},footer:{},form:{"accept-charset":1,action:1,autocomplete:1,enctype:{"multipart/form-data":1,"application/x-www-form-urlencoded":1},method:{get:1,post:1},name:1,novalidate:1,target:{_blank:1,top:1}},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{},header:{},hr:{},html:{manifest:1},i:{},iframe:{name:1,src:1,height:1,width:1,sandbox:{"allow-same-origin":1,"allow-top-navigation":1,"allow-forms":1,"allow-scripts":1},seamless:{seamless:1}},img:{alt:1,src:1,height:1,width:1,usemap:1,ismap:1},input:{type:{text:1,password:1,hidden:1,checkbox:1,submit:1,radio:1,file:1,button:1,reset:1,image:31,color:1,date:1,datetime:1,"datetime-local":1,email:1,month:1,number:1,range:1,search:1,tel:1,time:1,url:1,week:1},accept:1,alt:1,autocomplete:{on:1,off:1},autofocus:{autofocus:1},checked:{checked:1},disabled:{disabled:1},form:1,formaction:1,formenctype:{"application/x-www-form-urlencoded":1,"multipart/form-data":1,"text/plain":1},formmethod:{get:1,post:1},formnovalidate:{formnovalidate:1},formtarget:{_blank:1,_self:1,_parent:1,_top:1},height:1,list:1,max:1,maxlength:1,min:1,multiple:{multiple:1},name:1,pattern:1,placeholder:1,readonly:{readonly:1},required:{required:1},size:1,src:1,step:1,width:1,files:1,value:1},ins:{cite:1,datetime:1},kbd:{},keygen:{autofocus:1,challenge:{challenge:1},disabled:{disabled:1},form:1,keytype:{rsa:1,dsa:1,ec:1},name:1},label:{form:1,for:1},legend:{},li:{value:1},link:{href:1,hreflang:1,rel:{stylesheet:1,icon:1},media:{all:1,screen:1,print:1},type:{"text/css":1,"image/png":1,"image/jpeg":1,"image/gif":1},sizes:1},main:{},map:{name:1},mark:{},math:{},menu:{type:1,label:1},meta:{"http-equiv":{"content-type":1},name:{description:1,keywords:1},content:{"text/html; charset=UTF-8":1},charset:1},meter:{value:1,min:1,max:1,low:1,high:1,optimum:1},nav:{},noscript:{href:1},object:{param:1,data:1,type:1,height:1,width:1,usemap:1,name:1,form:1,classid:1},ol:{start:1,reversed:1},optgroup:{disabled:1,label:1},option:{disabled:1,selected:1,label:1,value:1},output:{for:1,form:1,name:1},p:{},param:{name:1,value:1},pre:{},progress:{value:1,max:1},q:{cite:1},rp:{},rt:{},ruby:{},s:{},samp:{},script:{charset:1,type:{"text/javascript":1},src:1,defer:1,async:1},select:{autofocus:1,disabled:1,form:1,multiple:{multiple:1},name:1,size:1,readonly:{readonly:1}},small:{},source:{src:1,type:1,media:1},span:{},strong:{},style:{type:1,media:{all:1,screen:1,print:1},scoped:1},sub:{},sup:{},svg:{},table:{summary:1},tbody:{},td:{headers:1,rowspan:1,colspan:1},textarea:{autofocus:{autofocus:1},disabled:{disabled:1},form:1,maxlength:1,name:1,placeholder:1,readonly:{readonly:1},required:{required:1},rows:1,cols:1,wrap:{on:1,off:1,hard:1,soft:1}},tfoot:{},th:{headers:1,rowspan:1,colspan:1,scope:1},thead:{},time:{datetime:1},title:{},tr:{},track:{kind:1,src:1,srclang:1,label:1,default:1},section:{},summary:{},u:{},ul:{},var:{},video:{src:1,autobuffer:1,autoplay:{autoplay:1},loop:{loop:1},controls:{controls:1},width:1,height:1,poster:1,muted:{muted:1},preload:{auto:1,metadata:1,none:1}},wbr:{}},n=Object.keys(d);function o(h,p){return h.type.lastIndexOf(p+".xml")>-1}function a(h,p){for(var g=new s(h,p.row,p.column),m=g.getCurrentToken();m&&!o(m,"tag-name");)m=g.stepBackward();if(m)return m.value}function l(h,p){for(var g=new s(h,p.row,p.column),m=g.getCurrentToken();m&&!o(m,"attribute-name");)m=g.stepBackward();if(m)return m.value}var u=function(){};(function(){this.getCompletions=function(h,p,g,m){var y=p.getTokenAt(g.row,g.column);if(!y)return[];if(o(y,"tag-name")||o(y,"tag-open")||o(y,"end-tag-open"))return this.getTagCompletions(h,p,g,m);if(o(y,"tag-whitespace")||o(y,"attribute-name"))return this.getAttributeCompletions(h,p,g,m);if(o(y,"attribute-value"))return this.getAttributeValueCompletions(h,p,g,m);var b=p.getLine(g.row).substr(0,g.column);return/&[a-z]*$/i.test(b)?this.getHTMLEntityCompletions(h,p,g,m):[]},this.getTagCompletions=function(h,p,g,m){return n.map(function(y){return{value:y,meta:"tag",score:1e6}})},this.getAttributeCompletions=function(h,p,g,m){var y=a(p,g);if(!y)return[];var b=i;return y in d&&(b=b.concat(Object.keys(d[y]))),b.map(function(C){return{caption:C,snippet:C+'="$0"',meta:"attribute",score:1e6}})},this.getAttributeValueCompletions=function(h,p,g,m){var y=a(p,g),b=l(p,g);if(!y)return[];var C=[];return y in d&&b in d[y]&&typeof d[y][b]=="object"&&(C=Object.keys(d[y][b])),C.map(function(E){return{caption:E,snippet:E,meta:"attribute value",score:1e6}})},this.getHTMLEntityCompletions=function(h,p,g,m){var y=["Aacute;","aacute;","Acirc;","acirc;","acute;","AElig;","aelig;","Agrave;","agrave;","alefsym;","Alpha;","alpha;","amp;","and;","ang;","Aring;","aring;","asymp;","Atilde;","atilde;","Auml;","auml;","bdquo;","Beta;","beta;","brvbar;","bull;","cap;","Ccedil;","ccedil;","cedil;","cent;","Chi;","chi;","circ;","clubs;","cong;","copy;","crarr;","cup;","curren;","Dagger;","dagger;","dArr;","darr;","deg;","Delta;","delta;","diams;","divide;","Eacute;","eacute;","Ecirc;","ecirc;
985","Egrave;","egrave;","empty;","emsp;","ensp;","Epsilon;","epsilon;","equiv;","Eta;","eta;","ETH;","eth;","Euml;","euml;","euro;","exist;","fnof;","forall;","frac12;","frac14;","frac34;","frasl;","Gamma;","gamma;","ge;","gt;","hArr;","harr;","hearts;","hellip;","Iacute;","iacute;","Icirc;","icirc;","iexcl;","Igrave;","igrave;","image;","infin;","int;","Iota;","iota;","iquest;","isin;","Iuml;","iuml;","Kappa;","kappa;","Lambda;","lambda;","lang;","laquo;","lArr;","larr;","lceil;","ldquo;","le;","lfloor;","lowast;","loz;","lrm;","lsaquo;","lsquo;","lt;","macr;","mdash;","micro;","middot;","minus;","Mu;","mu;","nabla;","nbsp;","ndash;","ne;","ni;","not;","notin;","nsub;","Ntilde;","ntilde;","Nu;","nu;","Oacute;","oacute;","Ocirc;","ocirc;","OElig;","oelig;","Ograve;","ograve;","oline;","Omega;","omega;","Omicron;","omicron;","oplus;","or;","ordf;","ordm;","Oslash;","oslash;","Otilde;","otilde;","otimes;","Ouml;","ouml;","para;","part;","permil;","perp;","Phi;","phi;","Pi;","pi;","piv;","plusmn;","pound;","Prime;","prime;","prod;","prop;","Psi;","psi;","quot;","radic;","rang;","raquo;","rArr;","rarr;","rceil;","rdquo;","real;","reg;","rfloor;","Rho;","rho;","rlm;","rsaquo;","rsquo;","sbquo;","Scaron;","scaron;","sdot;","sect;","shy;","Sigma;","sigma;","sigmaf;","sim;","spades;","sub;","sube;","sum;","sup;","sup1;","sup2;","sup3;","supe;","szlig;","Tau;","tau;","there4;","Theta;","theta;","thetasym;","thinsp;","THORN;","thorn;","tilde;","times;","trade;","Uacute;","uacute;","uArr;","uarr;","Ucirc;","ucirc;","Ugrave;","ugrave;","uml;","upsih;","Upsilon;","upsilon;","Uuml;","uuml;","weierp;","Xi;","xi;","Yacute;","yacute;","yen;","Yuml;","yuml;","Zeta;","zeta;","zwj;","zwnj;"];return y.map(function(b){return{caption:b,snippet:b,meta:"html entity",score:1e6}})}}).call(u.prototype),e.HtmlCompletions=u});ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/lang"),f=t("./text").Mode,i=t("./javascript").Mode,d=t("./css").Mode,n=t("./html_highlight_rules").HtmlHighlightRules,o=t("./behaviour/xml").XmlBehaviour,a=t("./folding/html").FoldMode,l=t("./html_completions").HtmlCompletions,u=t("../worker/worker_client").WorkerClient,h=["area","base","br","col","embed","hr","img","input","keygen","link","meta","menuitem","param","source","track","wbr"],p=["li","dt","dd","p","rt","rp","optgroup","option","colgroup","td","th"],g=function(m){this.fragmentContext=m&&m.fragmentContext,this.HighlightRules=n,this.$behaviour=new o,this.$completer=new l,this.createModeDelegates({"js-":i,"css-":d}),this.foldingRules=new a(this.voidElements,c.arrayToMap(p))};s.inherits(g,f),function(){this.blockComment={start:"<!--",end:"-->"},this.voidElements=c.arrayToMap(h),this.getNextLineIndent=function(m,y,b){return this.$getIndent(y)},this.checkOutdent=function(m,y,b){return!1},this.getCompletions=function(m,y,b,C){return this.$completer.getCompletions(m,y,b,C)},this.createWorker=function(m){if(this.constructor==g){var y=new u(["ace"],"ace/mode/html_worker","Worker");return y.attachToDocument(m.getDocument()),this.fragmentContext&&y.call("setOptions",[{context:this.fragmentContext}]),y.on("error",function(b){m.setAnnotations(b.data)}),y.on("terminate",function(){m.clearAnnotations()}),y}},this.$id="ace/mode/html",this.snippetFileId="ace/snippets/html"}.call(g.prototype),e.Mode=g});ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text_highlight_rules").TextHighlightRules,f=e.reservedKeywords="!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set|function|declare|readonly",i=e.languageConstructs="[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait",d=function(){var n=this.createKeywordMapper({keyword:f,"support.function.builtin":i,"invalid.deprecated":"debugger"},"identifier"),o="(?:(?:[1-9]\\d*)|(?:0))",a="(?:\\.\\d+)",l="(?:\\d+)",u="(?:(?:"+l+"?"+a+")|(?:"+l+"\\.))",h="(?:(?:"+u+"|"+l+"))",p="(?:"+h+"|"+u+")",g="(?:&"+l+")",m="[a-zA-Z_][a-zA-Z0-9_]*",y="(?:"+m+"(?==))",b="
985(?:\\$(?:SHLVL|\\$|\\!|\\?))",C="(?:"+m+"\\s*\\(\\))";this.$rules={start:[{token:"constant",regex:/\\./},{token:["text","comment"],regex:/(^|\s)(#.*)$/},{token:"string.start",regex:'"',push:[{token:"constant.language.escape",regex:/\\(?:[$`"\\]|$)/},{include:"variables"},{token:"keyword.operator",regex:/`/},{token:"string.end",regex:'"',next:"pop"},{defaultToken:"string"}]},{token:"string",regex:"\\$'",push:[{token:"constant.language.escape",regex:/\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/},{token:"string",regex:"'",next:"pop"},{defaultToken:"string"}]},{regex:"<<<",token:"keyword.operator"},{stateName:"heredoc",regex:"(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",onMatch:function(E,w,k){var I=E[2]=="-"?"indentedHeredoc":"heredoc",L=E.split(this.splitRegex);return k.push(I,L[4]),[{type:"constant",value:L[1]},{type:"text",value:L[2]},{type:"string",value:L[3]},{type:"support.class",value:L[4]},{type:"string",value:L[5]}]},rules:{heredoc:[{onMatch:function(E,w,k){return E===k[1]?(k.shift(),k.shift(),this.next=k[0]||"start","support.class"):(this.next="","string")},regex:".*$",next:"start"}],indentedHeredoc:[{token:"string",regex:"^	+"},{onMatch:function(E,w,k){return E===k[1]?(k.shift(),k.shift(),this.next=k[0]||"start","support.class"):(this.next="","string")},regex:".*$",next:"start"}]}},{regex:"$",token:"empty",next:function(E,w){return w[0]==="heredoc"||w[0]==="indentedHeredoc"?w[0]:E}},{token:["keyword","text","text","text","variable"],regex:/(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/},{token:"variable.language",regex:b},{token:"variable",regex:y},{include:"variables"},{token:"support.function",regex:C},{token:"support.function",regex:g},{token:"string",start:"'",end:"'"},{token:"constant.numeric",regex:p},{token:"constant.numeric",regex:o+"\\b"},{token:n,regex:"[a-zA-Z_][a-zA-Z0-9_]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"},{token:"punctuation.operator",regex:";"},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]]"},{token:"paren.rparen",regex:"[\\)\\}]",next:"pop"}],variables:[{token:"variable",regex:/(\$)(\w+)/},{token:["variable","paren.lparen"],regex:/(\$)(\()/,push:"start"},{token:["variable","paren.lparen","keyword.operator","variable","keyword.operator"],regex:/(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,push:"start"},{token:"variable",regex:/\$[*@#?\-$!0_]/},{token:["variable","paren.lparen"],regex:/(\$)(\{)/,push:"start"}]},this.normalizeRules()};s.inherits(d,c),e.ShHighlightRules=d});ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./text").Mode,f=t("./sh_highlight_rules").ShHighlightRules,i=t("../range").Range,d=t("./folding/cstyle").FoldMode,n=function(){this.HighlightRules=f,this.foldingRules=new d,this.$behaviour=this.$defaultBehaviour};s.inherits(n,c),function(){this.lineCommentStart="#",this.getNextLineIndent=function(a,l,u){var h=this.$getIndent(l),p=this.getTokenizer().getLineTokens(l,a),g=p.tokens;if(g.length&&g[g.length-1].type=="comment")return h;if(a=="start"){var m=l.match(/^.*[\{\(\[:]\s*$/);m&&(h+=u)}return h};var o={pass:1,return:1,raise:1,break:1,continue:1};this.checkOutdent=function(a,l,u){if(u!==`\r
986`&&u!=="\r"&&u!==`
987`)return!1;var h=this.getTokenizer().getLineTokens(l.trim(),a).tokens;if(!h)return!1;do var p=h.pop();while(p&&(p.type=="comment"||p.type=="text"&&p.value.match(/^\s+$/)));return p?p.type=="keyword"&&o[p.value]:!1},this.autoOutdent=function(a,l,u){u+=1;var h=this.$getIndent(l.getLine(u)),p=l.getTabString();h.slice(-p.length)==p&&l.remove(new i(u,h.length-p.length,u,h.length))},this.$id="ace/mode/sh",this.snippetFileId="ace/snippets/sh"}.call(n.prototype),e.Mode=n});ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/wor
987ker_client"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("../lib/lang"),f=t("./text").Mode,i=t("./xml_highlight_rules").XmlHighlightRules,d=t("./behaviour/xml").XmlBehaviour,n=t("./folding/xml").FoldMode,o=t("../worker/worker_client").WorkerClient,a=function(){this.HighlightRules=i,this.$behaviour=new d,this.foldingRules=new n};s.inherits(a,f),function(){this.voidElements=c.arrayToMap([]),this.blockComment={start:"<!--",end:"-->"},this.createWorker=function(l){var u=new o(["ace"],"ace/mode/xml_worker","Worker");return u.attachToDocument(l.getDocument()),u.on("error",function(h){l.setAnnotations(h.data)}),u.on("terminate",function(){l.clearAnnotations()}),u},this.$id="ace/mode/xml"}.call(a.prototype),e.Mode=a});ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/behaviour/cstyle","ace/mode/text","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"],function(t,e,r){"use strict";var s=t("../lib/oop"),c=t("./behaviour/cstyle").CstyleBehaviour,f=t("./text").Mode,i=t("./markdown_highlight_rules").MarkdownHighlightRules,d=t("./folding/markdown").FoldMode,n=function(){this.HighlightRules=i,this.createModeDelegates({javascript:t("./javascript").Mode,html:t("./html").Mode,bash:t("./sh").Mode,sh:t("./sh").Mode,xml:t("./xml").Mode,css:t("./css").Mode}),this.foldingRules=new d,this.$behaviour=new c({braces:!0})};s.inherits(n,f),function(){this.type="text",this.blockComment={start:"<!--",end:"-->"},this.$quotes={'"':'"',"`":"`"},this.getNextLineIndent=function(o,a,l){if(o=="listblock"){var u=/^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(a);if(!u)return"";var h=u[2];return h||(h=parseInt(u[3],10)+1+"."),u[1]+h+u[4]}else return this.$getIndent(a)},this.$id="ace/mode/markdown",this.snippetFileId="ace/snippets/markdown"}.call(n.prototype),e.Mode=n});(function(){ace.require(["ace/mode/markdown"],function(t){typeof ns=="object"&&typeof ep=="object"&&ns&&(ns.exports=t)})})()});var rp=Ye((np,rs)=>{ace.define("ace/theme/monokai-css",["require","exports","module"],function(t,e,r){r.exports=`.ace-monokai .ace_gutter {
988  background: #2F3129;
989  color: #8F908A
990}
991
992.ace-monokai .ace_print-margin {
993  width: 1px;
994  background: #555651
995}
996
997.ace-monokai {
998  background-color: #272822;
999  color: #F8F8F2
1000}
1001
1002.ace-monokai .ace_cursor {
1003  color: #F8F8F0
1004}
1005
1006.ace-monokai .ace_marker-layer .ace_selection {
1007  background: #49483E
1008}
1009
1010.ace-monokai.ace_multiselect .ace_selection.ace_start {
1011  box-shadow: 0 0 3px 0px #272822;
1012}
1013
1014.ace-monokai .ace_marker-layer .ace_step {
1015  background: rgb(102, 82, 0)
1016}
1017
1018.ace-monokai .ace_marker-layer .ace_bracket {
1019  margin: -1px 0 0 -1px;
1020  border: 1px solid #49483E
1021}
1022
1023.ace-monokai .ace_marker-layer .ace_active-line {
1024  background: #202020
1025}
1026
1027.ace-monokai .ace_gutter-active-line {
1028  background-color: #272727
1029}
1030
1031.ace-monokai .ace_marker-layer .ace_selected-word {
1032  border: 1px solid #49483E
1033}
1034
1035.ace-monokai .ace_invisible {
1036  color: #52524d
1037}
1038
1039.ace-monokai .ace_entity.ace_name.ace_tag,
1040.ace-monokai .ace_keyword,
1041.ace-monokai .ace_meta.ace_tag,
1042.ace-monokai .ace_storage {
1043  color: #F92672
1044}
1045
1046.ace-monokai .ace_punctuation,
1047.ace-monokai .ace_punctuation.ace_tag {
1048  color: #fff
1049}
1050
1051.ace-monokai .ace_constant.ace_character,
1052.ace-monokai .ace_constant.ace_language,
1053.ace-monokai .ace_constant.ace_numeric,
1054.ace-monokai .ace_constant.ace_other {
1055  color: #AE81FF
1056}
1057
1058.ace-monokai .ace_invalid {
1059  color: #F8F8F0;
1060  background-color: #F92672
1061}
1062
1063.ace-monokai .ace_invalid.ace_deprecated {
1064  color: #F8F8F0;
1065  background-color: #AE81FF
1066}
1067
1068.ace-monokai .ace_support.ace_constant,
1069.ace-monokai .ace_support.ace_function {
1070  color: #66D9EF
1071}
1072
1073.ace-monokai .ace_fold {
1074  background-color: #A6E22E;
1075  border-color: #F8F8F2
1076}
1077
1078.ace-monokai .ace_storage.ace_type,
1079.ace-monokai .ace_support.ace_class,
1080.ace-monokai .ace_support.ace_type {
1081  font-style: italic;
1082  color: #66D9EF
1083}
1084
1085.ace-monokai .ace_entity.ace_name.ace_function,
1086.ace-monokai .ace_entity.ace_other,
1087.ace-monokai .ace_entity.ace_other.ace_attribute-name,
1088.ace-monokai .ace_variable {
1089  color: #A6E22E
1090}
1091
1092.ace-monokai .ace_variable.ace_parameter {
1093  font-style: italic;
1094  color: #FD971F
1095}
1096
1097.ace-monokai .ace_string {
1098  color: #E6DB74
1099}
1100
1101.ace-monokai .ace_comment {
1102  color: #75715E
1103}
1104
1105.ace-monokai .ace_indent-guide {
1106  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y
1107}
1108
1109.ace-monokai .ace_indent-guide-active {
1110  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
1111}
1112`});ace.define("ace/theme/monokai",["require","exports","module","ace/theme/monokai-css","ace/lib/dom"],function(t,e,r){e.isDark=!0,e.cssClass="ace-monokai",e.cssText=t("./monokai-css");var s=t("../lib/dom");s.importCssString(e.cssText,e.cssClass,!1)});(function(){ace.require(["ace/theme/monokai"],function(t){typeof rs=="object"&&typeof np=="object"&&rs&&(rs.exports=t)})})()});var op=Ye((ip,is)=>{ace.define("ace/theme/cloud_editor-css",["require","exports","module"],function(t,e,r){r.exports=`
1113.ace-cloud_editor .ace_gutter {
1114    background: #ffffff;
1115    color: #3a3a42;
1116}
1117
1118.ace-cloud_editor .ace_tooltip-marker-error.ace_tooltip-marker {
1119    background-color: #d13212;
1120}
1121.ace-cloud_editor .ace_tooltip-marker-security.ace_tooltip-marker {
1122    background-color: #d13212;
1123}
1124.ace-cloud_editor .ace_tooltip-marker-warning.ace_tooltip-marker {
1125    background-color: #906806;
1126}
1127
1128.ace-cloud_editor .ace_print-margin {
1129    width: 1px;
1130    background: #697077;
1131}
1132
1133.ace-cloud_editor {
1134    background-color: #ffffff;
1135    color: #3a3a42;
1136}
1137
1138.ace-cloud_editor .ace_cursor {
1139    color: #3a3a42;
1140}
1141
1142.ace-cloud_editor .ace_marker-layer .ace_selection {
1143    background: #bfceff;
1144}
1145
1146.ace-cloud_editor.ace_multiselect .ace_selection.ace_start {
1147    box-shadow: 0 0 3px 0px #ffffff;
1148    border-radius: 2px;
1149}
1150
1151.ace-cloud_editor .ace_marker-layer .ace_step {
1152    background: #697077;
1153}
1154
1155.ace-cloud_editor .ace_marker-layer .ace_bracket {
1156    margin: 0 0 0 -1px;
1157    border: 1px solid #697077;
1158}
1159
1160.ace-cloud_editor .ace_marker-layer .ace_active-line {
1161    box-sizing: border-box;
1162    border-top: 1px solid #9191ac;
1163    border-bottom: 1px solid #9191ac;
1164}
1165
1166.ace-cloud_editor .ace_gutter-cell_svg-icons {
1167    box-sizing: border-box;
1168    border-top: 1px solid #ffffff;
1169    border-bottom: 1px solid #ffffff;
1170}
1171
1172.ace-cloud_editor .ace_gutter-active-line {
1173    background-repeat: no-repeat;
1174    box-sizing: border-box;
1175    border-top: 1px solid #9191ac;
1176    border-bottom: 1px solid #9191ac;
1177}
1178
1179.ace-cloud_editor .ace_marker-layer .ace_selected-word {
1180    border: 1px solid #bfceff;
1181}
1182
1183.ace-cloud_editor .ace_fold {
1184    background-color: #0E45B4;
1185    border-color: #3a3a42;
1186}
1187
1188.ace-cloud_editor .ace_keyword {
1189    color: #9749d1;
1190}
1191
1192.ace-cloud_editor .ace_meta.ace_tag {
1193    color: #0E45B4;
1194}
1195
1196.ace-cloud_editor .ace_constant {
1197    color: #A16101;
1198}
1199
1200.ace-cloud_editor .ace_constant.ace_numeric {
1201    color: #A16101;
1202}
1203
1204.ace-cloud_editor .ace_constant.ace_character.ace_escape {
1205    color: #BD1880;
1206}
1207
1208.ace-cloud_editor .ace_support.ace_function {
1209    color: #A81700;
1210}
1211
1212.ace-cloud_editor .ace_support.ace_class {
1213    color: #A16101;
1214}
1215
1216.ace-cloud_editor .ace_storage {
1217    color: #9749d1;
1218}
1219
1220.ace-cloud_editor .ace_invalid.ace_illegal {
1221    color: #ffffff;
1222    background-color: #0E45B4;
1223}
1224
1225.ace-cloud_editor .ace_invalid.ace_deprecated {
1226    color: #ffffff;
1227    background-color: #A16101;
1228}
1229
1230.ace-cloud_editor .ace_string {
1231    color: #207A7F;
1232}
1233
1234.ace-cloud_editor .ace_string.ace_regexp {
1235    color: #207A7F;
1236}
1237
1238.ace-cloud_editor .ace_comment,
1239.ace-cloud_editor .ace_ghost_text {
1240    color: #697077;
1241    opacity: 1;
1242}
1243
1244.ace-cloud_editor .ace_variable {
1245    color: #0E45B4;
1246}
1247
1248.ace-cloud_editor .ace_meta.ace_selector {
1249    color: #9749d1;
1250}
1251
1252.ace-cloud_editor .ace_entity.ace_other.ace_attribute-name {
1253    color: #A16101;
1254}
1255
1256.ace-cloud_editor .ace_entity.ace_name.ace_function {
1257    color: #A81700;
1258}
1259
1260.ace-cloud_editor .ace_entity.ace_name.ace_tag {
1261    color: #0E45B4;
1262}
1263
1264.ace-cloud_editor .ace_heading {
1265    color: #A81700;
1266}
1267
1268.ace-cloud_editor .ace_xml-pe {
1269    color: #A16101;
1270}
1271.ace-cloud_editor .ace_doctype {
1272    color: #0E45B4;
1273}
1274
1275.ace-cloud_editor .ace_tooltip {
1276    background-color: #ffffff;
1277    color: #3a3a42;
1278}
1279
1280.ace-cloud_editor .ace_icon_svg.ace_error,
1281.ace-cloud_editor .ace_icon_svg.ace_error_fold {
1282    background-color: #d13212;
1283}
1284.ace-cloud_editor .ace_icon_svg.ace_security,
1285.ace-cloud_editor .ace_icon_svg.ace_security_fold {
1286    background-color: #d13212;
1287}
1288.ace-cloud_editor .ace_icon_svg.ace_warning,
1289.ace-cloud_editor .ace_icon_svg.ace_warning_fold {
1290    background-color: #906806;
1291}
1292.ace-cloud_editor .ace_icon_svg.ace_info {
1293    background-color: #0073bb;
1294}
1295.ace-cloud_editor .ace_icon_svg.ace_hint {
1296    background-color: #0073bb;
1297}
1298.ace-cloud_editor .ace_highlight-marker {
1299    background: none;
1300    border: #0E45B4 1px solid;
1301}
1302.ace-cloud_editor .ace_tooltip.ace_hover-tooltip:focus > div {
1303    outline: 1px solid #0073bb;
1304}
1305.ace-cloud_editor .ace_snippet-marker {
1306    background-color: #CED6E0;
1307    border: 0;
1308}
1309
1310.ace-cloud_editor.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
1311    background-color: #f2f3f3;
1312    border: #0F68AE 1.5px solid;
1313}
1314.ace-cloud_editor.ace_editor.ace_autocomplete .ace_line-hover {
1315    border: 1px solid #16191f;
1316    background: #f2f3f3;
1317}
1318.ace-cloud_editor.ace_editor.ace_autocomplete .ace_completion-meta {
1319    color: #545b64;
1320    opacity: 1;
1321}
1322.ace-cloud_editor.ace_editor.ace_autocomplete .ace_completion-highlight{
1323    color: #0F68AE;
1324}
1325.ace-cloud_editor.ace_editor.ace_autocomplete {
1326    box-shadow: 0 1px 1px 0 #001c244d, 1px 1px 1px 0 #001c2426, -1px 1px 1px 0 #001c2426;
1327    line-height: 1.5;
1328    border: 1px solid #eaeded;
1329    background: #ffffff;
1330    color: #16191f;
1331}
1332
1333`});ace.define("ace/theme/cloud_editor",["require","exports","module","ace/theme/cloud_editor-css","ace/lib/dom"],function(t,e,r){e.isDark=!1,e.cssClass="ace-cloud_editor",e.cssText=t("./cloud_editor-css");var s=t("../lib/dom");s.importCssString(e.cssText,e.cssClass,!1)});(function(){ace.require(["ace/theme/cloud_editor"],function(t){typeof is=="object"&&typeof ip=="object"&&is&&(is.exports=t)})})()});var ap=Ye((sp,os)=>{ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],function(t,e,r){"use strict";var s=t("../range").Range;function c(d,n){for(var o=n.column||d.getOption("printMarginColumn"),a=n.allowMerge!=!1,l=Math.min(n.startRow,n.endRow),u=Math.max(n.startRow,n.endRow),h=d.session;l<=u;){var p=h.getLine(l);if(p.length>o){var g=k(p,o,5);if(g){var m=/^\s*/.exec(p)[0];h.replace(new s(l,g.start,l,g.end),`
1334`+m)}u++}else if(a&&/\S/.test(p)&&l!=u){var y=h.getLine(l+1);if(y&&/\S/.test(y)){var b=p.replace(/\s+$/,""),C=y.replace(/^\s+/,""),E=b+" "+C,g=k(E,o,5);if(g&&g.start>b.length||E.length<o){var w=new s(l,b.length,l+1,y.length-C.length);h.replace(w," "),l--,u--}else b.length<p.length&&h.remove(new s(l,b.length,l,p.length))}}l++}function k(I,L,F){if(!(I.length<L)){var R=I.slice(0,L),M=I.slice(L),A=/^(?:(\s+)|(\S+)(\s+))/.exec(M),_=/(?:(\s+)|(\s+)(\S+))$/.exec(R),O=0,D=0;if(_&&!_[2]&&(O=L-_[1].length,D=L),A&&!A[2]&&(O||(O=L),D=L+A[1].length),O)return{start:O,end:D};if(_&&_[2]&&_.index>F)return{start:_.index,end:_.index+_[2].length};if(A&&A[2])return O=L+A[2].length,{start:O,end:O+A[3].length}}}}function f(d){if(d.command.name=="insertstring"&&/\S/.test(d.args)){var n=d.editor,o=n.selection.cursor;if(o.column<=n.renderer.$printMarginColumn)return;var a=n.session.$undoManager.$lastDelta;c(n,{startRow:o.row,endRow:o.row,allowMerge:!1}),a!=n.session.$undoManager.$lastDelta&&n.session.markUndoGroup()}}var i=t("../editor").Editor;t("../config").defineOptions(i.prototype,"editor",{hardWrap:{set:function(d){d?this.commands.on("afterExec",f):this.commands.off("afterExec",f)},value:!1}}),e.hardWrap=c});ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"],function(t,e,r){"use strict";function s(){var v="";function S(N){return typeof N!="object"?N+"":"line"in N?N.line+":"+N.ch:"anchor"in N?S(N.anchor)+"->"+S(N.head):Array.isArray(N)?"["+N.map(function(U){return S(U)})+"]":JSON.stringify(N)}for(var x=0;x<arguments.length;x++){var T=arguments[x],$=S(T);v+=$+"  "}console.log(v)}var c=t("../range").Range,f=t("../lib/event_emitter").EventEmitter,i=t("../lib/dom"),d=t("../lib/oop"),n=t("../lib/keys"),o=t("../lib/event"),a=t("../search").Search,l=t("../lib/useragent"),u=t("../search_highlight").SearchHighlight,h=t("../commands/multi_select_commands"),p=t("../mode/text").Mode.prototype.tokenRe,g=t("../ext/hardwrap").hardWrap;t("../multi_select");var m=function(v){this.ace=v,this.state={},this.marks={},this.options={},this.$uid=0,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this),this.onBeforeEndOperation=this.onBeforeEndOperation.bind(this),this.ace.on("change",this.onChange),this.ace.on("changeSelection",this.onSelectionChange),this.ace.on("beforeEndOperation",this.onBeforeEndOperation)};m.Pos=function(v,S){if(!(this instanceof E))return new E(v,S);this.line=v,this.ch=S},m.defineOption=function(v,S,x){},m.commands={redo:function(v){v.ace.redo()},undo:function(v){v.ace.undo()},newlineAndIndent:function(v){v.ace.insert(`
1335`)},goLineLeft:function(v){v.ace.selection.moveCursorLineStart()},goLineRight:function(v){v.ace.selection.moveCursorLineEnd()}}
1335,m.keyMap={},m.addClass=m.rmClass=function(){},m.e_stop=m.e_preventDefault=o.stopEvent,m.keyName=function(v){var S=n[v.keyCode]||v.key||"";return S.length==1&&(S=S.toUpperCase()),S=o.getModifierString(v).replace(/(^|-)\w/g,function(x){return x.toUpperCase()})+S,S},m.keyMap.default=function(v){return function(S){var x=S.ace.commands.commandKeyBinding[v.toLowerCase()];return x&&S.ace.execCommand(x)!==!1}},m.lookupKey=function v(S,x,T){x||(x="default"),typeof x=="string"&&(x=m.keyMap[x]||m.keyMap.default);var $=typeof x=="function"?x(S):x[S];if($===!1)return"nothing";if($==="...")return"multi";if($!=null&&T($))return"handled";if(x.fallthrough){if(!Array.isArray(x.fallthrough))return v(S,x.fallthrough,T);for(var N=0;N<x.fallthrough.length;N++){var U=v(S,x.fallthrough[N],T);if(U)return U}}},m.findMatchingTag=function(v,S){return v.findMatchingTag(S)},m.findEnclosingTag=function(v,S){},m.signal=function(v,S,x){return v._signal(S,x)},m.on=o.addListener,m.off=o.removeListener,m.isWordChar=function(v){return v<"\x7F"?/^\w$/.test(v):(p.lastIndex=0,p.test(v))},function(){d.implement(m.prototype,f),this.destroy=function(){this.ace.off("change",this.onChange),this.ace.off("changeSelection",this.onSelectionChange),this.ace.off("beforeEndOperation",this.onBeforeEndOperation),this.removeOverlay()},this.virtualSelectionMode=function(){return this.ace.inVirtualSelectionMode&&this.ace.selection.index},this.onChange=function(x){this.$lineHandleChanges&&this.$lineHandleChanges.push(x);var T={text:x.action[0]=="i"?x.lines:[]},$=this.curOp=this.curOp||{};$.changeHandlers||($.changeHandlers=this._eventRegistry.change&&this._eventRegistry.change.slice()),$.lastChange?$.lastChange.next=$.lastChange=T:$.lastChange=$.change=T,this.$updateMarkers(x)},this.onSelectionChange=function(){var x=this.curOp=this.curOp||{};x.cursorActivityHandlers||(x.cursorActivityHandlers=this._eventRegistry.cursorActivity&&this._eventRegistry.cursorActivity.slice()),this.curOp.cursorActivity=!0,this.ace.inMultiSelectMode&&this.ace.keyBinding.removeKeyboardHandler(h.keyboardHandler)},this.operation=function(x,T){if(!T&&this.curOp||T&&this.curOp&&this.curOp.force)return x();if((T||!this.ace.curOp)&&this.curOp&&this.onBeforeEndOperation(),!this.ace.curOp){var $=this.ace.prevOp;this.ace.startOperation({command:{name:"vim",scrollIntoView:"cursor"}})}var N=this.curOp=this.curOp||{};this.curOp.force=T;var U=x();return this.ace.curOp&&this.ace.curOp.command.name=="vim"&&(this.state.dialog&&(this.ace.curOp.command.scrollIntoView=this.ace.curOp.vimDialogScroll),this.ace.endOperation(),!N.cursorActivity&&!N.lastChange&&$&&(this.ace.prevOp=$)),(T||!this.ace.curOp)&&this.curOp&&this.onBeforeEndOperation(),U},this.onBeforeEndOperation=function(){var x=this.curOp;x&&(x.change&&this.signal("change",x.change,x),x&&x.cursorActivity&&this.signal("cursorActivity",null,x),this.curOp=null)},this.signal=function(x,T,$){var N=$?$[x+"Handlers"]:(this._eventRegistry||{})[x];if(N){N=N.slice();for(var U=0;U<N.length;U++)N[U](this,T)}},this.firstLine=function(){return 0},this.lastLine=function(){return this.ace.session.getLength()-1},this.lineCount=function(){return this.ace.session.getLength()},this.setCursor=function(x,T){typeof x=="object"&&(T=x.ch,x=x.line);var $=!this.curOp&&!this.ace.inVirtualSelectionMode;this.ace.inVirtualSelectionMode||this.ace.exitMultiSelectMode(),this.ace.session.unfold({row:x,column:T}),this.ace.selection.moveTo(x,T),$&&(this.ace.renderer.scrollCursorIntoView(),this.ace.endOperation())},this.getCursor=function(x){var T=this.ace.selection,$=x=="anchor"?T.isEmpty()?T.lead:T.anchor:x=="head"||!x?T.lead:T.getRange()[x];return b($)},this.listSelections=function(x){var T=this.ace.multiSelect.rangeList.ranges;return!T.length||this.ace.inVirtualSelectionMode?[{anchor:this.getCursor("anchor"),head:this.getCursor("head")}]:T.map(function($){return{anchor:this.clipPos(b($.cursor==$.end?$.start:$.end)),head:this.clipPos(b($.cursor))}},this)},this.setSelections=function(x,T){var $=this.ace.multiSelect,N=x.map(function(V){var Y=y(V.anchor),J=y(V.head),ne=c.comparePoints(Y,J)<0?new c.fromPoints(Y,J):new c.fromPoints(J,Y);return ne.cursor=c.comparePoints(ne.start,J)?ne.end:ne.start,ne});if(this.ace.inVirtualSelectionMode){this.ace.selection.fromOrientedRange(N[0]);return}T?N[T]&&N.push(N.splice(T,1)[0]):N=N.reverse(),$.toSingleRange(N[0].clone());for(var U=this.ace.session,z=0;z<N.length;z++){var j=U.$clipRangeToDocument(N[z]);$.addRange(j)}},this.setSelection=function(x,T,$){var N=this.ace.selection;N.moveTo(x.line,x.ch),N.selectTo(T.line,T.ch),$&&$.origin=="*mouse"&&this.onBeforeEndOperation()},this.somethingSelected=function(x){return!this.ace.selection.isEmpty()},this.clipPos=function(x){var T=this.ace.session.$clipPositionToDocument(x.line,x.ch);return b(T)},this.foldCode=function(x){this.ace.session.$toggleFoldWidget(x.line,{})},this.markText=function(x){return{clear:function(){},find:function(){}}},this.$updateMarkers=function(x){var T=x.action=="insert",$=x.start,N=x.end,U=(N.row-$.row)*(T?1:-1),z=(N.column-$.column)*(T?1:-1);T&&(N=$);for(var j in this.marks){var V=this.marks[j],Y=c.comparePoints(V,$);if(!(Y<0)){if(Y===0&&T)if(!V.$insertRight)Y=1;else if(V.bias==1)Y=1;else{V.bias=-1;continue}var J=T?Y:c.comparePoints(V,N);if(J>0){V.row+=U,V.column+=V.row==N.row?z:0;continue}!T&&J<=0&&(V.row=$.row,V.column=$.column,J===0&&(V.bias=1))}}};var v=function(x,T,$,N){this.cm=x,this.id=T,this.row=$,this.column=N,x.marks[this.id]=this};v.prototype.clear=function(){delete this.cm.marks[this.id]},v.prototype.find=function(){return b(this)},this.setBookmark=function(x,T){var $=new v(this,this.$uid++,x.line,x.ch);return(!T||!T.insertLeft)&&($.$insertRight=!0),this.marks[$.id]=$,$},this.moveH=function(x,T){if(T=="char"){var $=this.ace.selection;$.clearSelection(),$.moveCursorBy(0,x)}},this.findPosV=function(x,T,$,N){if($=="page"){var U=this.ace.renderer,z=U.layerConfig;T=T*Math.floor(z.height/z.lineHeight),$="line"}if($=="line"){var j=this.ace.session.documentToScreenPosition(x.line,x.ch);N!=null&&(j.column=N),j.row+=T,j.row=Math.min(Math.max(0,j.row),this.ace.session.getScreenLength()-1);var V=this.ace.session.screenToDocumentPosition(j.row,j.column);return b(V)}else debugger},this.charCoords=function(x,T){if(T=="div"||!T){var $=this.ace.session.documentToScreenPosition(x.line,x.ch);return{left:$.column,top:$.row}}if(T=="local"){var N=this.ace.renderer,$=this.ace.session.documentToScreenPosition(x.line,x.ch),U=N.layerConfig.lineHeight,z=N.layerConfig.characterWidth,j=U*$.row;return{left:$.column*z,top:j,bottom:j+U}}},this.coordsChar=function(x,T){var $=this.ace.renderer;if(T=="local"){var N=Math.max(0,Math.floor(x.top/$.lineHeight)),U=Math.max(0,Math.floor(x.left/$.characterWidth)),z=$.session.screenToDocumentPosition(N,U);return b(z)}else if(T=="div")throw"not implemented"}
1335,this.getSearchCursor=function(x,T,$){var N=!1,U=!1;x instanceof RegExp&&!x.global&&(N=!x.ignoreCase,x=x.source,U=!0),x=="\\n"&&(x=`
1336`,U=!1);var z=new a;T.ch==null&&(T.ch=Number.MAX_VALUE);var j={row:T.line,column:T.ch},V=this,Y=null;return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(J){z.setOptions({needle:x,caseSensitive:N,wrap:!1,backwards:J,regExp:U,start:Y||j});var ne=z.find(V.ace.session);return Y=ne,Y&&[!Y.isEmpty()]},from:function(){return Y&&b(Y.start)},to:function(){return Y&&b(Y.end)},replace:function(J){Y&&(Y.end=V.ace.session.doc.replace(Y,J))}}},this.scrollTo=function(x,T){var $=this.ace.renderer,N=$.layerConfig,U=N.maxHeight;U-=($.$size.scrollerHeight-$.lineHeight)*$.$scrollPastEnd,T!=null&&this.ace.session.setScrollTop(Math.max(0,Math.min(T,U))),x!=null&&this.ace.session.setScrollLeft(Math.max(0,Math.min(x,N.width)))},this.scrollInfo=function(){return 0},this.scrollIntoView=function(x,T){if(x){var $=this.ace.renderer,N={top:0,bottom:T};$.scrollCursorIntoView(y(x),$.lineHeight*2/$.$size.scrollerHeight,N)}},this.getLine=function(x){return this.ace.session.getLine(x)},this.getRange=function(x,T){return this.ace.session.getTextRange(new c(x.line,x.ch,T.line,T.ch))},this.replaceRange=function(x,T,$){$||($=T);var N=new c(T.line,T.ch,$.line,$.ch);return this.ace.session.$clipRangeToDocument(N),this.ace.session.replace(N,x)},this.replaceSelection=this.replaceSelections=function(x){var T=Array.isArray(x)&&x,$=this.ace.selection;if(this.ace.inVirtualSelectionMode){this.ace.session.replace($.getRange(),T?x[0]||"":x);return}$.inVirtualSelectionMode=!0;var N=$.rangeList.ranges;N.length||(N=[this.ace.multiSelect.getRange()]);for(var U=N.length;U--;)this.ace.session.replace(N[U],T?x[U]||"":x);$.inVirtualSelectionMode=!1},this.getSelection=function(){return this.ace.getSelectedText()},this.getSelections=function(){return this.listSelections().map(function(x){return this.getRange(x.anchor,x.head)},this)},this.getInputField=function(){return this.ace.textInput.getElement()},this.getWrapperElement=function(){return this.ace.container};var S={indentWithTabs:"useSoftTabs",indentUnit:"tabSize",tabSize:"tabSize",firstLineNumber:"firstLineNumber",readOnly:"readOnly"};this.setOption=function(x,T){switch(this.state[x]=T,x){case"indentWithTabs":x=S[x],T=!T;break;case"keyMap":this.state.$keyMap=T;return;default:x=S[x]}x&&this.ace.setOption(x,T)},this.getOption=function(x){var T,$=S[x];switch($&&(T=this.ace.getOption($)),x){case"indentWithTabs":return x=S[x],!T;case"keyMap":return this.state.$keyMap||"vim"}return $?T:this.state[x]},this.toggleOverwrite=function(x){return this.state.overwrite=x,this.ace.setOverwrite(x)},this.addOverlay=function(x){if(!this.$searchHighlight||!this.$searchHighlight.session){var T=new u(null,"ace_highlight-marker","text"),$=this.ace.session.addDynamicMarker(T);T.id=$.id,T.session=this.ace.session,T.destroy=function(U){T.session.off("change",T.updateOnChange),T.session.off("changeEditor",T.destroy),T.session.removeMarker(T.id),T.session=null},T.updateOnChange=function(U){var z=U.start.row;z==U.end.row?T.cache[z]=void 0:T.cache.splice(z,T.cache.length)},T.session.on("changeEditor",T.destroy),T.session.on("change",T.updateOnChange)}var N=new RegExp(x.query.source,"gmi");this.$searchHighlight=x.highlight=T,this.$searchHighlight.setRegexp(N),this.ace.renderer.updateBackMarkers()},this.removeOverlay=function(x){this.$searchHighlight&&this.$searchHighlight.session&&this.$searchHighlight.destroy()}
1336,this.getScrollInfo=function(){var x=this.ace.renderer,T=x.layerConfig;return{left:x.scrollLeft,top:x.scrollTop,height:T.maxHeight,width:T.width,clientHeight:T.height,clientWidth:T.width}},this.getValue=function(){return this.ace.getValue()},this.setValue=function(x){return this.ace.setValue(x,-1)},this.getTokenTypeAt=function(x){var T=this.ace.session.getTokenAt(x.line,x.ch);return T&&/comment|string/.test(T.type)?"string":""},this.findMatchingBracket=function(x){var T=this.ace.session.findMatchingBracket(y(x));return{to:T&&b(T)}},this.findMatchingTag=function(x){var T=this.ace.session.getMatchingTags(y(x));if(T)return{open:{from:b(T.openTag.start),to:b(T.openTag.end)},close:{from:b(T.closeTag.start),to:b(T.closeTag.end)}}},this.indentLine=function(x,T){T===!0?this.ace.session.indentRows(x,x,"	"):T===!1&&this.ace.session.outdentRows(new c(x,0,x,0))},this.indexFromPos=function(x){return this.ace.session.doc.positionToIndex(y(x))},this.posFromIndex=function(x){return b(this.ace.session.doc.indexToPosition(x))},this.focus=function(x){return this.ace.textInput.focus()},this.blur=function(x){return this.ace.blur()},this.defaultTextHeight=function(x){return this.ace.renderer.layerConfig.lineHeight},this.scanForBracket=function(x,T,$,N){var U=N.bracketRegex.source,z=/paren|text|operator|tag/;if(T==1)var j=this.ace.session.$findClosingBracket(U.slice(1,2),y(x),z);else{var j=this.ace.session.$findOpeningBracket(U.slice(-2,-1),{row:x.line,column:x.ch+1},z);!j&&N.bracketRegex&&N.bracketRegex.test(this.getLine(x.line)[x.ch-1])&&(j={row:x.line,column:x.ch-1})}return j&&{pos:b(j)}},this.refresh=function(){return this.ace.resize(!0)},this.getMode=function(){return{name:this.getOption("mode")}},this.execCommand=function(x){if(m.commands.hasOwnProperty(x))return m.commands[x](this);if(x=="indentAuto")return this.ace.execCommand("autoindent");console.log(x+" is not implemented")},this.getLineNumber=function(x){var T=this.$lineHandleChanges;if(!T)return null;for(var $=x.row,N=0;N<T.length;N++){var U=T[N];if(U.start.row!=U.end.row){if(U.action[0]=="i")U.start.row<$&&($+=U.end.row-U.start.row);else if(U.start.row<$){if($<U.end.row||$==U.end.row&&U.start.column>0)return null;$-=U.end.row-U.start.row}}}return $},this.getLineHandle=function(x){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{text:this.ace.session.getLine(x),row:x}},this.releaseLineHandles=function(){this.$lineHandleChanges=void 0},this.getLastEditEnd=function(){var x=this.ace.session.$undoManager;if(x&&x.$lastDelta)return b(x.$lastDelta.end)}}.call(m.prototype);function y(v){return{row:v.line,column:v.ch}}function b(v){return new E(v.row,v.column)}var C=m.StringStream=function(v,S){this.pos=this.start=0,this.string=v,this.tabSize=S||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};C.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(v){var S=this.string.charAt(this.pos);if(typeof v=="string")var x=S==v;else var x=S&&(v.test?v.test(S):v(S));if(x)return++this.pos,S},eatWhile:function(v){for(var S=this.pos;this.eat(v););return this.pos>S},eatSpace:function(){for(var v=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>v},skipToEnd:function(){this.pos=this.string.length},skipTo:function(v){var S=this.string.indexOf(v,this.pos);if(S>-1)return this.pos=S,!0},backUp:function(v){this.pos-=v},column:function(){throw"not implemented"},indentation:function(){throw"not implemented"},match:function(v,S,x){if(typeof v=="string"){var T=function(U){return x?U.toLowerCase():U},$=this.string.substr(this.pos,v.length);if(T($)==T(v))return S!==!1&&(this.pos+=v.length),!0}else{var N=this.string.slice(this.pos).match(v);return N&&N.index>0?null:(N&&S!==!1&&(this.pos+=N[0].length),N)}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(v,S){this.lineStart+=v;try{return S()}finally{this.lineStart-=v}}},m.defineExtension=function(v,S){m.prototype[v]=S},i.importCssString(`.normal-mode .ace_cursor{
1337    border: none;
1338    background-color: rgba(255,0,0,0.5);
1339}
1340.normal-mode .ace_hidden-cursors .ace_cursor{
1341  background-color: transparent;
1342  border: 1px solid red;
1343  opacity: 0.7
1344}
1345.ace_dialog {
1346  position: absolute;
1347  left: 0; right: 0;
1348  background: inherit;
1349  z-index: 15;
1350  padding: .1em .8em;
1351  overflow: hidden;
1352  color: inherit;
1353}
1354.ace_dialog-top {
1355  border-bottom: 1px solid #444;
1356  top: 0;
1357}
1358.ace_dialog-bottom {
1359  border-top: 1px solid #444;
1360  bottom: 0;
1361}
1362.ace_dialog input {
1363  border: none;
1364  outline: none;
1365  background: transparent;
1366  width: 20em;
1367  color: inherit;
1368  font-family: monospace;
1369}`,"vimMode",!1),function(){function v(x,T,$){var N=x.ace.container,U;return U=N.appendChild(document.createElement("div")),$?U.className="ace_dialog ace_dialog-bottom":U.className="ace_dialog ace_dialog-top",typeof T=="string"?U.innerHTML=T:U.appendChild(T),U}function S(x,T){x.state.currentNotificationClose&&x.state.currentNotificationClose(),x.state.currentNotificationClose
1369=T}m.defineExtension("openDialog",function(x,T,$){if(this.virtualSelectionMode())return;$||($={}),S(this,null);var N=v(this,x,$.bottom),U=!1,z=this;this.state.dialog=N;function j(J){if(typeof J=="string")V.value=J;else{if(U||J&&J.type=="blur"&&document.activeElement===V)return;z.state.dialog==N&&(z.state.dialog=null,z.focus()),U=!0,N.remove(),$.onClose&&$.onClose(N);var ne=z;ne.state.vim&&(ne.state.vim.status=null,ne.ace._signal("changeStatus"),ne.ace.renderer.$loop.schedule(ne.ace.renderer.CHANGE_CURSOR))}}var V=N.getElementsByTagName("input")[0],Y;return V?($.value&&(V.value=$.value,$.selectValueOnOpen!==!1&&V.select()),$.onInput&&m.on(V,"input",function(J){$.onInput(J,V.value,j)}),$.onKeyUp&&m.on(V,"keyup",function(J){$.onKeyUp(J,V.value,j)}),m.on(V,"keydown",function(J){$&&$.onKeyDown&&$.onKeyDown(J,V.value,j)||(J.keyCode==13&&T(V.value),(J.keyCode==27||$.closeOnEnter!==!1&&J.keyCode==13)&&(m.e_stop(J),j()))}),$.closeOnBlur!==!1&&m.on(V,"blur",j),V.focus()):(Y=N.getElementsByTagName("button")[0])&&(m.on(Y,"click",function(){j(),z.focus()}),$.closeOnBlur!==!1&&m.on(Y,"blur",j),Y.focus()),j}),m.defineExtension("openNotification",function(x,T){if(this.virtualSelectionMode())return;S(this,j);var $=v(this,x,T&&T.bottom),N=!1,U,z=T&&typeof T.duration<"u"?T.duration:5e3;function j(){N||(N=!0,clearTimeout(U),$.remove())}return m.on($,"click",function(V){m.e_preventDefault(V),j()}),z&&(U=setTimeout(j,z)),j})}();var E=m.Pos;function w(v,S,x){if(S.line===x.line&&S.ch>=x.ch-1){var T=v.getLine(S.line),$=T.charCodeAt(S.ch);55296<=$&&$<=55551&&(x.ch+=1)}return{start:S,end:x}}var k=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0}
vendor: 7,867 bytes, line 1369
1369,operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],I=k.length,L=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],F=rt("");function R(v){v.setOption("disableInput",!0),v.setOption("showCursorWhenSelecting",!1),m.signal(v,"vim-mode-change",{mode:"normal"}),v.on("cursorActivity",pc),Ae(v),m.on(v.getInputField(),"paste",A(v))}function M(v){v.setOption("disableInput",!1),v.off("cursorActivity",pc),m.off(v.getInputField(),"paste",A(v)),v.state.vim=null,zr&&clearTimeout(zr)}function A(v){var S=v.state.vim;return S.onPasteFn||(S.onPasteFn=function(){S.insertMode||(v.setCursor(mt(v.getCursor(),0,1)),rn.enterInsertMode(v,{},S))}),S.onPasteFn}
1369var _=/[\d]/,O=[m.isWordChar,function(v){return v&&!m.isWordChar(v)&&!/\s/.test(v)}],D=[function(v){return/\S/.test(v)}],B=["<",">"],P=["-",'"',".",":","_","/","+"],H=/^\w$/,W;try{W=new RegExp("^[\\p{Lu}]$","u")}catch{W=/^[A-Z]$/}function K(v,S){return S>=v.firstLine()&&S<=v.lastLine()}function G(v){return/^[a-z]$/.test(v)}function X(v){return"()[]{}".indexOf(v)!=-1}function Z(v){return _.test(v)}function q(v){return W.test(v)}function Q(v){return/^\s*$/.test(v)}function ie(v){return".?!".indexOf(v)!=-1}function ae(v,S){for(var x=0;x<S.length;x++)if(S[x]==v)return!0;return!1}var oe={};function fe(v,S,x,T,$){if(S===void 0&&!$)throw Error("defaultValue is required unless callback is provided");if(x||(x="string"),oe[v]={type:x,defaultValue:S,callback:$},T)for(var N=0;N<T.length;N++)oe[T[N]]=oe[v];S&&he(v,S)}function he(v,S,x,T){var $=oe[v];T=T||{};var N=T.scope;if(!$)return new Error("Unknown option: "+v);if($.type=="boolean"){if(S&&S!==!0)return new Error("Invalid argument: "+v+"="+S);S!==!1&&(S=!0)}$.callback?(N!=="local"&&$.callback(S,void 0),N!=="global"&&x&&$.callback(S,x)):(N!=="local"&&($.value=$.type=="boolean"?!!S:S),N!=="global"&&x&&(x.state.vim.options[v]={value:S}))}function xe(v,S,x){var T=oe[v];x=x||{};var $=x.scope;if(!T)return new Error("Unknown option: "+v);if(T.callback){var N=S&&T.callback(void 0,S);return $!=="global"&&N!==void 0?N:$!=="local"?T.callback():void 0}else{var N=$!=="global"&&S&&S.state.vim.options[v];return(N||$!=="local"&&T||{}).value}}fe("filetype",void 0,"string",["ft"],function(v,S){if(S!==void 0)if(v===void 0){var x=S.getOption("mode");return x=="null"?"":x}else{var x=v==""?"null":v;S.setOption("mode",x)}}),fe("textwidth",80,"number",["tw"],function(v,S){if(S!==void 0)if(v===void 0){var x=S.getOption("textwidth");return x}else{var T=Math.round(v);T>1&&S.setOption("textwidth",T)}});var ke=function(){var v=100,S=-1,x=0,T=0,$=new Array(v);function N(j,V,Y){var J=S%v,ne=$[J];function ee(ge){var le=++S%v,me=$[le];me&&me.clear(),$[le]=j.setBookmark(ge)}if(ne){var te=ne.find();te&&!on(te,V)&&ee(V)}else ee(V);ee(Y),x=S,T=S-v+1,T<0&&(T=0)}function U(j,V){S+=V,S>x?S=x:S<T&&(S=T);var Y=$[(v+S)%v];if(Y&&!Y.find()){var J=V>0?1:-1,ne,ee=j.getCursor();do if(S+=J,Y=$[(v+S)%v],Y&&(ne=Y.find())&&!on(ee,ne))break;while(S<x&&S>T)}return Y}function z(j,V){var Y=S,J=U(j,V);return S=Y,J&&J.find()}return{cachedCursor:void 0,add:N,find:z,move:U}},Re=function(v){return v?{changes:v.changes,expectCursorActivityForChange:v.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function Ce(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=Re()}Ce.prototype={exitMacroRecordMode:function(){var v=ue.macroModeState;v.onRecordingDone&&v.onRecordingDone(),v.onRecordingDone=void 0,v.isRecording=!1},enterMacroRecordMode:function(v,S){var x=ue.registerController.getRegister(S);if(x){if(x.clear(),this.latestRegister=S,v.openDialog){var T=zn("span",{class:"cm-vim-message"},"recording @"+S);this.onRecordingDone=v.openDialog(T,null,{bottom:!0})}this.isRecording=!0}}};function Ae(v){return v.state.vim||(v.state.vim={inputState:new Ze,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{},expectLiteralNext:!1}),v.state.vim}var ue;
1369function ut(){ue={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ke(),macroModeState:new Ce,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new ce({}),searchHistoryController:new pe,exCommandHistoryController:new pe};for(var v in oe){var S=oe[v];S.value=S.defaultValue}}var Je,Me={enterVimMode:R,leaveVimMode:M,buildKeyMap:function(){},getRegisterController:function(){return ue.registerController},resetVimGlobalState_:ut,getVimGlobalState_:function(){return ue},maybeInitVimState_:Ae,suppressErrorLogging:!1,InsertModeKey:_s,map:function(v,S,x){gn.map(v,S,x)},unmap:function(v,S){return gn.unmap(v,S)},noremap:function(v,S,x){gn.map(v,S,x,!0)},mapclear:function(v){var S=k.length,x=I,T=k.slice(0,S-x);if(k=k.slice(S-x),v)for(var $=T.length-1;$>=0;$--){var N=T[$];if(v!==N.context)if(N.context)this._mapCommand(N);else{var U=["normal","insert","visual"];for(var z in U)if(U[z]!==v){var j={};for(var V in N)j[V]=N[V];j.context=U[z],this._mapCommand(j)}}}},langmap:Qe,vimKeyFromEvent:De,setOption:he,getOption:xe,defineOption:fe,defineEx:function(v,S,x){if(!S)S=v;else if(v.indexOf(S)!==0)throw new Error('(Vim.defineEx) "'+S+'" is not a prefix of "'+v+'", command not registered');dc[v]=x,gn.commandMap_[S]={name:v,shortName:S,type:"api"}},handleKey:function(v,S,x){var T=this.findKey(v,S,x);if(typeof T=="function")return T()},multiSelectHandleKey:xc,findKey:function(v,S,x){var T=Ae(v);function $(){var V=ue.macroModeState;if(V.isRecording){if(S=="q")return V.exitMacroRecordMode(),$e(v),!0;x!="mapping"&&Fg(V,S)}}function N(){if(S=="<Esc>"){if(T.visualMode)pn(v);else if(T.insertMode)jn(v);else return;return $e(v),!0}}function U(){if(N())return!0;T.inputState.keyBuffer.push(S);var V=T.inputState.keyBuffer.join(""),Y=S.length==1,J=ve.matchCommand(V,k,T.inputState,"insert"),ne=T.inputState.changeQueue;if(J.type=="none")return $e(v),!1;if(J.type=="partial"){if(J.expectLiteralNext&&(T.expectLiteralNext=!0),Je&&window.clearTimeout(Je),Je=Y&&window.setTimeout(function(){T.insertMode&&T.inputState.keyBuffer.length&&$e(v)},xe("insertModeEscKeysTimeout")),Y){var ee=v.listSelections();(!ne||ne.removed.length!=ee.length)&&(ne=T.inputState.changeQueue=new ze),ne.inserted+=S;for(var te=0;te<ee.length;te++){var ge=Vt(ee[te].anchor,ee[te].head),le=Wn(ee[te].anchor,ee[te].head),me=v.getRange(ge,v.state.overwrite?mt(le,0,1):le);ne.removed[te]=(ne.removed[te]||"")+me}}return!Y}if(T.expectLiteralNext=!1,Je&&window.clearTimeout(Je),J.command&&ne){for(var ee=v.listSelections(),te=0;te<ee.length;te++){var Te=ee[te].head;v.replaceRange(ne.removed[te]||"",mt(Te,0,-ne.inserted.length),Te,"+input")}ue.macroModeState.lastInsertModeChanges.changes.pop()}return J.command||$e(v),J.command}function z(){if($()||N())return!0;T.inputState.keyBuffer.push(S);var V=T.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(V))return!0;var Y=/^(\d*)(.*)$/.exec(V);if(!Y)return $e(v),!1;var J=T.visualMode?"visual":"normal",ne=Y[2]||Y[1];T.inputState.operatorShortcut&&T.inputState.operatorShortcut.slice(-1)==ne&&(ne=T.inputState.operatorShortcut);var ee=ve.matchCommand(ne,k,T.inputState,J);return ee.type=="none"?($e(v),!1):ee.type=="partial"?(ee.expectLiteralNext&&(T.expectLiteralNext=!0),!0):ee.type=="clear"?($e(v),!0):(T.expectLiteralNext=!1,T.inputState.keyBuffer.length=0,Y=/^(\d*)(.*)$/.exec(V),Y[1]&&Y[1]!="0"&&T.inputState.pushRepeatDigit(Y[1]),ee.command)}var j;return T.insertMode?j=U():j=z(),j===!1?!T.insertMode&&S.length===1?function(){return!0}:void 0:j===!0?function(){return!0}:function(){if(!((j.operator||j.isEdit)&&v.getOption("readOnly")))return v.operation(function(){v.curOp.isVimOp=!0;try{j.type=="keyToKey"?se(v,j.toKeys,j):ve.processCommand(v,T,j)}catch(V){throw v.state.vim=void 0,Ae(v),Me.suppressErrorLogging||console.log(V),V}return!0})}},handleEx:function(v,S){gn.processCommand(v,S)},defineMotion:Fe,defineAction:Li,defineOperator:Hr,mapCommand:Ng,_mapCommand:hc,defineRegister:de,exitVisualMode:pn,exitInsertMode:jn},Ue=[],Ve=!1,Ne;function Pt(v){if(v[0]=="<"){var S=v.toLowerCase().slice(1,-1),x=S.split("-");if(S=x.pop()||"",S=="lt")v="<";
1369else if(S=="space")v=" ";else if(S=="cr")v=`
1370`;else if(Le[S]){var T=Ne.value,$={key:Le[S],target:{value:T,selectionEnd:T.length,selectionStart:T.length}};Ne.onKeyDown&&Ne.onKeyDown($,Ne.value,U),Ne&&Ne.onKeyUp&&Ne.onKeyUp($,Ne.value,U);return}}if(v==`
1371`){var N=Ne;Ne=null,N.onClose&&N.onClose(N.value)}else Ne.value=(Ne.value||"")+v;function U(z){typeof z=="string"?Ne.value=z:Ne=null}}function se(v,S,x){var T=Ve;if(x){if(Ue.indexOf(x)!=-1)return;Ue.push(x),Ve=x.noremap!=!1}try{for(var $=Ae(v),N=/<(?:[CSMA]-)*\w+>|./gi,U;U=N.exec(S);){var z=U[0],j=$.insertMode;if(Ne){Pt(z);continue}var V=Me.handleKey(v,z,"mapping");if(!V&&j&&$.insertMode){if(z[0]=="<"){var Y=z.toLowerCase().slice(1,-1),J=Y.split("-");if(Y=J.pop()||"",Y=="lt")z="<";else if(Y=="space")z=" ";else if(Y=="cr")z=`
1372`;else if(Le.hasOwnProperty(Y)){z=Le[Y],yc(v,z);continue}else z=z[0],N.lastIndex=U.index+1}v.replaceSelection(z)}}}finally{if(Ue.pop(),Ve=Ue.length?T:!1,!Ue.length&&Ne){var ne=Ne;Ne=null,Ur(v,ne)}}}var ye={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},Ee={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},Le={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(ye)).forEach(function(v){Le[(ye[v]||"").toLowerCase()]=Le[v.toLowerCase()]=v});function De(v,S){var x=v.key;if(!Ee[x]){x.length>1&&x[0]=="n"&&(x=x.replace("Numpad","")),x=ye[x]||x;var T="";if(v.ctrlKey&&(T+="C-"),v.altKey&&(T+="A-"),v.metaKey&&(T+="M-"),m.isMac&&v.altKey&&!v.metaKey&&!v.ctrlKey&&(T=T.slice(2)),(T||x.length>1)&&v.shiftKey&&(T+="S-"),S&&!S.expectLiteralNext&&x.length==1){if(F.keymap&&x in F.keymap)(F.remapCtrl!=!1||!T)&&(x=F.keymap[x]);else if(x.charCodeAt(0)>255){var $=v.code&&v.code.slice(-1)||"";v.shiftKey||($=$.toLowerCase()),$&&(x=$)}}return T+=x,T.length>1&&(T="<"+T+">"),T}}function Qe(v,S){F.string!==v&&(F=rt(v)),F.remapCtrl=S}function rt(v){var S={};if(!v)return{keymap:S,string:""};function x(T){return T.split(/\\?(.)/).filter(Boolean)}return v.split(/((?:[^\\,]|\\.)+),/).map(function(T){if(T){var $=T.split(/((?:[^\\;]|\\.)+);/);if($.length==3){var N=x($[1]),U=x($[2]);if(N.length!==U.length)return;for(var z=0;z<N.length;++z)S[N[z]]=U[z]}else if($.length==1){var j=x(T);if(j.length%2!==0)return;for(var z=0;z<j.length;z+=2)S[j[z]]=j[z+1]}}}),{keymap:S,string:v}}fe("langmap",void 0,"string",["lmap"],function(v,S){if(v===void 0)return F.string;Qe(v)});function Ze(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null,this.changeQueue=null}Ze.prototype.pushRepeatDigit=function(v){this.operator?this.motionRepeat=this.motionRepeat.concat(v):this.prefixRepeat=this.prefixRepeat.concat(v)},Ze.prototype.getRepeat=function(){var v=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(v=1,this.prefixRepeat.length>0&&(v*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(v*=parseInt(this.motionRepeat.join(""),10))),v};function $e(v,S){v.state.vim.inputState=new Ze,v.state.vim.expectLiteralNext=!1,m.signal(v,"vim-command-done",S)}function ze(){this.removed=[],this.inserted=""}function re(v,S,x){this.clear(),this.keyBuffer=[v||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!S,this.blockwise=!!x}re.prototype={setText:function(v,S,x){this.keyBuffer=[v||""],this.linewise=!!S,this.blockwise=!!x},pushText:function(v,S){S&&(this.linewise||this.keyBuffer.push(`
1373`),this.linewise=!0),this.keyBuffer.push(v)},pushInsertModeChanges:function(v){this.insertModeChanges.push(Re(v))},pushSearchQuery:function(v){this.searchQueries.push(v)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function de(v,S){var x=ue.registerController.registers;if(!v||v.length!=1)throw Error("Register name must be 1 character");x[v]=S,P.push(v)}function ce(v){this.registers=v,this.unnamedRegister=v['"']=new re,v["."]=new re,v[":"]=new re,v["/"]=new re,v["+"]=new re}ce.prototype={pushText:function(v,S,x,T,$){if(v!=="_"){T&&x.charAt(x.length-1)!==`
1374`&&(x+=`
1375`);var N=this.isValidRegister(v)?this.getRegister(v):null;
1375if(!N){switch(S){case"yank":this.registers[0]=new re(x,T,$);break;case"delete":case"change":x.indexOf(`
1376`)==-1?this.registers["-"]=new re(x,T):(this.shiftNumericRegisters_(),this.registers[1]=new re(x,T));break}this.unnamedRegister.setText(x,T,$);return}var U=q(v);U?N.pushText(x,T):N.setText(x,T,$),v==="+"&&typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText=="function"&&navigator.clipboard.writeText(x),this.unnamedRegister.setText(N.toString(),T)}},getRegister:function(v){return this.isValidRegister(v)?(v=v.toLowerCase(),this.registers[v]||(this.registers[v]=new re),this.registers[v]):this.unnamedRegister},isValidRegister:function(v){return v&&(ae(v,P)||H.test(v))},shiftNumericRegisters_:function(){for(var v=9;v>=2;v--)this.registers[v]=this.getRegister(""+(v-1))}};function pe(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}pe.prototype={nextMatch:function(v,S){var x=this.historyBuffer,T=S?-1:1;this.initialPrefix===null&&(this.initialPrefix=v);for(var $=this.iterator+T;S?$>=0:$<x.length;$+=T)for(var N=x[$],U=0;U<=N.length;U++)if(this.initialPrefix==N.substring(0,U))return this.iterator=$,N;if($>=x.length)return this.iterator=x.length,this.initialPrefix;if($<0)return v},pushInput:function(v){var S=this.historyBuffer.indexOf(v);S>-1&&this.historyBuffer.splice(S,1),v.length&&this.historyBuffer.push(v)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ve={matchCommand:function(v,S,x,T){var $=ig(v,S,T,x);if(!$.full&&!$.partial)return{type:"none"};if(!$.full&&$.partial)return{type:"partial",expectLiteralNext:$.partial.length==1&&$.partial[0].keys.slice(-11)=="<character>"};for(var N,U=0;U<$.full.length;U++){var z=$.full[U];N||(N=z)}if(N.keys.slice(-11)=="<character>"||N.keys.slice(-10)=="<register>"){var j=sg(v);if(!j||j.length>1)return{type:"clear"};x.selectedCharacter=j}return{type:"full",command:N}},processCommand:function(v,S,x){switch(S.inputState.repeatOverride=x.repeatOverride,x.type){case"motion":this.processMotion(v,S,x);break;case"operator":this.processOperator(v,S,x);break;case"operatorMotion":this.processOperatorMotion(v,S,x);break;case"action":this.processAction(v,S,x);break;case"search":this.processSearch(v,S,x);break;case"ex":case"keyToEx":this.processEx(v,S,x);break;default:break}},processMotion:function(v,S,x){S.inputState.motion=x.motion,S.inputState.motionArgs=Ri(x.motionArgs),this.evalInput(v,S)},processOperator:function(v,S,x){var T=S.inputState;if(T.operator)if(T.operator==x.operator){T.motion="expandToLine",T.motionArgs={linewise:!0},this.evalInput(v,S);return}else $e(v);T.operator=x.operator,T.operatorArgs=Ri(x.operatorArgs),x.keys.length>1&&(T.operatorShortcut=x.keys),x.exitVisualBlock&&(S.visualBlock=!1,xr(v)),S.visualMode&&this.evalInput(v,S)},processOperatorMotion:function(v,S,x){var T=S.visualMode,$=Ri(x.operatorMotionArgs);$&&T&&$.visualLine&&(S.visualLine=!0),this.processOperator(v,S,x),T||this.processMotion(v,S,x)},processAction:function(v,S,x){var T=S.inputState,$=T.getRepeat(),N=!!$,U=Ri(x.actionArgs)||{};T.selectedCharacter&&(U.selectedCharacter=T.selectedCharacter),x.operator&&this.processOperator(v,S,x),x.motion&&this.processMotion(v,S,x),(x.motion||x.operator)&&this.evalInput(v,S),U.repeat=$||1,U.repeatIsExplicit=N,U.registerName=T.registerName,$e(v),S.lastMotion=null,x.isEdit&&this.recordLastEdit(S,T,x),rn[x.action](v,U,S)},processSearch:function(v,S,x){if(!v.getSearchCursor)return;var T=x.searchArgs.forward,$=x.searchArgs.wholeWordOnly;sn(v).setReversed(!T);var N=T?"/":"?",U=sn(v).getQuery(),z=v.getScrollInfo();function j(le,me,Te){ue.searchHistoryController.pushInput(le),ue.searchHistoryController.reset();try{Wr(v,le,me,Te)}catch{Xe(v,"Invalid regex: "+le),$e(v);return}ve.processMotion(v,S,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:x.searchArgs.toJumplist}})}function V(le){j(le,!0,!0);var me=ue.macroModeState;me.isRecording&&Bg(me,le)}function Y(le,me,Te){var Se=De(le),et,At;Se=="<Up>"||Se=="<Down>"?(et=Se=="<Up>",At=le.target?le.target.selectionEnd:0,me=ue.searchHistoryController.nextMatch(me,et)||"",Te(me),At&&le.target&&(le.target.selectionEnd=le.target.selectionStart=Math.min(At,le.target.value.length))):Se&&Se!="<Left>"&&Se!="<Right>"&&ue.searchHistoryController.reset();var ht;try{ht=Wr(v,me,!0,!0)}catch{}ht?v.scrollIntoView(lc(v,!T,ht),30):(Es(v),v.scrollTo(z.left,z.top))}function J(le,me,Te){var Se=De(le);Se=="<Esc>"||Se=="<C-c>"||Se=="<C-[>"||Se=="<BS>"&&me==""?(ue.searchHistoryController.pushInput(me),ue.searchHistoryController.reset(),Wr(v,U),Es(v),v.scrollTo(z.left,z.top),m.e_stop(le),$e(v),Te(),v.focus()):Se=="<Up>"||Se=="<Down>"?m.e_stop(le):Se=="<C-u>"&&(m.e_stop(le),Te(""))}switch(x.searchArgs.querySrc){case"prompt":var ne=ue.macroModeState;if(ne.isPlaying){var ge=ne.replaySearchQueries.shift();j(ge,!0,!1)}else Ur(v,{onClose:V,prefix:N,desc:"(JavaScript regexp)",onKeyUp:Y,onKeyDown:J});break;case"wordUnderCursor":var ee=xs(v,{noSymbol:!0}),te=!0;if(ee||(ee=xs(v,{noSymbol:!1}),te=!1),!ee){Xe(v,"No word under cursor"),$e(v);return}var ge=v.getLine(ee.start.line).substring(ee.start.ch,ee.end.ch);te&&$?ge="\\b"+ge+"\\b":ge=ag(ge),ue.jumpList.cachedCursor=v.getCursor(),v.setCursor(ee.start),j(ge,!0,!1);break}},processEx:function(v,S,x){function T(N){ue.exCommandHistoryController.pushInput(N),ue.exCommandHistoryController.reset(),gn.processCommand(v,
1376N),v.state.vim&&$e(v)}function $(N,U,z){var j=De(N),V,Y;(j=="<Esc>"||j=="<C-c>"||j=="<C-[>"||j=="<BS>"&&U=="")&&(ue.exCommandHistoryController.pushInput(U),ue.exCommandHistoryController.reset(),m.e_stop(N),$e(v),z(),v.focus()),j=="<Up>"||j=="<Down>"?(m.e_stop(N),V=j=="<Up>",Y=N.target?N.target.selectionEnd:0,U=ue.exCommandHistoryController.nextMatch(U,V)||"",z(U),Y&&N.target&&(N.target.selectionEnd=N.target.selectionStart=Math.min(Y,N.target.value.length))):j=="<C-u>"?(m.e_stop(N),z("")):j&&j!="<Left>"&&j!="<Right>"&&ue.exCommandHistoryController.reset()}x.type=="keyToEx"?gn.processCommand(v,x.exArgs.input):S.visualMode?Ur(v,{onClose:T,prefix:":",value:"'<,'>",onKeyDown:$,selectValueOnOpen:!1}):Ur(v,{onClose:T,prefix:":",onKeyDown:$})},evalInput:function(v,S){var x=S.inputState,T=x.motion,$=x.motionArgs||{},N=x.operator,U=x.operatorArgs||{},z=x.registerName,j=S.sel,V=it(S.visualMode?Ht(v,j.head):v.getCursor("head")),Y=it(S.visualMode?Ht(v,j.anchor):v.getCursor("anchor")),J=it(V),ne=it(Y),ee,te,ge;if(N&&this.recordLastEdit(S,x),x.repeatOverride!==void 0?ge=x.repeatOverride:ge=x.getRepeat(),ge>0&&$.explicitRepeat?$.repeatIsExplicit=!0:($.noRepeat||!$.explicitRepeat&&ge===0)&&(ge=1,$.repeatIsExplicit=!1),x.selectedCharacter&&($.selectedCharacter=U.selectedCharacter=x.selectedCharacter),$.repeat=ge,$e(v),T){var le=_e[T](v,V,$,S,x);if(S.lastMotion=_e[T],!le)return;if($.toJumplist){!N&&v.ace.curOp!=null&&(v.ace.curOp.command.scrollIntoView="center-animate");var me=ue.jumpList,Te=me.cachedCursor;Te?(Yl(v,Te,le),delete me.cachedCursor):Yl(v,V,le)}le instanceof Array?(te=le[0],ee=le[1]):ee=le,ee||(ee=it(V)),S.visualMode?(S.visualBlock&&ee.ch===1/0||(ee=Ht(v,ee,J)),te&&(te=Ht(v,te)),te=te||ne,j.anchor=te,j.head=ee,xr(v),On(v,S,"<",dt(te,ee)?te:ee),On(v,S,">",dt(te,ee)?ee:te)):N||(v.ace.curOp&&(v.ace.curOp.vimDialogScroll="center-animate"),ee=Ht(v,ee,J),v.setCursor(ee.line,ee.ch))}if(N){if(U.lastSel){te=ne;var Se=U.lastSel,et=Math.abs(Se.head.line-Se.anchor.line),At=Math.abs(Se.head.ch-Se.anchor.ch);
1376Se.visualLine?ee=new E(ne.line+et,ne.ch):Se.visualBlock?ee=new E(ne.line+et,ne.ch+At):Se.head.line==Se.anchor.line?ee=new E(ne.line,ne.ch+At):ee=new E(ne.line+et,ne.ch),S.visualMode=!0,S.visualLine=Se.visualLine,S.visualBlock=Se.visualBlock,j=S.sel={anchor:te,head:ee},xr(v)}else S.visualMode&&(U.lastSel={anchor:it(j.anchor),head:it(j.head),visualBlock:S.visualBlock,visualLine:S.visualLine});var ht,Tt,We,je,Ut;if(S.visualMode){ht=Vt(j.head,j.anchor),Tt=Wn(j.head,j.anchor),We=S.visualLine||U.linewise,je=S.visualBlock?"block":We?"line":"char";var wt=w(v,ht,Tt);if(Ut=ws(v,{anchor:wt.start,head:wt.end},je),We){var xt=Ut.ranges;if(je=="block")for(var Gn=0;Gn<xt.length;Gn++)xt[Gn].head.ch=It(v,xt[Gn].head.line);else je=="line"&&(xt[0].head=new E(xt[0].head.line+1,0))}}else{if(ht=it(te||ne),Tt=it(ee||J),dt(Tt,ht)){var Wg=ht;ht=Tt,Tt=Wg}We=$.linewise||U.linewise,We?pg(v,ht,Tt):$.forward&&fg(v,ht,Tt),je="char";var zg=!$.inclusive||We,wt=w(v,ht,Tt);Ut=ws(v,{anchor:wt.start,head:wt.end},je,zg)}v.setSelections(Ut.ranges,Ut.primary),S.lastMotion=null,U.repeat=ge,U.registerName=z,U.linewise=We;var ks=Bt[N](v,U,Ut.ranges,ne,ee);S.visualMode&&pn(v,ks!=null),ks&&v.setCursor(ks)}},recordLastEdit:function(v,S,x){var T=ue.macroModeState;T.isPlaying||(v.lastEditInputState=S,v.lastEditActionCommand=x,T.lastInsertModeChanges.changes=[],T.lastInsertModeChanges.expectCursorActivityForChange=!1,T.lastInsertModeChanges.visualBlock=v.visualBlock?v.sel.head.line-v.sel.anchor.line:0)}},_e={moveToTopLine:function(v,S,x){var T=Cs(v).top+x.repeat-1;return new E(T,Cn(v.getLine(T)))},moveToMiddleLine:function(v){var S=Cs(v),x=Math.floor((S.top+S.bottom)*.5);return new E(x,Cn(v.getLine(x)))},moveToBottomLine:function(v,S,x){var T=Cs(v).bottom-x.repeat+1;return new E(T,Cn(v.getLine(T)))},expandToLine:function(v,S,x){var T=S;return new E(T.line+x.repeat-1,1/0)},findNext:function(v,S,x){var T=sn(v),$=T.getQuery();if($){var N=!x.forward;return N=T.isReversed()?!N:N,ac(v,$),lc(v,N,$,x.repeat)}},findAndSelectNextInclusive:function(v,S,x,T,$){var N=sn(v),U=N.getQuery();if(U){var z=!x.forward;z=N.isReversed()?!z:z;var j=Ig(v,z,U,x.repeat,T);if(j){if($.operator)return j;var V=j[0],Y=new E(j[1].line,j[1].ch-1);if(T.visualMode){(T.visualLine||T.visualBlock)&&(T.visualLine=!1,T.visualBlock=!1,m.signal(v,"vim-mode-change",{mode:"visual",subMode:""}));var J=T.sel.anchor;if(J)return N.isReversed()?x.forward?[J,V]:[J,Y]:x.forward?[J,Y]:[J,V]}else T.visualMode=!0,T.visualLine=!1,T.visualBlock=!1,m.signal(v,"vim-mode-change",{mode:"visual",subMode:""});return z?[Y,V]:[V,Y]}}},goToMark:function(v,S,x,T){var $=Ii(v,T,x.selectedCharacter);return $?x.linewise?{line:$.line,ch:Cn(v.getLine($.line))}:$:null},moveToOtherHighlightedEnd:function(v,S,x,T){if(T.visualBlock&&x.sameLine){var $=T.sel;return[Ht(v,new E($.anchor.line,$.head.ch)),Ht(v,new E($.head.line,$.anchor.ch))]}else return[T.sel.head,T.sel.anchor]},jumpToMark:function(v,S,x,T){for(var $=S,N=0;N<x.repeat;N++){var U=$;for(var z in T.marks)if(G(z)){var j=T.marks[z].find(),V=x.forward?dt(j,U):dt(U,j);if(!V&&!(x.linewise&&j.line==U.line)){var Y=on(U,$),J=x.forward?jl(U,j,$):jl($,j,U);(Y||J)&&($=j)}}}return x.linewise&&($=new E($.line,Cn(v.getLine($.line)))),$},moveByCharacters:function(v,S,x){var T=S,$=x.repeat,N=x.forward?T.ch+$:T.ch-$;return new E(T.line,N)},moveByLines:function(v,S,x,T){var $=S,N=$.ch;switch(T.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:N=T.lastHPos;break;default:T.lastHPos=N}var U=x.repeat+(x.repeatOffset||0),z=x.forward?$.line+U:$.line-U,j=v.firstLine(),V=v.lastLine();if(z<j&&$.line==j)return this.moveToStartOfLine(v,S,x,T);if(z>V&&$.line==V)return Jl(v,S,x,T,!0);var Y=v.ace.session.getFoldLine(z);return Y&&(x.forward?z>Y.start.row&&(z=Y.end.row+1):z=Y.start.row),x.toFirstChar&&(N=Cn(v.getLine(z)),T.lastHPos=N),T.lastHSPos=v.charCoords(new E(z,N),"div").left,new E(z,N)},moveByDisplayLines:function(v,S,x,T){var $=S;switch(T.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:T.lastHSPos=v.charCoords($,"div").left}var N=x.repeat,U=v.findPosV($,x.forward?N:-N,"line",T.lastHSPos);if(U.hitSide)if(x.forward)var z=v.charCoords(U,"div"),j={top:z.top+8,left:T.lastHSPos},U=v.coordsChar(j,"div");else{var V=v.charCoords(new E(v.firstLine(),0),"div");V.left=T.lastHSPos,U=v.coordsChar(V,"div")}return T.lastHPos=U.ch,U},moveByPage:function(v,S,x){var T=S,$=x.repeat;return v.findPosV(T,x.forward?$:-$,"page")},moveByParagraph:function(v,S,x){var T=x.forward?1:-1;return Ql(v,S,x.repeat,T)},moveBySentence:function(v,S,x){var T=x.forward?1:-1;return xg(v,S,x.repeat,T)},moveByScroll:function(v,S,x,T){var $=v.getScrollInfo(),N=null,U=x.repeat;U||(U=$.clientHeight/(2*v.defaultTextHeight()));var z=v.charCoords(S,"local");if(x.repeat=U,N=_e.moveByDisplayLines(v,S,x,T),!N)return null;var j=v.charCoords(N,"local");
1376return v.scrollTo(null,$.top+j.top-z.top),N},moveByWords:function(v,S,x){return yg(v,S,x.repeat,!!x.forward,!!x.wordEnd,!!x.bigWord)},moveTillCharacter:function(v,S,x){var T=x.repeat,$=Ss(v,T,x.forward,x.selectedCharacter,S),N=x.forward?-1:1;return Zl(N,x),$?($.ch+=N,$):null},moveToCharacter:function(v,S,x){var T=x.repeat;return Zl(0,x),Ss(v,T,x.forward,x.selectedCharacter,S)||S},moveToSymbol:function(v,S,x){var T=x.repeat;return vg(v,T,x.forward,x.selectedCharacter)||S},moveToColumn:function(v,S,x,T){var $=x.repeat;return T.lastHPos=$-1,T.lastHSPos=v.charCoords(S,"div").left,bg(v,$)},moveToEol:function(v,S,x,T){return Jl(v,S,x,T,!1)},moveToFirstNonWhiteSpaceCharacter:function(v,S){var x=S;return new E(x.line,Cn(v.getLine(x.line)))},moveToMatchedSymbol:function(v,S){for(var x=S,T=x.line,$=x.ch,N=v.getLine(T),U;$<N.length;$++)if(U=N.charAt($),U&&X(U)){var z=v.getTokenTypeAt(new E(T,$+1));if(z!=="string"&&z!=="comment")break}if($<N.length){var j=/[<>]/.test(N[$])?/[(){}[\]<>]/:/[(){}[\]]/,V=v.findMatchingBracket(new E(T,$+1),{bracketRegex:j});return V.to}else return x},moveToStartOfLine:function(v,S){return new E(S.line,0)},moveToLineOrEdgeOfDocument:function(v,S,x){var T=x.forward?v.lastLine():v.firstLine();return x.repeatIsExplicit&&(T=x.repeat-v.getOption("firstLineNumber")),new E(T,Cn(v.getLine(T)))},moveToStartOfDisplayLine:function(v){return v.execCommand("goLineLeft"),v.getCursor()},moveToEndOfDisplayLine:function(v){v.execCommand("goLineRight");var S=v.getCursor();return S.sticky=="before"&&S.ch--,S},textObjectManipulation:function(v,S,x,T){var $={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},N={"'":!0,'"':!0,"`":!0},U=x.selectedCharacter;U=="b"?U="(":U=="B"&&(U="{");var z=!x.textObjectInner,j,V;if($[U]){if(V=!0,j=tc(v,S,U,z),!j){var Y=v.getSearchCursor(new RegExp("\\"+U,"g"),S);Y.find()&&(j=tc(v,Y.from(),U,z))}}else if(N[U])V=!0,j=Sg(v,S,U,z);else if(U==="W"||U==="w")for(var J=x.repeat||1;J-- >0;){var ne=xs(v,{inclusive:z,innerWord:!z,bigWord:U==="W",noSymbol:U==="W",multiline:!0},j&&j.end);ne&&(j||(j=ne),j.end=ne.end)}else if(U==="p")if(j=Ql(v,S,x.repeat,0,z),x.linewise=!0,T.visualMode)T.visualLine||(T.visualLine=!0);else{var ee=T.inputState.operatorArgs;ee&&(ee.linewise=!0),j.end.line--}else if(U==="t")j=gg(v,S,z);else if(U==="s"){var te=v.getLine(S.line);S.ch>0&&ie(te[S.ch])&&(S.ch-=1);var ge=ec(v,S,x.repeat,1,z),le=ec(v,S,x.repeat,-1,z);Q(v.getLine(le.line)[le.ch])&&Q(v.getLine(ge.line)[ge.ch-1])&&(le={line:le.line,ch:le.ch+1}),j={start:le,end:ge}}return j?v.state.vim.visualMode?dg(v,j.start,j.end,V):[j.start,j.end]:null},repeatLastCharacterSearch:function(v,S,x){var T=ue.lastCharacterSearch,$=x.repeat,N=x.forward===T.forward,U=(T.increment?1:0)*(N?-1:1);v.moveH(-U,"char"),x.inclusive=!!N;var z=Ss(v,$,N,T.selectedCharacter);return z?(z.ch+=U,z):(v.moveH(U,"char"),S)}};function Fe(v,S){_e[v]=S}function _t(v,S){for(var x=[],T=0;T<S;T++)x.push(v);return x}var Bt={change:function(v,S,x){var T,$,N=v.state.vim,U=x[0].anchor,z=x[0].head;if(N.visualMode)if(S.fullLine)z.ch=Number.MAX_VALUE,z.line--,v.setSelection(U,z),$=v.getSelection(),v.replaceSelection(""),T=U;else{$=v.getSelection();var Y=_t("",x.length);v.replaceSelections(Y),T=Vt(x[0].head,x[0].anchor)}else{$=v.getRange(U,z);var j=N.lastEditInputState||{};if(j.motion=="moveByWords"&&!Q($)){var V=/\s+$/.exec($);V&&j.motionArgs&&j.motionArgs.forward&&(z=mt(z,0,-V[0].length),$=$.slice(0,-V[0].length))}S.linewise&&(U=new E(U.line,Cn(v.getLine(U.line))),z.line>U.line&&(z=new E(z.line-1,Number.MAX_VALUE))),v.replaceRange("",U,z),T=U}ue.registerController.pushText(S.registerName,"change",$,S.linewise,x.length>1),rn.enterInsertMode(v,{head:T},v.state.vim)},delete:function(v,S,x){var T,$,N=v.state.vim;if(N.visualBlock){$=v.getSelection();var j=_t("",x.length);v.replaceSelections(j),T=Vt(x[0].head,x[0].anchor)}else{var U=x[0].anchor,z=x[0].head;S.linewise&&z.line!=v.firstLine()&&U.line==v.lastLine()&&U.line==z.line-1&&(U.line==v.firstLine()?U.ch=0:U=new E(U.line-1,It(v,U.line-1))),$=v.getRange(U,z),v.replaceRange("",U,z),T=U,S.linewise&&(T=_e.moveToFirstNonWhiteSpaceCharacter(v,U))}return ue.registerController.pushText(S.registerName,"delete",$,S.linewise,
1376N.visualBlock),Ht(v,T)},indent:function(v,S,x){var T=v.state.vim,$=T.visualMode?S.repeat:1;if(T.visualBlock){for(var N=v.getOption("tabSize"),U=v.getOption("indentWithTabs")?"	":" ".repeat(N),z,j=x.length-1;j>=0;j--)if(z=Vt(x[j].anchor,x[j].head),S.indentRight)v.replaceRange(U.repeat($),z,z);else{for(var V=v.getLine(z.line),Y=0,J=0;J<$;J++){var ne=V[z.ch+Y];if(ne=="	")Y++;else if(ne==" "){Y++;for(var ee=1;ee<U.length&&(ne=V[z.ch+Y],ne===" ");ee++)Y++}else break}v.replaceRange("",z,mt(z,0,Y))}return z}else if(v.indentMore)for(var J=0;J<$;J++)S.indentRight?v.indentMore():v.indentLess();else{var te=x[0].anchor.line,ge=T.visualBlock?x[x.length-1].anchor.line:x[0].head.line;S.linewise&&ge--;for(var j=te;j<=ge;j++)for(var J=0;J<$;J++)v.indentLine(j,S.indentRight)}return _e.moveToFirstNonWhiteSpaceCharacter(v,x[0].anchor)},indentAuto:function(v,S,x){return v.execCommand("indentAuto"),_e.moveToFirstNonWhiteSpaceCharacter(v,x[0].anchor)},hardWrap:function(v,S,x,T,$){if(v.hardWrap){var N=x[0].anchor.line,U=x[0].head.line;S.linewise&&U--;var z=v.hardWrap({from:N,to:U});return z>N&&S.linewise&&z--,S.keepCursor?T:new E(z,0)}},changeCase:function(v,S,x,T,$){for(var N=v.getSelections(),U=[],z=S.toLower,j=0;j<N.length;j++){var V=N[j],Y="";if(z===!0)Y=V.toLowerCase();else if(z===!1)Y=V.toUpperCase();else for(var J=0;J<V.length;J++){var ne=V.charAt(J);Y+=q(ne)?ne.toLowerCase():ne.toUpperCase()}U.push(Y)}return v.replaceSelections(U),S.shouldMoveCursor?$:!v.state.vim.visualMode&&S.linewise&&x[0].anchor.line+1==x[0].head.line?_e.moveToFirstNonWhiteSpaceCharacter(v,T):S.linewise?T:Vt(x[0].anchor,x[0].head)},yank:function(v,S,x,T){var $=v.state.vim,N=v.getSelection(),U=$.visualMode?Vt($.sel.anchor,$.sel.head,x[0].head,x[0].anchor):T;return ue.registerController.pushText(S.registerName,"yank",N,S.linewise,$.visualBlock),U}};function Hr(v,S){Bt[v]=S}var rn={jumpListWalk:function(v,S,x){if(!x.visualMode){var T=S.repeat,$=S.forward,N=ue.jumpList,U=N.move(v,$?T:-T),z=U?U.find():void 0;z=z||v.getCursor(),v.setCursor(z),v.ace.curOp.command.scrollIntoView="center-animate"}},scroll:function(v,S,x){if(!x.visualMode){var T=S.repeat||1,$=v.defaultTextHeight(),N=v.getScrollInfo().top,U=$*T,z=S.forward?N+U:N-U,j=it(v.getCursor()),V=v.charCoords(j,"local");if(S.forward)z>V.top?(j.line+=(z-V.top)/$,j.line=Math.ceil(j.line),v.setCursor(j),V=v.charCoords(j,"local"),v.scrollTo(null,V.top)):v.scrollTo(null,z);else{var Y=z+v.getScrollInfo().clientHeight;Y<V.bottom?(j.line-=(V.bottom-Y)/$,j.line=Math.floor(j.line),v.setCursor(j),V=v.charCoords(j,"local"),v.scrollTo(null,V.bottom-v.getScrollInfo().clientHeight)):v.scrollTo(null,z)}}},scrollToCursor:function(v,S){var x=v.getCursor().line,T=v.charCoords(new E(x,0),"local"),$=v.getScrollInfo().clientHeight,N=T.top;switch(S.position){case"center":N=T.bottom-$/2;break;case"bottom":var U=new E(x,v.getLine(x).length-1),z=v.charCoords(U,"local"),j=z.bottom-N;N=N-$+j;break}v.scrollTo(null,N)},replayMacro:function(v,S,x){var T=S.selectedCharacter,$=S.repeat,N=ue.macroModeState;for(T=="@"?T=N.latestRegister:N.latestRegister=T;$--;)Dg(v,x,N,T)},enterMacroRecordMode:function(v,S){var x=ue.macroModeState,T=S.selectedCharacter;ue.registerController.isValidRegister(T)&&x.enterMacroRecordMode(v,T)},toggleOverwrite:function(v){v.state.overwrite?(v.toggleOverwrite(!1),v.setOption("keyMap","vim-insert"),m.signal(v,"vim-mode-change",{mode:"insert"})):(v.toggleOverwrite(!0),v.setOption("keyMap","vim-replace"),m.signal(v,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(v,S,x){if(!v.getOption("readOnly")){x.insertMode=!0,x.insertModeRepeat=S&&S.repeat||1;var T=S?S.insertAt:null,$=x.sel,N=S.head||v.getCursor("head"),U=v.listSelections().length;if(T=="eol")N=new E(N.line,It(v,N.line));else if(T=="bol")N=new E(N.line,0);else if(T=="charAfter"){var z=w(v,N,mt(N,0,1));N=z.end}else if(T=="firstNonBlank"){var z=w(v,N,_e.moveToFirstNonWhiteSpaceCharacter(v,N));N=z.end}else if(T=="startOfSelectedArea"){if(!x.visualMode)return;x.visualBlock?(N=new E(Math.min($.head.line,$.anchor.line),Math.min($.head.ch,$.anchor.ch)),U=Math.abs($.head.line-$.anchor.line)+1):$.head.line<$.anchor.line?N=$.head:N=new E($.anchor.line,0)}else if(T=="endOfSelectedArea"){if(!x.visualMode)return;x.visualBlock?(N=new E(Math.min($.head.line,$.anchor.line),Math.max($.head.ch,$.anchor.ch)+1),U=Math.abs($.head.line-$.anchor.line)+1):$.head.line>=$.anchor.line?N=mt($.head,0,1):N=new E($.anchor.line,0)}else if(T=="inplace"){if(x.visualMode)return}else T=="lastEdit"&&(N=cc(v)||N);v.setOption("disableInput",!1),S&&S.replace?(v.toggleOverwrite(!0),v.setOption("keyMap","vim-replace"),m.signal(v,"vim-mode-change",{mode:"replace"})):(v.toggleOverwrite(!1),v.setOption("keyMap","vim-insert"),m.signal(v,"vim-mode-change",{mode:"insert"})),ue.macroModeState.isPlaying||(v.on("change",fc),x.insertEnd&&x.insertEnd.clear(),x.insertEnd=v.setBookmark(N,{insertLeft:!0}),m.on(v.getInputField(),"keydown",mc)),x.visualMode&&pn(v),Vl(v,N,U)}},toggleVisualMode:function(v,S,x){var T=S.repeat,$=v.getCursor(),N;if(x.visualMode)x.visualLine^S.linewise||x.visualBlock^S.blockwise?
1376(x.visualLine=!!S.linewise,x.visualBlock=!!S.blockwise,m.signal(v,"vim-mode-change",{mode:"visual",subMode:x.visualLine?"linewise":x.visualBlock?"blockwise":""}),xr(v)):pn(v);else{x.visualMode=!0,x.visualLine=!!S.linewise,x.visualBlock=!!S.blockwise,N=Ht(v,new E($.line,$.ch+T-1));var U=w(v,$,N);x.sel={anchor:U.start,head:U.end},m.signal(v,"vim-mode-change",{mode:"visual",subMode:x.visualLine?"linewise":x.visualBlock?"blockwise":""}),xr(v),On(v,x,"<",Vt($,N)),On(v,x,">",Wn($,N))}},reselectLastSelection:function(v,S,x){var T=x.lastSelection;if(x.visualMode&&Kl(v,x),T){var $=T.anchorMark.find(),N=T.headMark.find();if(!$||!N)return;x.sel={anchor:$,head:N},x.visualMode=!0,x.visualLine=T.visualLine,x.visualBlock=T.visualBlock,xr(v),On(v,x,"<",Vt($,N)),On(v,x,">",Wn($,N)),m.signal(v,"vim-mode-change",{mode:"visual",subMode:x.visualLine?"linewise":x.visualBlock?"blockwise":""})}},joinLines:function(v,S,x){var T,$;if(x.visualMode){if(T=v.getCursor("anchor"),$=v.getCursor("head"),dt($,T)){var N=$;$=T,T=N}$.ch=It(v,$.line)-1}else{var U=Math.max(S.repeat,2);T=v.getCursor(),$=Ht(v,new E(T.line+U-1,1/0))}for(var z=0,j=T.line;j<$.line;j++){z=It(v,T.line);var V="",Y=0;if(!S.keepSpaces){var J=v.getLine(T.line+1);Y=J.search(/\S/),Y==-1?Y=J.length:V=" "}v.replaceRange(V,new E(T.line,z),new E(T.line+1,Y))}var ne=Ht(v,new E(T.line,z));x.visualMode&&pn(v,!1),v.setCursor(ne)},newLineAndEnterInsertMode:function(v,S,x){x.insertMode=!0;var T=it(v.getCursor());if(T.line===v.firstLine()&&!S.after)v.replaceRange(`
1377`,new E(v.firstLine(),0)),v.setCursor(v.firstLine(),0);else{T.line=S.after?T.line:T.line-1,T.ch=It(v,T.line),v.setCursor(T);var $=m.commands.newlineAndIndentContinueComment||m.commands.newlineAndIndent;$(v)}this.enterInsertMode(v,{repeat:S.repeat},x)},paste:function(v,S,x){var T=this,$=ue.registerController.getRegister(S.registerName),N=function(){var U=$.toString();T.continuePaste(v,S,x,U,$)};S.registerName==="+"&&typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText=="function"?navigator.clipboard.readText().then(function(U){T.continuePaste(v,S,x,U,$)},function(){N()}):N()},continuePaste:function(v,S,x,T,$){var N=it(v.getCursor());if(T){if(S.matchIndent){var U=v.getOption("tabSize"),z=function(wt){var xt=wt.split("	").length-1,Gn=wt.split(" ").length-1;return xt*U+Gn*1},j=v.getLine(v.getCursor().line),V=z(j.match(/^\s*/)[0]),Y=T.replace(/\n$/,""),J=T!==Y,ne=z(T.match(/^\s*/)[0]),T=Y.replace(/^\s*/gm,function(wt){var xt=V+(z(wt)-ne);if(xt<0)return"";if(v.getOption("indentWithTabs")){var Gn=Math.floor(xt/U);return Array(Gn+1).join("	")}else return Array(xt+1).join(" ")});T+=J?`
1378`:""}if(S.repeat>1)var T=Array(S.repeat+1).join(T);var ee=$.linewise,te=$.blockwise;if(te){T=T.split(`
1379`),ee&&T.pop();for(var ge=0;ge<T.length;ge++)T[ge]=T[ge]==""?" ":T[ge];N.ch+=S.after?1:0,N.ch=Math.min(It(v,N.line),N.ch)}else ee?x.visualMode?T=x.visualLine?T.slice(0,-1):`
1380`+T.slice(0,T.length-1)+`
1381`:S.after?(T=`
1382`+T.slice(0,T.length-1),N.ch=It(v,N.line)):N.ch=0:N.ch+=S.after?1:0;var le;if(x.visualMode){x.lastPastedText=T;var me,Te=ug(v,x),Se=Te[0],et=Te[1],At=v.getSelection(),ht=v.listSelections(),Tt=new Array(ht.length).join("1").split("1");x.lastSelection&&(me=x.lastSelection.headMark.find()),ue.registerController.unnamedRegister.setText(At),te?(v.replaceSelections(Tt),et=new E(Se.line+T.length-1,Se.ch),v.setCursor(Se),Gl(v,et),v.replaceSelections(T),le=Se):x.visualBlock?(v.replaceSelections(Tt),v.setCursor(Se),v.replaceRange(T,Se,Se),le=Se):(v.replaceRange(T,Se,et),le=v.posFromIndex(v.indexFromPos(Se)+T.length-1)),me&&(x.lastSelection.headMark=v.setBookmark(me)),ee&&(le.ch=0)}else if(te){v.setCursor(N);for(var ge=0;ge<T.length;ge++){var We=N.line+ge;We>v.lastLine()&&v.replaceRange(`
1383`,new E(We,0));var je=It(v,We);je<N.ch&&lg(v,We,N.ch)}v.setCursor(N),Gl(v,new E(N.line+T.length-1,N.ch)),v.replaceSelections(T),le=N}else if(v.replaceRange(T,N),ee){var We=S.after?N.line+1:N.line;le=new E(We,Cn(v.getLine(We)))}else le=it(N),/\n/.test(T)||(le.ch+=T.length-(S.after?1:0));x.visualMode&&pn(v,!1),v.setCursor(le)}},undo:function(v,S){v.operation(function(){zl(v,m.commands.undo,S.repeat)(),v.setCursor(Ht(v,v.getCursor("start")))})},redo:function(v,S){zl(v,m.commands.redo,S.repeat)()},setRegister:function(v,S,x){x.inputState.registerName=S.selectedCharacter},insertRegister:function(v,S,x){var T=S.selectedCharacter,$=ue.registerController.getRegister(T),N=$&&$.toString();N&&v.replaceSelection(N)}
1383,oneNormalCommand:function(v,S,x){jn(v,!0),x.insertModeReturn=!0,m.on(v,"vim-command-done",function T(){x.visualMode||(x.insertModeReturn&&(x.insertModeReturn=!1,x.insertMode||rn.enterInsertMode(v,{},x)),m.off(v,"vim-command-done",T))})},setMark:function(v,S,x){var T=S.selectedCharacter;On(v,x,T,v.getCursor())},replace:function(v,S,x){var T=S.selectedCharacter,$=v.getCursor(),N,U,z=v.listSelections();if(x.visualMode)$=v.getCursor("start"),U=v.getCursor("end");else{var j=v.getLine($.line);N=$.ch+S.repeat,N>j.length&&(N=j.length),U=new E($.line,N)}var V=w(v,$,U);if($=V.start,U=V.end,T==`
1384`)x.visualMode||v.replaceRange("",$,U),(m.commands.newlineAndIndentContinueComment||m.commands.newlineAndIndent)(v);else{var Y=v.getRange($,U);if(Y=Y.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,T),Y=Y.replace(/[^\n]/g,T),x.visualBlock){var J=new Array(v.getOption("tabSize")+1).join(" ");Y=v.getSelection(),Y=Y.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,T),Y=Y.replace(/\t/g,J).replace(/[^\n]/g,T).split(`
1385`),v.replaceSelections(Y)}else v.replaceRange(Y,$,U);x.visualMode?($=dt(z[0].anchor,z[0].head)?z[0].anchor:z[0].head,v.setCursor($),pn(v,!1)):v.setCursor(mt(U,0,-1))}},incrementNumberToken:function(v,S){for(var x=v.getCursor(),T=v.getLine(x.line),$=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,N,U,z,j;(N=$.exec(T))!==null&&(U=N.index,z=U+N[0].length,!(x.ch<z)););if(!(!S.backtrack&&z<=x.ch)){if(N){var V=N[2]||N[4],Y=N[3]||N[5],J=S.increase?1:-1,ne={"0b":2,0:8,"":10,"0x":16}[V.toLowerCase()],ee=parseInt(N[1]+Y,ne)+J*S.repeat;j=ee.toString(ne);var te=V?new Array(Y.length-j.length+1+N[1].length).join("0"):"";j.charAt(0)==="-"?j="-"+V+te+j.substr(1):j=V+te+j;var ge=new E(x.line,U),le=new E(x.line,z);v.replaceRange(j,ge,le)}else return;v.setCursor(new E(x.line,U+j.length-1))}},repeatLastEdit:function(v,S,x){var T=x.lastEditInputState;if(T){var $=S.repeat;$&&S.repeatIsExplicit?x.lastEditInputState.repeatOverride=$:$=x.lastEditInputState.repeatOverride||$,vc(v,x,$,!1)}},indent:function(v,S){v.indentLine(v.getCursor().line,S.indentRight)},exitInsertMode:jn};function Li(v,S){rn[v]=S}function Ht(v,S,x){var T=v.state.vim,$=T.insertMode||T.visualMode,N=Math.min(Math.max(v.firstLine(),S.line),v.lastLine()),U=v.getLine(N),z=U.length-1+ +!!$,j=Math.min(Math.max(0,S.ch),z),V=U.charCodeAt(j);if(56320<=V&&V<=57343){var Y=1;x&&x.line==N&&x.ch>j&&(Y=-1),j+=Y,j>z&&(j-=2)}return new E(N,j)}function Ri(v){var S={};for(var x in v)v.hasOwnProperty(x)&&(S[x]=v[x]);return S}function mt(v,S,x){return typeof S=="object"&&(x=S.ch,S=S.line),new E(v.line+S,v.ch+x)}function ig(v,S,x,T){T.operator&&(x="operatorPending");for(var $,N=[],U=[],z=Ve?S.length-I:0,j=z;j<S.length;j++){var V=S[j];x=="insert"&&V.context!="insert"||V.context&&V.context!=x||T.operator&&V.type=="action"||!($=og(v,V.keys))||($=="partial"&&N.push(V),$=="full"&&U.push(V))}return{partial:N.length&&N,full:U.length&&U}}function og(v,S){var x=S.slice(-11)=="<character>",T=S.slice(-10)=="<register>";if(x||T){var $=S.length-(x?11:10),N=v.slice(0,$),U=S.slice(0,$);return N==U&&v.length>$?"full":U.indexOf(N)==0?"partial":!1}else return v==S?"full":S.indexOf(v)==0?"partial":!1}function sg(v){var S=/^.*(<[^>]+>)$/.exec(v),x=S?S[1]:v.slice(-1);if(x.length>1)switch(x){case"<CR>":x=`
1386`;break;case"<Space>":x=" ";break;default:x="";break}return x}function zl(v,S,x){return function(){for(var T=0;T<x;T++)S(v)}}function it(v){return new E(v.line,v.ch)}function on(v,S){return v.ch==S.ch&&v.line==S.line}function dt(v,S){return v.line<S.line||v.line==S.line&&v.ch<S.ch}function Vt(v,S){return arguments.length>2&&(S=Vt.apply(void 0,Array.prototype.slice.call(arguments,1))),dt(v,S)?v:S}function Wn(v,S){return arguments.length>2&&(S=Wn.apply(void 0,Array.prototype.slice.call(arguments,1))),dt(v,S)?S:v}function jl(v,S,x){var T=dt(v,S),$=dt(S,x);return T&&$}function It(v,S){return v.getLine(S).length}function bs(v){return v.trim?v.trim():v.replace(/^\s+|\s+$/g,"")}function ag(v){return v.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function lg(v,S,x){var T=It(v,S),$=new Array(x-T+1).join(" ");v.setCursor(new E(S,T)),v.replaceRange($,v.getCursor())}function Gl(v,S){var x=[],T=v.listSelections(),$=it(v.clipPos(S)),N=!on(S,$),U=v.getCursor("head"),z=cg(T,U),j=on(T[z].head,T[z].anchor),V=T.length-1,Y=V-z>
1386z?V:0,J=T[Y].anchor,ne=Math.min(J.line,$.line),ee=Math.max(J.line,$.line),te=J.ch,ge=$.ch,le=T[Y].head.ch-te,me=ge-te;le>0&&me<=0?(te++,N||ge--):le<0&&me>=0?(te--,j||ge++):le<0&&me==-1&&(te--,ge++);for(var Te=ne;Te<=ee;Te++){var Se={anchor:new E(Te,te),head:new E(Te,ge)};x.push(Se)}return v.setSelections(x),S.ch=ge,J.ch=te,J}function Vl(v,S,x){for(var T=[],$=0;$<x;$++){var N=mt(S,$,0);T.push({anchor:N,head:N})}v.setSelections(T,0)}function cg(v,S,x){for(var T=0;T<v.length;T++){var $=x!="head"&&on(v[T].anchor,S),N=x!="anchor"&&on(v[T].head,S);if($||N)return T}return-1}function ug(v,S){var x=S.lastSelection,T=function(){var N=v.listSelections(),U=N[0],z=N[N.length-1],j=dt(U.anchor,U.head)?U.anchor:U.head,V=dt(z.anchor,z.head)?z.head:z.anchor;return[j,V]},$=function(){var N=v.getCursor(),U=v.getCursor(),z=x.visualBlock;if(z){var j=z.width,V=z.height;U=new E(N.line+V,N.ch+j);for(var Y=[],J=N.line;J<U.line;J++){var ne=new E(J,N.ch),ee=new E(J,U.ch),te={anchor:ne,head:ee};Y.push(te)}v.setSelections(Y)}else{var ge=x.anchorMark.find(),le=x.headMark.find(),me=le.line-ge.line,Te=le.ch-ge.ch;U={line:U.line+me,ch:me?U.ch:Te+U.ch},x.visualLine&&(N=new E(N.line,0),U=new E(U.line,It(v,U.line))),v.setSelection(N,U)}return[N,U]};return S.visualMode?T():$()}function Kl(v,S){var x=S.sel.anchor,T=S.sel.head;S.lastPastedText&&(T=v.posFromIndex(v.indexFromPos(x)+S.lastPastedText.length),S.lastPastedText=null),S.lastSelection={anchorMark:v.setBookmark(x),headMark:v.setBookmark(T),anchor:it(x),head:it(T),visualMode:S.visualMode,visualLine:S.visualLine,visualBlock:S.visualBlock}}function dg(v,S,x,T){var $=v.state.vim.sel,N=T?S:$.head,U=T?S:$.anchor,z;return dt(x,S)&&(z=x,x=S,S=z),dt(N,U)?(N=Vt(S,N),U=Wn(U,x)):(U=Vt(S,U),N=Wn(N,x),N=mt(N,0,-1),N.ch==-1&&N.line!=v.firstLine()&&(N=new E(N.line-1,It(v,N.line-1)))),[U,N]}function xr(v,S,$){var T=v.state.vim;S=S||T.sel;var $=$||T.visualLine?"line":T.visualBlock?"block":"char",N=ws(v,S,$);v.setSelections(N.ranges,N.primary)}function ws(v,S,x,T){var $=it(S.head),N=it(S.anchor);if(x=="char"){var U=!T&&!dt(S.head,S.anchor)?1:0,z=dt(S.head,S.anchor)?1:0;return $=mt(S.head,0,U),N=mt(S.anchor,0,z),{ranges:[{anchor:N,head:$}
vendor: 4,545 bytes, lines 1386-1387
1386],primary:0}}else if(x=="line"){if(dt(S.head,S.anchor))$.ch=0,N.ch=It(v,N.line);else{N.ch=0;var j=v.lastLine();$.line>j&&($.line=j),$.ch=It(v,$.line)}return{ranges:[{anchor:N,head:$}],primary:0}}else if(x=="block"){var V=Math.min(N.line,$.line),Y=N.ch,J=Math.max(N.line,$.line),ne=$.ch;Y<ne?ne+=1:Y+=1;for(var ee=J-V+1,te=$.line==V?0:ee-1,ge=[],le=0;le<ee;le++)ge.push({anchor:new E(V+le,Y),head:new E(V+le,ne)});return{ranges:ge,primary:te}}}function hg(v){var S=v.getCursor("head");return v.getSelection().length==1&&(S=Vt(S,v.getCursor("anchor"))),S}function pn(v,S){var x=v.state.vim;S!==!1&&v.setCursor(Ht(v,x.sel.head)),Kl(v,x),x.visualMode=!1,x.visualLine=!1,x.visualBlock=!1,x.insertMode||m.signal(v,"vim-mode-change",{mode:"normal"})}function fg(v,S,x){var T=v.getRange(S,x);if(/\n\s*$/.test(T)){var $=T.split(`
1387`);$.pop();for(var N,N=$.pop();$.length>0&&N&&Q(N);N=$.pop())x.line--,x.ch=0;N?(x.line--,x.ch=It(v,x.line)):x.ch=0}}function pg(v,S,x){S.ch=0,x.ch=0,x.line++}function Cn(v){if(!v)return 0;var S=v.search(/\S/);return S==-1?v.length:S}function xs(v,S,x){var T=S.inclusive,$=S.innerWord,N=S.bigWord,U=S.noSymbol,z=S.multiline,j=x||hg(v),V=v.getLine(j.line),Y=V,J=j.line,ne=J,ee=j.ch,te,ge=U?O[0]:D[0];if($&&/\s/.test(V.charAt(ee)))ge=function(At){return/\s/.test(At)};else{for(;!ge(V.charAt(ee));)if(ee++,ee>=V.length){if(!z)return null;ee--,te=ql(v,j,!0,N,!0);break}N?ge=D[0]:(ge=O[0],ge(V.charAt(ee))||(ge=O[1]))}for(var le=ee,me=ee;ge(V.charAt(me))&&me>=0;)me--;if(me++,te)le=te.to,ne=te.line,Y=v.getLine(ne),!Y&&le==0&&le++;else for(;ge(V.charAt(le))&&le<V.length;)le++;if(T){var Te=le,Se=j.ch<=me&&/\s/.test(V.charAt(j.ch));if(!Se)for(;/\s/.test(Y.charAt(le))&&le<Y.length;)le++;if(Te==le||Se){for(var et=me;/\s/.test(V.charAt(me-1))&&me>0;)me--;!me&&!Se&&(me=et)}}return{start:new E(J,me),end:new E(ne,le)}}function gg(v,S,x){var T=S;if(!m.findMatchingTag||!m.findEnclosingTag)return{start:T,end:T};var $=m.findMatchingTag(v,S)||m.findEnclosingTag(v,S);return!$||!$.open||!$.close?{start:T,end:T}:x?{start:$.open.from,end:$.close.to}:{start:$.open.to,end:$.close.from}}function Yl(v,S,x){on(S,x)||ue.jumpList.add(v,S,x)}function Zl(v,S){ue.lastCharacterSearch.increment=v,ue.lastCharacterSearch.forward=S.forward,ue.lastCharacterSearch.selectedCharacter=S.selectedCharacter}var mg={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Xl={bracket:{isComplete:function(v){if(v.nextCh===v.symb){if(v.depth++,v.depth>=1)return!0}else v.nextCh===v.reverseSymb&&v.depth--;return!1}},section:{init:function(v){v.curMoveThrough=!0,v.symb=(v.forward?"]":"[")===v.symb?"{":"}"},isComplete:function(v){return v.index===0&&v.nextCh===v.symb}},comment:{isComplete:function(v){var S=v.lastCh==="*"&&v.nextCh==="/";return v.lastCh=v.nextCh,S}},method:{init:function(v){v.symb=v.symb==="m"?"{":"}",v.reverseSymb=v.symb==="{"?"}":"{"},isComplete:function(v){return v.nextCh===v.symb}},preprocess:{init:function(v){v.index=0},isComplete:function(v){if(v.nextCh==="#"){var S=v.lineText.match(/^#(\w+)/)[1];if(S==="endif"){if(v.forward&&v.depth===0)return!0;v.depth++}else if(S==="if"){if(!v.forward&&v.depth===0)return!0;v.depth--}if(S==="else"&&v.depth===0)return!0}return!1}}};function vg(v,S,x,T){var $=it(v.getCursor()),N=x?1:-1,U=x?v.lineCount():-1,z=$.ch,j=$.line,V=v.getLine(j),Y={lineText:V,nextCh:V.charAt(z),lastCh:null,index:z,symb:T,reverseSymb:(x?{")":"(","}":"{"}:{"(":")","{":"}"})[T],forward:x,depth:0,curMoveThrough:!1},J=mg[T];if(!J)return $;var ne=Xl[J].init,ee=Xl[J].isComplete;for(ne&&ne(Y);j!==U&&S;){if(Y.index+=N,Y.nextCh=Y.lineText.charAt(Y.index),!Y.nextCh){if(j+=N,Y.lineText=v.getLine(j)||"",N>0)Y.index=0;else{var te=Y.lineText.length;Y.index=te>0?te-1:0}Y.nextCh=Y.lineText.charAt(Y.index)}ee(Y)&&($.line=j,$.ch=Y.index,S--)}return Y.nextCh||Y.curMoveThrough?new E(j,Y.index):$}function ql(v,S,x,T,$){var N=S.line,U=S.ch,z=v.getLine(N),j=x?1:-1,V=T?D:O;if($&&z==""){if(N+=j,z=v.getLine(N),!K(v,N))return null;U=x?0:z.length}for(;;){if($&&z=="")return{from:0,to:0,line:N};for(var Y=j>0?z.length:-1,J=Y,ne=Y;U!=Y;){for(var ee=!1,te=0;te<V.length&&!ee;++te)if(V[te](z.charAt(U))){for(J=U;U!=Y&&V[te](z.charAt(U));)U+=j;if(ne=U,ee=J!=ne,J==S.ch&&N==S.line&&ne==J+j)continue;return{from:Math.min(J,ne+1),to:Math.max(J,ne),line:N}}ee||(U+=j)}if(N+=j,!K(v,N))return null;z=v.getLine(N),U=j>0?0:z.length}}function yg(v,S,x,T,$,N){var U=it(S),z=[];(T&&!$||!T&&$)&&x++;for(var j=!(T&&$),V=0;V<x;V++){var Y=ql(v,S,T,N,j);
1387if(!Y){var J=It(v,v.lastLine());z.push(T?{line:v.lastLine(),from:J,to:J}:{line:0,from:0,to:0});break}z.push(Y),S=new E(Y.line,T?Y.to-1:Y.from)}var ne=z.length!=x,ee=z[0],te=z.pop();return T&&!$?(!ne&&(ee.from!=U.ch||ee.line!=U.line)&&(te=z.pop()),new E(te.line,te.from)):T&&$?new E(te.line,te.to-1):!T&&$?(!ne&&(ee.to!=U.ch||ee.line!=U.line)&&(te=z.pop()),new E(te.line,te.to)):new E(te.line,te.from)}function Jl(v,S,x,T,$){var N=S,U=new E(N.line+x.repeat-1,1/0),z=v.clipPos(U);return z.ch--,$||(T.lastHPos=1/0,T.lastHSPos=v.charCoords(z,"div").left),U}function Ss(v,S,x,T,$){for(var N=$||v.getCursor(),U=N.ch,z,j=0;j<S;j++){var V=v.getLine(N.line);if(z=wg(U,V,T,x,!0),z==-1)return null;U=z}return new E(v.getCursor().line,z)}function bg(v,S){var x=v.getCursor().line;return Ht(v,new E(x,S-1))}function On(v,S,x,T){!ae(x,B)&&!H.test(x)||(S.marks[x]&&S.marks[x].clear(),S.marks[x]=v.setBookmark(T))}function wg(v,S,x,T,$){var N;return T?(N=S.indexOf(x,v+1),N!=-1&&!$&&(N-=1)):(N=S.lastIndexOf(x,v-1),N!=-1&&!$&&(N+=1)),N}function Ql(v,S,x,T,$){var N=S.line,U=v.firstLine(),z=v.lastLine(),j,V,Y=N;function J(me){return!/\S/.test(v.getLine(me))}function ne(me,Te,Se){return Se?J(me)!=J(me+Te):!J(me)&&J(me+Te)}function ee(me){T=T>0?1:-1;var Te=v.ace.session.getFoldLine(me);Te&&me+T>Te.start.row&&me+T<Te.end.row&&(T=(T>0?Te.end.row:Te.start.row)-me)}if(T){for(;U<=Y&&Y<=z&&x>0;)ee(Y),ne(Y,T)&&x--,Y+=T;return new E(Y,0)}var te=v.state.vim;if(te.visualLine&&ne(N,1,!0)){var ge=te.sel.anchor;ne(ge.line,-1,!0)&&(!$||ge.line!=N)&&(N+=1)}var le=J(N);for(Y=N;Y<=z&&x;Y++)ne(Y,1,!0)&&(!$||J(Y)!=le)&&x--;for(V=new E(Y,0),Y>z&&!le?le=!0:$=!1,Y=N;Y>U&&!((!$||J(Y)==le||Y==N)&&ne(Y,-1,!0));Y--);return j=new E(Y,0),{start:j,end:V}}function ec(v,S,x,T,$){function N(V){V.pos+V.dir<0||V.pos+V.dir>=V.line.length?V.line=null:V.pos+=V.dir}function U(V,Y,J,ne){var ee=V.getLine(Y),te={line:ee,ln:Y,pos:J,dir:ne};if(te.line==="")return{ln:te.ln,pos:te.pos};var ge=te.pos;for(N(te);te.line!==null;){if(ge=te.pos,ie(te.line[te.pos]))if($){for(N(te);te.line!==null&&Q(te.line[te.pos]);)ge=te.pos,N(te);return{ln:te.ln,pos:ge+1}}else return{ln:te.ln,pos:te.pos+1};N(te)}return{ln:te.ln,pos:ge+1}}function z(V,Y,J,ne){var ee=V.getLine(Y),te={line:ee,ln:Y,pos:J,dir:ne};if(te.line==="")return{ln:te.ln,pos:te.pos};var ge=te.pos;for(N(te);te.line!==null;){if(!Q(te.line[te.pos])&&!ie(te.line[te.pos]))ge=te.pos;else if(ie(te.line[te.pos]))return $?Q(te.line[te.pos+1])?{ln:te.ln,pos:te.pos+1}:{ln:te.ln,pos:ge}:{ln:te.ln,pos:ge};N(te)}return te.line=ee,$&&Q(te.line[te.pos])?{ln:te.ln,pos:te.pos}:{ln:te.ln,pos:ge}}for(var j={ln:S.line,pos:S.ch};x>0;)T<0?j=z(v,j.ln,j.pos,T):j=U(v,j.ln,j.pos,T),x--;return new E(j.ln,j.pos)}function xg(v,S,x,T){function $(j,V){if(V.pos+V.dir<0||V.pos+V.dir>=V.line.length){if(V.ln+=V.dir,!K(j,V.ln)){V.line=null,V.ln=null,V.pos=null;return}V.line=j.getLine(V.ln),V.pos=V.dir>0?0:V.line.length-1}else V.pos+=V.dir}function N(j,V,Y,J){var le=j.getLine(V),ne=le==="",ee={line:le,ln:V,pos:Y,dir:J},te={ln:ee.ln,pos:ee.pos},ge=ee.line==="";for($(j,ee);ee.line!==null;){if(te.ln=ee.ln,te.pos=ee.pos,ee.line===""&&!ge)return{ln:ee.ln,pos:ee.pos};if(ne&&ee.line!==""&&!Q(ee.line[ee.pos]))return{ln:ee.ln,pos:ee.pos};ie(ee.line[ee.pos])&&!ne&&(ee.pos===ee.line.length-1||Q(ee.line[ee.pos+1]))&&(ne=!0),$(j,ee)}var le=j.getLine(te.ln);te.pos=0;for(var me=le.length-1;me>=0;--me)if(!Q(le[me])){te.pos=me;break}return te}function U(j,V,Y,J){var ge=j.getLine(V),ne={line:ge,ln:V,pos:Y,dir:J},ee={ln:ne.ln,pos:null},te=ne.line==="";for($(j,ne);ne.line!==null;){if(ne.line===""&&!te)return ee.pos!==null?ee:{ln:ne.ln,pos:ne.pos};if(ie(ne.line[ne.pos])&&ee.pos!==null&&!(ne.ln===ee.ln&&ne.pos+1===ee.pos))return ee;ne.line!==""&&!Q(ne.line[ne.pos])&&(te=!1,ee={ln:ne.ln,pos:ne.pos}),$(j,ne)}var ge=j.getLine(ee.ln);ee.pos=0;for(var le=0;le<ge.length;++le)if(!Q(ge[le])){ee.pos=le;break}return ee}for(var z={ln:S.line,pos:S.ch};x>0;)T<0?z=U(v,z.ln,z.pos,T):z=N(v,z.ln,z.pos,T),x--;return new E(z.ln,z.pos)}function tc(v,S,x,T){var $=S,N,U,z={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">
1387":/[<>]/}[x],j={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[x],V=v.getLine($.line).charAt($.ch),Y=V===j?1:0;if(N=v.scanForBracket(new E($.line,$.ch+Y),-1,void 0,{bracketRegex:z}),U=v.scanForBracket(new E($.line,$.ch+Y),1,void 0,{bracketRegex:z}),!N||!U)return null;if(N=N.pos,U=U.pos,N.line==U.line&&N.ch>U.ch||N.line>U.line){var J=N;N=U,U=J}return T?U.ch+=1:N.ch+=1,{start:N,end:U}}function Sg(v,S,x,T){var $=it(S),N=v.getLine($.line),U=N.split(""),z,j,V,Y,J=U.indexOf(x);if($.ch<J)$.ch=J;else if(J<$.ch&&U[$.ch]==x){var ne=/string/.test(v.getTokenTypeAt(mt(S,0,1))),ee=/string/.test(v.getTokenTypeAt(S)),te=ne&&!ee;te||(j=$.ch,--$.ch)}if(U[$.ch]==x&&!j)z=$.ch+1;else for(V=$.ch;V>-1&&!z;V--)U[V]==x&&(z=V+1);if(z&&!j)for(V=z,Y=U.length;V<Y&&!j;V++)U[V]==x&&(j=V);return!z||!j?{start:$,end:$}:(T&&(--z,++j),{start:new E($.line,z),end:new E($.line,j)})}fe("pcre",!0,"boolean");function nc(){}nc.prototype={getQuery:function(){return ue.query},setQuery:function(v){ue.query=v},getOverlay:function(){return this.searchOverlay},setOverlay:function(v){this.searchOverlay=v},isReversed:function(){return ue.isReversed},setReversed:function(v){ue.isReversed=v},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(v){this.annotate=v}};function sn(v){var S=v.state.vim;return S.searchState_||(S.searchState_=new nc)}function Eg(v){return rc(v,"/")}function Cg(v){return ic(v,"/")}function rc(v,S){var x=ic(v,S)||[];if(!x.length)return[];var T=[];if(x[0]===0){for(var $=0;$<x.length;$++)typeof x[$]=="number"&&T.push(v.substring(x[$]+1,x[$+1]));return T}}function ic(v,S){S||(S="/");for(var x=!1,T=[],$=0;$<v.length;$++){var N=v.charAt($);!x&&N==S&&T.push($),x=!x&&N=="\\"}return T}function _g(v){for(var S="|(){",x="}",T=!1,$=[],N=-1;N<v.length;N++){var U=v.charAt(N)||"",z=v.charAt(N+1)||"",j=z&&S.indexOf(z)!=-1;T?((U!=="\\"||!j)&&$.push(U),T=!1):U==="\\"?(T=!0,z&&x.indexOf(z)!=-1&&(j=!0),(!j||z==="\\")&&$.push(U)):($.push(U),j&&z!=="\\"&&$.push("\\"))}return $.join("")}var oc={"\\n":`
1388`,"\\r":"\r","\\t":"	"};function Ag(v){for(var S=!1,x=[],T=-1;T<v.length;T++){var $=v.charAt(T)||"",N=v.charAt(T+1)||"";oc[$+N]?(x.push(oc[$+N]),T++):S?(x.push($),S=!1):$==="\\"?(S=!0,Z(N)||N==="$"?x.push("$"):N!=="/"&&N!=="\\"&&x.push("\\")):($==="$"&&x.push("$"),x.push($),N==="/"&&x.push("\\"))}return x.join("")}var sc={"\\/":"/","\\\\":"\\","\\n":`
1389`,"\\r":"\r","\\t":"	","\\&":"&"};function Tg(v){for(var S=new m.StringStream(v),x=[];!S.eol();){for(;S.peek()&&S.peek()!="\\";)x.push(S.next());var T=!1;for(var $ in sc)if(S.match($,!0)){T=!0,x.push(sc[$]);break}T||x.push(S.next())}return x.join("")}function kg(v,S,x){var T=ue.registerController.getRegister("/");if(T.setText(v),v instanceof RegExp)return v;var $=Cg(v),N,U;if(!$.length)N=v;else{N=v.substring(0,$[0]);var z=v.substring($[0]);U=z.indexOf("i")!=-1}if(!N)return null;xe("pcre")||(N=_g(N)),x&&(S=/^[^A-Z]*$/.test(N));var j=new RegExp(N,S||U?"im":"m");return j}function zn(v){typeof v=="string"&&(v=document.createElement(v));for(var S,x=1;x<arguments.length;x++)if(S=arguments[x])if(typeof S!="object"&&(S=document.createTextNode(S)),S.nodeType)v.appendChild(S);else for(var T in S)Object.prototype.hasOwnProperty.call(S,T)&&(T[0]==="$"?v.style[T.slice(1)]=S[T]:v.setAttribute(T,S[T]));return v}function Xe(v,S){var x=zn("div",{$color:"red",$whiteSpace:"pre",class:"cm-vim-message"},S);v.openNotification?v.openNotification(x,{bottom:!0,duration:5e3}):alert(x.innerText)}function Mg(v,S){return zn("div",{$display:"flex"},zn("span",{$fontFamily:"monospace",$whiteSpace:"pre",$flex:1},v,zn("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false",$width:"100%"})),S&&zn("span",{$color:"#888"},S))}
1389function Ur(v,S){if(Ue.length){S.value||(S.value=""),Ne=S;return}var x=Mg(S.prefix,S.desc);if(v.openDialog)v.openDialog(x,S.onClose,{onKeyDown:S.onKeyDown,onKeyUp:S.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:S.value});else{var T="";typeof S.prefix!="string"&&S.prefix&&(T+=S.prefix.textContent),S.desc&&(T+=" "+S.desc),S.onClose(prompt(T,""))}}function Lg(v,S){if(v instanceof RegExp&&S instanceof RegExp){for(var x=["global","multiline","ignoreCase","source"],T=0;T<x.length;T++){var $=x[T];if(v[$]!==S[$])return!1}return!0}return!1}function Wr(v,S,x,T){if(S){var $=sn(v),N=kg(S,!!x,!!T);if(N)return ac(v,N),Lg(N,$.getQuery())||$.setQuery(N),N}}function Rg(v){if(v.source.charAt(0)=="^")var S=!0;return{token:function(x){if(S&&!x.sol()){x.skipToEnd();return}var T=x.match(v,!1);if(T)return T[0].length==0?(x.next(),"searching"):!x.sol()&&(x.backUp(1),!v.exec(x.next()+T[0]))?(x.next(),null):(x.match(v),"searching");for(;!x.eol()&&(x.next(),!x.match(v,!1)););},query:v}}var zr=0;function ac(v,S){clearTimeout(zr);var x=sn(v);x.highlightTimeout=zr,zr=setTimeout(function(){if(v.state.vim){var T=sn(v);T.highlightTimeout=null;var $=T.getOverlay();(!$||S!=$.query)&&($&&v.removeOverlay($),$=Rg(S),v.addOverlay($),v.showMatchesOnScrollbar&&(T.getScrollbarAnnotate()&&T.getScrollbarAnnotate().clear(),T.setScrollbarAnnotate(v.showMatchesOnScrollbar(S))),T.setOverlay($))}},50)}function lc(v,S,x,T){return T===void 0&&(T=1),v.operation(function(){for(var $=v.getCursor(),N=v.getSearchCursor(x,$),U=0;U<T;U++){var z=N.find(S);if(U==0&&z&&on(N.from(),$)){var j=S?N.from():N.to();z=N.find(S),z&&!z[0]&&on(N.from(),j)&&v.getLine(j.line).length==j.ch&&(z=N.find(S))}if(!z&&(N=v.getSearchCursor(x,S?new E(v.lastLine()):new E(v.firstLine(),0)),!N.find(S)))return}return N.from()})}function Ig(v,S,x,T,$){return T===void 0&&(T=1),v.operation(function(){var N=v.getCursor(),U=v.getSearchCursor(x,N),z=U.find(!S);!$.visualMode&&z&&on(U.from(),N)&&U.find(!S);for(var j=0;j<T;j++)if(z=U.find(S),!z&&(U=v.getSearchCursor(x,S?new E(v.lastLine()):new E(v.firstLine(),0)),!U.find(S)))return;return[U.from(),U.to()]})}function Es(v){var S=sn(v);S.highlightTimeout&&(clearTimeout(S.highlightTimeout),S.highlightTimeout=null),v.removeOverlay(sn(v).getOverlay()),S.setOverlay(null),S.getScrollbarAnnotate()&&(S.getScrollbarAnnotate().clear(),S.setScrollbarAnnotate(null))}function $g(v,S,x){return typeof v!="number"&&(v=v.line),S instanceof Array?ae(v,S):typeof x=="number"?v>=S&&v<=x:v==S}function Cs(v){var S=v.ace.renderer;return{top:S.getFirstFullyVisibleRow(),bottom:S.getLastFullyVisibleRow()}}function Ii(v,S,x){if(x=="'"||x=="`")return ue.jumpList.find(v,-1)||new E(0,0);if(x==".")return cc(v);var T=S.marks[x];return T&&T.find()}function cc(v){if(v.getLastEditEnd)return v.getLastEditEnd();for(var S=v.doc.history.done,x=S.length;x--;)if(S[x].changes)return it(S[x].changes[0].to)}var uc=function(){this.buildCommandMap_()};uc.prototype={processCommand:function(v,S,x){var T=this;v.operation(function(){v.curOp.isVimOp=!0,T._processCommand(v,S,x)})},_processCommand:function(v,S,x){var T=v.state.vim,$=ue.registerController.getRegister(":"),N=$.toString(),U=new m.StringStream(S);$.setText(S);var z=x||{};z.input=S;try{this.parseInput_(v,U,z)}catch(Y){throw Xe(v,Y.toString()),Y}T.visualMode&&pn(v);var j,V;if(!z.commandName)z.line!==void 0&&(V="move");else if(j=this.matchCommand_(z.commandName),j){if(V=j.name,j.excludeFromCommandHistory&&$.setText(N),this.parseCommandArgs_(U,z,j),j.type=="exToKey"){se(v,j.toKeys,j);return}else if(j.type=="exToEx"){this.processCommand(v,j.toInput);return}}if(!V){Xe(v,'Not an editor command ":'+S+'"');return}try{dc[V](v,z),(!j||!j.possiblyAsync)&&z.callback&&z.callback()}catch(Y){throw Xe(v,Y.toString()),Y}},parseInput_:function(v,S,x){if(S.eatWhile(":"),S.eat("%")?(x.line=v.firstLine(),x.lineEnd=v.lastLine()):(x.line=this.parseLineSpec_(v,S),x.line!==void 0&&S.eat(",")&&(x.lineEnd=this.parseLineSpec_(v,S))),x.line==null)if(v.state.vim.visualMode){var T=Ii(v,v.state.vim,"<");x.selectionLine=T&&T.line,T=Ii(v,v.state.vim,">"),x.selectionLineEnd=T&&T.line}else x.selectionLine=v.getCursor().line;else x.selectionLine=x.line,x.selectionLineEnd=x.lineEnd;var $=S.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return $?x.commandName=$[1]:x.commandName=S.match(/.*/)[0],x},parseLineSpec_:function(v,S){var x=S.match(/^(\d+)/);if(x)return parseInt(x[1],10)-1;switch(S.next()){case".":return this.parseLineSpecOffset_(S,v.getCursor().line);
1389case"$":return this.parseLineSpecOffset_(S,v.lastLine());case"'":var T=S.next(),$=Ii(v,v.state.vim,T);if(!$)throw new Error("Mark not set");return this.parseLineSpecOffset_(S,$.line);case"-":case"+":return S.backUp(1),this.parseLineSpecOffset_(S,v.getCursor().line);default:S.backUp(1);return}},parseLineSpecOffset_:function(v,S){var x=v.match(/^([+-])?(\d+)/);if(x){var T=parseInt(x[2],10);x[1]=="-"?S-=T:S+=T}return S},parseCommandArgs_:function(v,S,x){if(!v.eol()){S.argString=v.match(/.*/)[0];var T=x.argDelimiter||/\s+/,$=bs(S.argString).split(T);$.length&&$[0]&&(S.args=$)}},matchCommand_:function(v){for(var S=v.length;S>0;S--){var x=v.substring(0,S);if(this.commandMap_[x]){var T=this.commandMap_[x];if(T.name.indexOf(v)===0)return T}}return null},buildCommandMap_:function(){this.commandMap_={};for(var v=0;v<L.length;v++){var S=L[v],x=S.shortName||S.name;this.commandMap_[x]=S}},map:function(v,S,x,T){if(v!=":"&&v.charAt(0)==":"){if(x)throw Error("Mode not supported for ex mappings");var $=v.substring(1);S!=":"&&S.charAt(0)==":"?this.commandMap_[$]={name:$,type:"exToEx",toInput:S.substring(1),user:!0}:this.commandMap_[$]={name:$,type:"exToKey",toKeys:S,user:!0}}else{var N={keys:v,type:"keyToKey",toKeys:S,noremap:!!T};x&&(N.context=x),k.unshift(N)}},unmap:function(v,S){if(v!=":"&&v.charAt(0)==":"){if(S)throw Error("Mode not supported for ex mappings");var x=v.substring(1);if(this.commandMap_[x]&&this.commandMap_[x].user)return delete this.commandMap_[x],!0}else for(var T=v,$=0;$<k.length;$++)if(T==k[$].keys&&k[$].context===S)return k.splice($,1),!0}};var dc={colorscheme:function(v,S){if(!S.args||S.args.length<1){Xe(v,v.getOption("theme"));return}v.setOption("theme",S.args[0])},map:function(v,S,x,T){var $=S.args;if(!$||$.length<2){v&&Xe(v,"Invalid mapping: "+S.input);return}gn.map($[0],$[1],x,T)},imap:function(v,S){this.map(v,S,"insert")},nmap:function(v,S){this.map(v,S,"normal")},vmap:function(v,S){this.map(v,S,"visual")},omap:function(v,S){this.map(v,S,"operatorPending")},noremap:function(v,S){this.map(v,S,void 0,!0)},inoremap:function(v,S){this.map(v,S,"insert",!0)},nnoremap:function(v,S){this.map(v,S,"normal",!0)},vnoremap:function(v,S){this.map(v,S,"visual",!0)},onoremap:function(v,S){this.map(v,S,"operatorPending",!0)},unmap:function(v,S,x){var T=S.args;(!T||T.length<1||!gn.unmap(T[0],x))&&v&&Xe(v,"No such mapping: "+S.input)},mapclear:function(v,S){Me.mapclear()},imapclear:function(v,S){Me.mapclear("insert")},nmapclear:function(v,S){Me.mapclear("normal")},vmapclear:function(v,S){Me.mapclear("visual")},omapclear:function(v,S){Me.mapclear("operatorPending")},move:function(v,S){ve.processCommand(v,v.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:S.line+1})},set:function(v,S){var x=S.args,T=S.setCfg||{};if(!x||x.length<1){v&&Xe(v,"Invalid mapping: "+S.input);return}var $=x[0].split("="),N=$[0],U=$[1],z=!1,j=!1;if(N.charAt(N.length-1)=="?"){if(U)throw Error("Trailing characters: "+S.argString);N=N.substring(0,N.length-1),z=!0}else N.charAt(N.length-1)=="!"&&(N=N.substring(0,N.length-1),j=!0);U===void 0&&N.substring(0,2)=="no"&&(N=N.substring(2),U=!1);var V=oe[N]&&oe[N].type=="boolean";if(V&&(j?U=!xe(N,v,T):U==null&&(U=!0)),!V&&U===void 0||z){var Y=xe(N,v,T);Y instanceof Error?Xe(v,Y.message):Y===!0||Y===!1?Xe(v," "+(Y?"":"no")+N):Xe(v,"  "+N+"="+Y)}else{var J=he(N,U,v,T);J instanceof Error&&Xe(v,J.message)}},setlocal:function(v,S){S.setCfg={scope:"local"},this.set(v,S)},setglobal:function(v,S){S.setCfg={scope:"global"},this.set(v,S)},registers:function(v,S){var x=S.args,T=ue.registerController.registers,$=`----------Registers----------
1390
1391`;if(x){var N;x=x.join("");for(var z=0;z<x.length;z++)if(N=x.charAt(z),!!ue.registerController.isValidRegister(N)){var j=T[N]||new re;$+='"'+N+"    "+j.toString()+`
1392`}}else for(var N in T){var U=T[N].toString();U.length&&($+='"'+N+"    "+U+`
1393`)}Xe(v,$)},sort:function(v,S){var x,T,$,N,U;function z(){if(S.argString){var We=new m.StringStream(S.argString);if(We.eat("!")&&(x=!0),We.eol())return;if(!We.eatSpace())return"Invalid arguments";var je=We.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!je&&!We.eol())return"Invalid arguments";if(je[1]){T=je[1].indexOf("i")!=-1,$=je[1].indexOf("u")!=-1;var Ut=je[1].indexOf("d")!=-1||je[1].indexOf("n")!=-1&&1,wt=je[1].indexOf("x")!=-1&&1,xt=je[1].indexOf("o")!=-1&&1;if(Ut+wt+xt>1)return"Invalid arguments";N=Ut&&"decimal"||wt&&"hex"||xt&&"octal"}je[2]&&(U=new RegExp(je[2].substr(1,je[2].length-2),T?"i":""))}}var j=z();if(j){Xe(v,j+": "+S.argString);return}var V=S.line||v.firstLine(),Y=S.lineEnd||S.line||v.lastLine();if(V==Y)return;var J=new E(V,0),ne=new E(Y,It(v,Y)),ee=v.getRange(J,ne).split(`
1394`),te=U||(N=="decimal"?/(-?)([\d]+)/:N=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:N=="octal"?/([0-7]+)/:null),ge=N=="decimal"?10:N=="hex"?16:N=="octal"?8:null,le=[],me=[];
1394if(N||U)for(var Te=0;Te<ee.length;Te++){var Se=U?ee[Te].match(U):null;Se&&Se[0]!=""?le.push(Se):!U&&te.exec(ee[Te])?le.push(ee[Te]):me.push(ee[Te])}else me=ee;function et(We,je){if(x){var Ut;Ut=We,We=je,je=Ut}T&&(We=We.toLowerCase(),je=je.toLowerCase());var wt=N&&te.exec(We),xt=N&&te.exec(je);return wt?(wt=parseInt((wt[1]+wt[2]).toLowerCase(),ge),xt=parseInt((xt[1]+xt[2]).toLowerCase(),ge),wt-xt):We<je?-1:1}function At(We,je){if(x){var Ut;Ut=We,We=je,je=Ut}return T&&(We[0]=We[0].toLowerCase(),je[0]=je[0].toLowerCase()),We[0]<je[0]?-1:1}if(le.sort(U?At:et),U)for(var Te=0;Te<le.length;Te++)le[Te]=le[Te].input;else N||me.sort(et);if(ee=x?le.concat(me):me.concat(le),$){var ht=ee,Tt;ee=[];for(var Te=0;Te<ht.length;Te++)ht[Te]!=Tt&&ee.push(ht[Te]),Tt=ht[Te]}v.replaceRange(ee.join(`
1395`),J,ne)},vglobal:function(v,S){this.global(v,S)},normal:function(v,S){var x=S.argString;if(x&&x[0]=="!"&&(x=x.slice(1),Ve=!0),x=x.trimStart(),!x){Xe(v,"Argument is required.");return}var T=S.line;if(typeof T=="number")for(var $=isNaN(S.lineEnd)?T:S.lineEnd,N=T;N<=$;N++)v.setCursor(N,0),se(v,S.argString.trimStart()),v.state.vim.insertMode&&jn(v,!0);else se(v,S.argString.trimStart()),v.state.vim.insertMode&&jn(v,!0)},global:function(v,S){var x=S.argString;if(!x){Xe(v,"Regular Expression missing from global");return}var T=S.commandName[0]==="v";x[0]==="!"&&S.commandName[0]==="g"&&(T=!0,x=x.slice(1));var $=S.line!==void 0?S.line:v.firstLine(),N=S.lineEnd||S.line||v.lastLine(),U=Eg(x),z=x,j;if(U.length&&(z=U[0],j=U.slice(1,U.length).join("/")),z)try{Wr(v,z,!0,!0)}catch{Xe(v,"Invalid regex: "+z);return}for(var V=sn(v).getQuery(),Y=[],J=$;J<=N;J++){var ne=v.getLine(J),ee=V.test(ne);ee!==T&&Y.push(j?v.getLineHandle(J):ne)}if(!j){Xe(v,Y.join(`
1396`));return}var te=0,ge=function(){if(te<Y.length){var le=Y[te++],me=v.getLineNumber(le);if(me==null){ge();return}var Te=me+1+j;gn.processCommand(v,Te,{callback:ge})}else v.releaseLineHandles&&v.releaseLineHandles()};ge()},substitute:function(v,S){if(!v.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var x=S.argString,T=x?rc(x,x[0]):[],$,N="",U,z,j,V=!1,Y=!1;if(T.length)$=T[0],xe("pcre")&&$!==""&&($=new RegExp($).source),N=T[1],N!==void 0&&(xe("pcre")?N=Tg(N.replace(/([^\\])&/g,"$1$$&")):N=Ag(N),ue.lastSubstituteReplacePart=N),U=T[2]?T[2].split(" "):[];else if(x&&x.length){Xe(v,"Substitutions should be of the form :s/pattern/replace/");return}if(U&&(z=U[0],j=parseInt(U[1]),z&&(z.indexOf("c")!=-1&&(V=!0),z.indexOf("g")!=-1&&(Y=!0),xe("pcre")?$=$+"/"+z:$=$.replace(/\//g,"\\/")+"/"+z)),$)try{Wr(v,$,!0,!0)}catch{Xe(v,"Invalid regex: "+$);return}if(N=N||ue.lastSubstituteReplacePart,N===void 0){Xe(v,"No previous substitute regular expression");return}var J=sn(v),ne=J.getQuery(),ee=S.line!==void 0?S.line:v.getCursor().line,te=S.lineEnd||ee;ee==v.firstLine()&&te==v.lastLine()&&(te=1/0),j&&(ee=te,te=ee+j-1);var ge=Ht(v,new E(ee,0)),le=v.getSearchCursor(ne,ge);Og(v,V,Y,ee,te,le,ne,N,S.callback)},startinsert:function(v,S){se(v,S.argString=="!"?"A":"i",{})},redo:m.commands.redo,undo:m.commands.undo,write:function(v){m.commands.save?m.commands.save(v):v.save&&v.save()},nohlsearch:function(v){Es(v)},yank:function(v){var S=it(v.getCursor()),x=S.line,T=v.getLine(x);ue.registerController.pushText("0","yank",T,!0,!0)},delete:function(v,S){var x=S.selectionLine,T=isNaN(S.selectionLineEnd)?x:S.selectionLineEnd;Bt.delete(v,{linewise:!0},[{anchor:new E(x,0),head:new E(T+1,0)}])},join:function(v,S){var x=S.selectionLine,T=isNaN(S.selectionLineEnd)?x:S.selectionLineEnd;v.setCursor(new E(x,0)),rn.joinLines(v,{repeat:T-x},v.state.vim)},delmarks:function(v,S){if(!S.argString||!bs(S.argString)){Xe(v,"Argument required");return}for(var x=v.state.vim,T=new m.StringStream(bs(S.argString));!T.eol();){T.eatSpace();var $=T.pos;if(!T.match(/[a-zA-Z]/,!1)){Xe(v,"Invalid argument: "+S.argString.substring($));return}var N=T.next();if(T.match("-",!0)){if(!T.match(/[a-zA-Z]/,!1)){Xe(v,"Invalid argument: "+S.argString.substring($));return}var U=N,z=T.next();if(G(U)&&G(z)||q(U)&&q(z)){var j=U.charCodeAt(0),V=z.charCodeAt(0);if(j>=V){Xe(v,"Invalid argument: "+S.argString.substring($));return}for(var Y=0;Y<=V-j;Y++){var J=String.fromCharCode(j+Y);delete x.marks[J]}}else{Xe(v,"Invalid argument: "+U+"-");return}}else delete x.marks[N]}}},gn=new uc;function Og(v,S,x,T,$,N,U,z,j){v.state.vim.exMode=!0;var V=!1,Y,J,ne;function ee(){v.operation(function(){for(;!V;)te(),le();me()})}function te(){var Se=v.getRange(N.from(),N.to()),et=Se.replace(U,z),At=N.to().line;N.replace(et),J=N.to().line,$+=J-At,ne=J<At}
1396function ge(){var Se=Y&&it(N.to()),et=N.findNext();return et&&!et[0]&&Se&&on(N.from(),Se)&&(et=N.findNext()),et}function le(){for(;ge()&&$g(N.from(),T,$);)if(!(!x&&N.from().line==J&&!ne)){v.scrollIntoView(N.from(),30),v.setSelection(N.from(),N.to()),Y=N.from(),V=!1;return}V=!0}function me(Se){if(Se&&Se(),v.focus(),Y){v.setCursor(Y);var et=v.state.vim;et.exMode=!1,et.lastHPos=et.lastHSPos=Y.ch}j&&j()}function Te(Se,et,At){m.e_stop(Se);var ht=De(Se);switch(ht){case"y":te(),le();break;case"n":le();break;case"a":var Tt=j;j=void 0,v.operation(ee),j=Tt;break;case"l":te();case"q":case"<Esc>":case"<C-c>":case"<C-[>":me(At);break}return V&&me(At),!0}if(le(),V){Xe(v,"No matches for "+U.source);return}if(!S){ee(),j&&j();return}Ur(v,{prefix:zn("span","replace with ",zn("strong",z)," (y/n/a/q/l)"),onKeyDown:Te})}function jn(v,S){var x=v.state.vim,T=ue.macroModeState,$=ue.registerController.getRegister("."),N=T.isPlaying,U=T.lastInsertModeChanges;N||(v.off("change",fc),x.insertEnd&&x.insertEnd.clear(),x.insertEnd=null,m.off(v.getInputField(),"keydown",mc)),!N&&x.insertModeRepeat>1&&(vc(v,x,x.insertModeRepeat-1,!0),x.lastEditInputState.repeatOverride=x.insertModeRepeat),delete x.insertModeRepeat,x.insertMode=!1,S||v.setCursor(v.getCursor().line,v.getCursor().ch-1),v.setOption("keyMap","vim"),v.setOption("disableInput",!0),v.toggleOverwrite(!1),$.setText(U.changes.join("")),m.signal(v,"vim-mode-change",{mode:"normal"}),T.isRecording&&Pg(T)}function hc(v){k.unshift(v)}function Ng(v,S,x,T,$){var N={keys:v,type:S};N[S]=x,N[S+"Args"]=T;for(var U in $)N[U]=$[U];hc(N)}fe("insertModeEscKeysTimeout",200,"number");function Dg(v,S,x,T){var $=ue.registerController.getRegister(T);if(T==":"){$.keyBuffer[0]&&gn.processCommand(v,$.keyBuffer[0]),x.isPlaying=!1;return}var N=$.keyBuffer,U=0;x.isPlaying=!0,x.replaySearchQueries=$.searchQueries.slice(0);for(var z=0;z<N.length;z++)for(var j=N[z],V,Y;j;)if(V=/<\w+-.+?>|<\w+>|./.exec(j),Y=V[0],j=j.substring(V.index+Y.length),Me.handleKey(v,Y,"macro"),S.insertMode){var J=$.insertModeChanges[U++].changes;ue.macroModeState.lastInsertModeChanges.changes=J,bc(v,J,1),jn(v)}x.isPlaying=!1}function Fg(v,S){if(!v.isPlaying){var x=v.latestRegister,T=ue.registerController.getRegister(x);T&&T.pushText(S)}}function Pg(v){if(!v.isPlaying){var S=v.latestRegister,x=ue.registerController.getRegister(S);x&&x.pushInsertModeChanges&&x.pushInsertModeChanges(v.lastInsertModeChanges)}}function Bg(v,S){if(!v.isPlaying){var x=v.latestRegister,T=ue.registerController.getRegister(x);T&&T.pushSearchQuery&&T.pushSearchQuery(S)}}function fc(v,S){var x=ue.macroModeState,T=x.lastInsertModeChanges;if(!x.isPlaying)for(var $=v.state.vim;S;){if(T.expectCursorActivityForChange=!0,T.ignoreCount>1)T.ignoreCount--;else if(S.origin=="+input"||S.origin=="paste"||S.origin===void 0){var N=v.listSelections().length;N>1&&(T.ignoreCount=N);var U=S.text.join(`
1397`);if(T.maybeReset&&(T.changes=[],T.maybeReset=!1),U)if(v.state.overwrite&&!/\n/.test(U))T.changes.push([U]);else{if(U.length>1){var z=$&&$.insertEnd&&$.insertEnd.find(),j=v.getCursor();if(z&&z.line==j.line){var V=z.ch-j.ch;V>0&&V<U.length&&(T.changes.push([U,V]),U="")}}U&&T.changes.push(U)}}S=S.next}}function pc(v){var S=v.state.vim;if(S.insertMode){var x=ue.macroModeState;if(x.isPlaying)return;var T=x.lastInsertModeChanges;T.expectCursorActivityForChange?T.expectCursorActivityForChange=!1:(T.maybeReset=!0,S.insertEnd&&S.insertEnd.clear(),S.insertEnd=v.setBookmark(v.getCursor(),{insertLeft:!0}))}else v.curOp.isVimOp||gc(v,S)}function gc(v,S,x){var T=v.getCursor("anchor"),$=v.getCursor("head");if(S.visualMode&&!v.somethingSelected()?pn(v,!1):!S.visualMode&&!S.insertMode&&v.somethingSelected()&&(S.visualMode=!0,S.visualLine=!1,m.signal(v,"vim-mode-change",{mode:"visual"})),S.visualMode){var N=dt($,T)?0:-1,U=dt($,T)?-1:0;$=mt($,0,N),T=mt(T,0,U),S.sel={anchor:T,head:$},On(v,S,"<",Vt($,T)),On(v,S,">",Wn($,T))}else!S.insertMode&&!x&&(S.lastHPos=v.getCursor().ch)}function _s(v,S){this.keyName=v,this.key=S.key,this.ctrlKey=S.ctrlKey,this.altKey=S.altKey,this.metaKey=S.metaKey,this.shiftKey=S.shiftKey}function mc(v){var S=ue.macroModeState,x=S.lastInsertModeChanges,T=m.keyName?m.keyName(v):v.ke
1397y;T&&(T.indexOf("Delete")!=-1||T.indexOf("Backspace")!=-1)&&(x.maybeReset&&(x.changes=[],x.maybeReset=!1),x.changes.push(new _s(T,v)))}function vc(v,S,x,T){var $=ue.macroModeState;$.isPlaying=!0;var N=!!S.lastEditActionCommand,U=S.inputState;function z(){N?ve.processAction(v,S,S.lastEditActionCommand):ve.evalInput(v,S)}function j(Y){if($.lastInsertModeChanges.changes.length>0){Y=S.lastEditActionCommand?Y:1;var J=$.lastInsertModeChanges;bc(v,J.changes,Y)}}if(S.inputState=S.lastEditInputState,N&&S.lastEditActionCommand.interlaceInsertRepeat)for(var V=0;V<x;V++)z(),j(1);else T||z(),j(x);S.inputState=U,S.insertMode&&!T&&jn(v),$.isPlaying=!1}function yc(v,S){m.lookupKey(S,"vim-insert",function(T){return typeof T=="string"?m.commands[T](v):T(v),!0})}function bc(v,S,x){var T=v.getCursor("head"),$=ue.macroModeState.lastInsertModeChanges.visualBlock;$&&(Vl(v,T,$+1),x=v.listSelections().length,v.setCursor(T));for(var N=0;N<x;N++){$&&v.setCursor(mt(T,N,0));for(var U=0;U<S.length;U++){var z=S[U];if(z instanceof _s)yc(v,z.keyName,z);else if(typeof z=="string")v.replaceSelection(z);else{var j=v.getCursor(),V=mt(j,0,z[0].length-(z[1]||0));v.replaceRange(z[0],j,z[1]?j:V),v.setCursor(V)}}}$&&v.setCursor(mt(T,0,1))}m.Vim=Me;var Hg={return:"CR",backspace:"BS",delete:"Del",esc:"Esc",left:"Left",right:"Right",up:"Up",down:"Down",space:"Space",insert:"Ins",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",enter:"CR"};function Ug(v,S,x,T){S.length>1&&S[0]=="n"&&(S=S.replace("numpad","")),S=Hg[S]||S;var $="";if(x.ctrlKey&&($+="C-"),x.altKey&&($+="A-"),($||S.length>1)&&x.shiftKey&&($+="S-"),T&&!T.expectLiteralNext&&S.length==1){if(F.keymap&&S in F.keymap)(F.remapCtrl!==!1||!$)&&(S=F.keymap[S]);else if(S.charCodeAt(0)>255){var N=x.code&&x.code.slice(-1)||"";x.shiftKey||(N=N.toLowerCase()),N&&(S=N)}}return $+=S,$.length>1&&($="<"+$+">"),$}var wc=Me.handleKey.bind(Me);Me.handleKey=function(v,S,x){return v.operation(function(){return wc(v,S,x)},!0)};function As(v){var S=new v.constructor;return Object.keys(v).forEach(function(x){if(x!="insertEnd"){var T=v[x];Array.isArray(T)?T=T.slice():T&&typeof T=="object"&&T.constructor!=Object&&(T=As(T)),S[x]=T}}),v.sel&&(S.sel={head:v.sel.head&&it(v.sel.head),anchor:v.sel.anchor&&it(v.sel.anchor)}),S}function xc(v,S,x){var T=!1,$=Me.maybeInitVimState_(v),N=$.visualBlock||$.wasInVisualBlock,U=v.ace.inMultiSelectMode;if($.wasInVisualBlock&&!U?$.wasInVisualBlock=!1:U&&$.visualBlock&&($.wasInVisualBlock=!0),S=="<Esc>"&&!$.insertMode&&!$.visualMode&&U)v.ace.exitMultiSelectMode();else if(N||!U||v.ace.inVirtualSelectionMode)T=Me.handleKey(v,S,x);else{var z=As($),j=$.inputState.changeQueueList||[];v.operation(function(){v.curOp.isVimOp=!0;var V=0;v.ace.forEachSelection(function(){var Y=v.ace.selection;v.state.vim.lastHPos=Y.$desiredColumn==null?Y.lead.column:Y.$desiredColumn,v.state.vim.inputState.changeQueue=j[V];var J=v.getCursor("head"),ne=v.getCursor("anchor"),ee=dt(J,ne)?0:-1,te=dt(J,ne)?-1:0;J=mt(J,0,ee),ne=mt(ne,0,te),v.state.vim.sel.head=J,v.state.vim.sel.anchor=ne,T=wc(v,S,x),Y.$desiredColumn=v.state.vim.lastHPos==-1?null:v.state.vim.lastHPos,v.ace.inVirtualSelectionMode&&(j[V]=v.state.vim.inputState.changeQueue),v.virtualSelectionMode()&&(v.state.vim=As(z)),V++}),v.curOp.cursorActivity&&!T&&(v.curOp.cursorActivity=!1),$.status=v.state.vim.status,v.state.vim=$,$.inputState.changeQueueList=j,$.inputState.changeQueue=null},!0)}return T&&!$.visualMode&&!$.insert&&$.visualMode!=v.somethingSelected()&&gc(v,$,!0),T}ut(),e.CodeMirror=m;var or=Me.maybeInitVimState_;e.handler={$id:"ace/keyboard/vim",drawCursor:function(v,S,x,T,$){var N=this.state.vim||{},U=x.characterWidth,z=x.lineHeight,j=S.top,V=S.left;if(!N.insertMode){var Y=T.cursor?c.comparePoints(T.cursor,T.start)<=0:$.selection.isBackwards()||$.selection.isEmpty();!Y&&V>U&&(V-=U)}!N.insertMode&&N.status&&(z=z/2,j+=z),i.translate(v,V,j),i.setStyle(v.style,"width",U+"px"),i.setStyle(v.style,"height",z+"px")},$getDirectionForHighlight:function(v){var S=v.state.cm,x=or(S);if(!x.insertMode)return v.session.selection.isBackwards()||v.session.selection.isEmpty()},handleKeyboard:function(v,S,x,T,$){var N=v.editor,U=N.state.cm,z=or(U);
1397if(T!=-1){if(z.insertMode||(S==-1?(x.charCodeAt(0)>255&&v.inputKey&&(x=v.inputKey,x&&v.inputHash==4&&(x=x.toUpperCase())),v.inputChar=x):S==4||S==0?v.inputKey==x&&v.inputHash==S&&v.inputChar?(x=v.inputChar,S=-1):(v.inputChar=null,v.inputKey=x,v.inputHash=S):v.inputChar=v.inputKey=null),U.state.overwrite&&z.insertMode&&x=="backspace"&&S==0)return{command:"gotoleft"};if(x=="c"&&S==1&&!l.isMac&&N.getCopyText())return N.once("copy",function(){z.insertMode?N.selection.clearSelection():U.operation(function(){pn(U)})}),{command:"null",passEvent:!0};if(x=="esc"&&!z.insertMode&&!z.visualMode&&!U.ace.inMultiSelectMode){var j=sn(U),V=j.getOverlay();V&&U.removeOverlay(V)}if(S==-1||S&1||S===0&&x.length>1){var Y=z.insertMode,J=Ug(S,x,$||{},z);z.status==null&&(z.status="");var ne=xc(U,J,"user");return z=or(U),ne&&z.status!=null?z.status+=J:z.status==null&&(z.status=""),U._signal("changeStatus"),!ne&&(S!=-1||Y)?void 0:{command:"null",passEvent:!ne}}}},attach:function(v){v.state||(v.state={});var S=new m(v);v.state.cm=S,v.$vimModeHandler=this,R(S),or(S).status=null,S.on("vim-command-done",function(){S.virtualSelectionMode()||(or(S).status=null,S.ace._signal("changeStatus"),S.ace.session.markUndoGroup())}),S.on("changeStatus",function(){S.ace.renderer.updateCursor(),S.ace._signal("changeStatus")}),S.on("vim-mode-change",function(){S.virtualSelectionMode()||(x(),S._signal("changeStatus"))});function x(){var T=or(S).insertMode;S.ace.renderer.setStyle("normal-mode",!T),v.textInput.setCommandMode(!T),v.renderer.$keepTextAreaAtCursor=T,v.renderer.$blockCursor=!T}x(),v.renderer.$cursorLayer.drawCursor=this.drawCursor.bind(S)},detach:function(v){var S=v.state.cm;M(S),S.destroy(),v.state.cm=null,v.$vimModeHandler=null,v.renderer.$cursorLayer.drawCursor=null,v.renderer.setStyle("normal-mode",!1),v.textInput.setCommandMode(!1),v.renderer.$keepTextAreaAtCursor=!0},getStatusText:function(v){var S=v.state.cm,x=or(S);if(x.insertMode)return"INSERT";var T="";return x.visualMode&&(T+="VISUAL",x.visualLine&&(T+=" LINE"),x.visualBlock&&(T+=" BLOCK")),x.status&&(T+=(T?" ":"")+x.status),T}},Me.defineOption({name:"wrap",set:function(v,S){S&&S.ace.setOption("wrap",v)},type:"boolean"},!1),Me.defineEx("write","w",function(){console.log(":write is not implemented")}),k.push({keys:"zc",type:"action",action:"fold",actionArgs:{open:!1}},{keys:"zC",type:"action",action:"fold",actionArgs:{open:!1,all:!0}},{keys:"zo",type:"action",action:"fold",actionArgs:{open:!0}},{keys:"zO",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"za",type:"action",action:"fold",actionArgs:{toggle:!0}},{keys:"zA",type:"action",action:"fold",actionArgs:{toggle:!0,all:!0}},{keys:"zf",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"zd",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"<C-A-k>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAbove"}},{keys:"<C-A-j>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelow"}},{keys:"<C-A-S-k>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAboveSkipCurrent"}},{keys:"<C-A-S-j>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelowSkipCurrent"}},{keys:"<C-A-h>",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreBefore"}},{keys:"<C-A-l>",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreAfter"}},{keys:"<C-A-S-h>",type:"action",action:"aceCommand",actionArgs:{name:"selectNextBefore"}},{keys:"<C-A-S-l>",type:"action",action:"aceCommand",actionArgs:{name:"selectNextAfter"}}),k.push({keys:"gq",type:"operator",operator:"hardWrap"}),Me.defineOperator("hardWrap",function(v,S,x,T,$){var N=x[0].anchor.line,U=x[0].head.line;return S.linewise&&U--,g(v.ace,{startRow:N,endRow:U}),E(U,0)}),fe("textwidth",void 0,"number",["tw"],function(v,S){if(S!==void 0)if(v===void 0){var x=S.ace.getOption("printMarginColumn");return x}else{var T=Math.round(v);T>1&&S.ace.setOption("printMarginColumn",T)}}),rn.aceCommand=function(v,S,x){v.vimCmd=S,v.ace.inVirtualSelectionMode?v.ace.on("beforeEndOperation",Ts):Ts(null,v.ace)};function Ts(v,S){S.off("beforeEndOperation",Ts);var x=S.state.cm.vimCmd;x&&S.execCommand(x.exec?x:x.name,x.args),S.curOp=S.prevOp}rn.fold=function(v,S,x){v.ace.execCommand(["toggleFoldWidget","toggleFoldWidget","foldOther","unfoldall"][(S.all?2:0)+(S.open?1:0)])},I=k.length,e.handler.defaultKeymap=k,e.handler.actions=rn,e.Vim=Me});(function(){ace.require(["ace/keyboard/vim"],function(t){typeof os=="object"&&typeof sp=="object"&&os&&(os.exports=t)})})()});var Xg="image/jpeg";var qg=[{maxImages:3,maxEdge:1536},{maxImages:8,maxEdge:1024},{maxImages:16,maxEdge:768},{maxImages:24,maxEdge:640}
1397,{maxImages:50,maxEdge:512}],Jg=448,Qg=t=>{let e=qg.find(r=>t<=r.maxImages);return e?e.maxEdge:Jg},em=(t,e,r)=>{let s=Math.max(t,e);if(s<=r)return{width:t,height:e};let c=r/s;return{width:Math.max(1,Math.round(t*c)),height:Math.max(1,Math.round(e*c))}},tm=t=>{let e=-1;for(let r=t.length-1;r>=0;r--)if(t[r].role==="user"){e=r;break}return t.map((r,s)=>s===e||r.role!=="user"||!Array.isArray(r.content)?r:{...r,content:r.content.filter(c=>c.type!=="image_url")})},kt=class t{static#t;static#n;#e;constructor(){this.#e=[]}static setImageHydrator(e){t.#t=e}static setOcrHydrator(e){t.#n=e}static async performImageHydration(e,r){return await t.#t(e,r)}static async performOcrHydration(e,r){return await t.#n(e,r)}static createCopyFromChatHistory(e){let r=JSON.stringify(e.#e);return t.createCopyFromJSONString(r)}static createCopyFromHistoryArray(e){let r=JSON.stringify(e);return t.createCopyFromJSONString(r)}static createCopyFromJSONString(e){let r=new t;try{r.#e=JSON.parse(e)}catch(s){console.error("Failed to parse the ChatHistory JSON:",s),r.#e=[]}return r}addMessage(e){this.#e.push(e)}getHistoryForDisplay(){let e=t.createCopyFromHistoryArray(this.#e.slice(1));for(let r of e.#e)if(r.role==="user"){if(Array.isArray(r.content)&&r.content.length>0){let s=[];for(let f of r.content)f.type==="image_url"&&s.push(f.filePath??"");let c=s.length>0?s.map(f=>`![image](${f})`).join(`
1398`)+`
1399
1400`:"";r.content=`${c}${r.content[r.content.length-1].text}`}}else if(r.role==="assistant"&&typeof r.content=="string")for(;r.content.includes("```json");){let s=r.content.indexOf("```json"),c=r.content.indexOf("```",s+1);r.content=r.content.slice(0,s)+r.content.slice(c+3)}return e.#e}getVoiceoverTextList(){let e={voiceovers:[]};for(let r=this.#e.length-1;r>=0;r--){let s=this.#e[r];if(s.role==="assistant"&&typeof s.content=="string"){let c=s.content.indexOf("```json"),f=s.content.indexOf("```",c+1),i=s.content.slice(c+7,f),d;try{d=JSON.parse(i)}catch(n){console.error("Failed to parse voiceover text:",n)}if(d?.voiceovers)return d}}return e}async getHistoryForChatGPT(){let e=t.createCopyFromHistoryArray(this.#e),r=tm(e.#e),s=r.reduce((i,d)=>d.role==="user"&&Array.isArray(d.content)?i+d.content.filter(n=>n.type==="image_url").length:i,0),c=Qg(s),f=s>=16?"paragraph":"word";for(let i of r)if(i.role==="user"&&Array.isArray(i.content)){let d=i.content;for(let n of d)if(n.type==="image_url"){if(n.filePath&&n.fileType){let o=await t.performImageHydration(n.filePath,n.fileType),a=new Image,l=new Promise((u,h)=>{a.onload=()=>{let p=document.createElement("canvas"),g=p.getContext("2d");if(g){let{width:m,height:y}=em(a.width,a.height,c);p.width=m,p.height=y,g.drawImage(a,0,0,p.width,p.height);let b=p.toDataURL(Xg,.7);n.image_url={url:b},URL.revokeObjectURL(b)}else n.image_url={url:o};URL.revokeObjectURL(o),u()},a.onerror=p=>{URL.revokeObjectURL(o),h(p)}});a.src=o,await l}}else if(n.type==="text"&&n.filePath){let o=await t.performOcrHydration(n.filePath?n.filePath:"",f);n.text=o}}return r}getHistoryForStorage(){let e=t.createCopyFromHistoryArray(this.#e);for(let r of e.#e)r.role==="user"&&Array.isArray(r.content)&&r.content.forEach(s=>{s.type==="image_url"?s.image_url={url:""}:s.type==="text"&&s.filePath&&(s.text="")});return e.#e}isThereAtLeastOneChatInteraction(){return this.#e.length>1}},Cc=t=>{let e=JSON.parse(t),r=[],s="",c=[];if(e.version==="0.0.1"){let o=e,a=o.botNumber;r[a]={version:"",botNumber:a,temperature:o.temperature,topP:o.topP,systemMessage:o.systemMessage,chatHistory:o.chatHistory}}else{let o=e;for(let a=0;a<o.bots.length;a++){let l=o.bots[a];r[a]={version:"",botNumber:a,temperature:l.temperature,topP:l.topP,systemMessage:l.systemMessage,chatHistory:l.chatHistory}}s=o.luaScript}(e.version==="0.0.3"||e.version==="0.0.4")&&(c=e.loadedMedia);let f=["motionBackground.tscshadervid","music.wav"],i={name:"AvaMultilingualNeural",voice:"en-US-AvaMultilingualNeural"};return e.version==="0.0.4"&&(i=e.voiceSelection,f=e.defaultMediaList),{version:"0.0.4",bots:r,luaScript:s,loadedMedia:c,voiceSelection:i,defaultMediaList:f}},tt=[new kt,new kt],Wt=["",""],_c=t=>{Wt=t},ar=(t,e,r)=>{let s=localStorage.getItem(`bot${e}-system-message`);if((s===null||s==="")&&(s=Wt[e]),r==="no-history"){let d=kt.createCopyFromHistoryArray([{role:"system",content:s}]);return d.addMessage(t),d}if(r==="preserve-current-history"){let d=tt[e];
1400return d.getHistoryForStorage().length===0&&(d=kt.createCopyFromHistoryArray([{role:"system",content:s}])),d.addMessage(t),d}let f=tt[e===0?1:0].getHistoryForDisplay();if(r==="other-bot-last-response-only"){let d=kt.createCopyFromHistoryArray([{role:"system",content:s}]);return f.length>0&&d.addMessage(f[f.length-1]),d.addMessage(t),d}else if(r==="other-bot-full-history"){let d=kt.createCopyFromHistoryArray([{role:"system",content:s}]);for(let n of f)d.addMessage(n);return d.addMessage(t),d}let i=tt[e];return i.getHistoryForStorage().length===0&&(i=kt.createCopyFromHistoryArray([{role:"system",content:s}])),i.addMessage(t),i};var Ms=class{opfsRoot;isStoreReadOnly=!1;constructor(e){this.opfsRoot=e}async listFilesInDirectory(e){let r=[];try{let s=this.opfsRoot;for await(let[c,f]of s.entries()){let i=`${e}/${c}`;f.kind==="file"&&r.push(i)}}catch(s){console.error(`Error reading directory ${e}:`,s)}return r}async readFile(e,r){let c=await(await this.opfsRoot.getFileHandle(e)).getFile();if(r.encoding==="utf8")return c.text();let f=await c.arrayBuffer();return new Uint8Array(f)}async writeFile(e,r){try{let c=await(await this.opfsRoot.getFileHandle(e,{create:!0})).createWritable();await c.write(r),await c.close()}catch(s){console.error(`Error writing file ${e}:`,s)}}async getFile(e){return(await this.opfsRoot.getFileHandle(e)).getFile()}async writeBlob(e,r){let c=await(await this.opfsRoot.getFileHandle(e,{create:!0})).createWritable();await r.stream().pipeTo(c)}async doesFileExist(e){try{return await this.opfsRoot.getFileHandle(e),!0}catch{}return!1}async getFileSize(e){try{return(await(await this.opfsRoot.getFileHandle(e)).getFile()).size}catch{return-1}}async deleteFile(e){try{await this.opfsRoot.removeEntry(e)}catch(r){console.error(`Error deleting file ${e}:`,r)}}async clearAllFiles(){for await(let[e,r]of this.opfsRoot.entries())if(r.kind==="file")try{await this.opfsRoot.removeEntry(e)}catch(s){console.error(`Error clearing file: ${e} `,s)}}async addFileIfNeeded(e,r,s){(!await this.doesFileExist(e)||s)&&await this.writeBlob(e,r)}},we=null,Ac=async()=>{if(we===null){let t=await navigator.storage.getDirectory();we=new Ms(t)}};var Tc=["openid","profile","email","offline_access","tsc.captions.read","tsc.captions.write"],Kt=null,Ls=null,kc=t=>{Ls=t},nm=5e3,rm=async(t=nm)=>{let e=Date.now(),r=()=>window.auth0?.createAuth0Client,s=r();if(typeof s=="function")return s;for(await new Promise(c=>{if(document.readyState==="complete")return c();window.addEventListener("load",()=>c(),{once:!0})});!s&&Date.now()-e<t;)if(await new Promise(c=>setTimeout(c,100)),s=r(),typeof s=="function")return s;return null},Mc=()=>{let t=window.__AUTH0_CONFIG__;if(!t?.domain||!t.clientId||!t.redirectUri||!t.audience)throw new Error(`Auth0 configuration missing a required field. Config: ${JSON.stringify(t)}`);return t},im=()=>{document.getElementById("auth-signin-button")?.classList.remove("hidden"),document.getElementById("prompt-sign-in-button")?.classList.remove("hidden"),document.getElementById("authenticated-user-info")?.classList.add("hidden"),document.getElementById("send-chat-button2")?.classList.add("hidden")},om=()=>{document.getElementById("auth-signin-button")?.classList.add("hidden"),document.getElementById("prompt-sign-in-button")?.classList.add("hidden"),document.getElementById("authenticated-user-info")?.classList.remove("hidden"),document.getElementById("send-chat-button2")?.classList.remove("hidden")},jr=async()=>{try{if(Kt)return await Kt.isAuthenticated()}catch(t){console.error("Auth check failed",t)}return!1},sm=async()=>{try{return Kt?(await Kt.getTokenSilently(),!0):(console.warn("Auth client unexpectedly not initialized"),!1)}catch{return!1}},Rs=async()=>{try{if(!Kt){console.warn("Auth client unexpectedly not initialized");return}await Kt.loginWithRedirect({authorizationParams:{scope:Tc.join(" "),audience:window.__AUTH0_CONFIG__?.audience}})}catch(t){console.error("Login failed",t)}},am=async()=>{try{if(!Kt){console.warn("Auth client unexpectedly not initialized");return}await Kt.logout({logoutParams:{returnTo:window.location.origin}})}catch(t){console.error("Logout failed",t)}},_n=async()=>{let e={authorizationParams:{audience:Mc().audience}};try{return Kt?await Kt.getTokenSilently(e):(console.warn("Auth client unex
1400pectedly not initialized"),null)}catch(r){return r instanceof Error&&(r.message.includes("Missing Refresh Token")||r.message.includes("Login required")||r.message.includes("consent_required")||r.message.includes("interaction_required"))?await Rs():console.error("Failed to get access token",r),null}},lm=async()=>{let t="https://cdn.auth0.com/avatars/mi.png",e=document.getElementById("authenticated-user-info"),r=document.getElementById("auth-signin-button"),s=document.getElementById("auth-signout-button"),c=document.getElementById("user-avatar"),f=document.getElementById("user-name");if(!e||!r||!s||!c||!f)return console.error("Missing required elements for user profile update"),!1;if(!Kt)return!1;try{let i=await Kt.getUser();if(!i)return!1;let d=new URL(i.picture||t),n=d.searchParams.get("d")||t;return c.onload=()=>c.classList.remove("hidden"),c.onerror=()=>{c.src=n},c.src=d.toString(),c.alt=i.name||i.email||"User avatar",f.textContent=i.name||i.email||"User",!0}catch(i){return console.error("Failed to update user profile",i),!1}},Lc=async()=>{let t=await rm();if(!t)return console.warn("Auth0 SDK could not be loaded"),Promise.reject("Auth0 SDK not available");let e=Mc(),r=e.redirectUri??window.location.href,s={authorizationParams:{audience:e.audience,redirect_uri:r,scope:Tc.join(" ")},cacheLocation:"localstorage",clientId:e.clientId,domain:e.domain,useRefreshTokens:!0};Kt=await t(s);try{let c=new URLSearchParams(window.location.search);if(c.has("code")&&c.has("state")&&(await Kt.handleRedirectCallback(),window.history?.replaceState)){c.delete("code"),c.delete("state");let i=new URL(window.location.href);i.search=c.toString(),window.history.replaceState({},document.title,i.toString())}await jr()||await sm()?(await lm(),om()):im(),document.getElementById("user-profile")?.classList.remove("hidden"),Ls&&Ls()}catch(c){console.warn("Error handling Auth0 redirect callback",c)}return Promise.resolve()},Rc=()=>{document.getElementById("prompt-sign-in-button")?.addEventListener("click",Rs),document.getElementById("auth-signin-button")?.addEventListener("click",Rs);let r=document.getElementById("auth-signout-button");r?.addEventListener("click",am);let s=()=>{r?.classList.toggle("hidden"),document.querySelector("#user-dropdown-button i")?.classList.toggle("rotate")},c=document.getElementById("user-dropdown-button");c?.addEventListener("click",f=>{f.stopImmediatePropagation(),s()}),c?.addEventListener("keydown",f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopImmediatePropagation(),s())})};var Ic=async(t,e,r)=>{let s=t.getVoiceoverTextList(),c=1,f={Accept:"application/json","Content-Type":"application/json"},i=await _n();i&&(f.Authorization=`Bearer ${i}`);for(let d of s.voiceovers){r(c,s.voiceovers.length);try{let n=await fetch("/api/v1/camtasia/text-to-speech",{method:"POST",body:`{"voiceToUse": "${e}", "text": "${d}"}`,headers:f});if(!n.ok)throw new Error("Error from TTS call");let o=await n.blob();await we?.addFileIfNeeded(`scene${c}.mp3`,o,!0)}catch(n){alert(n)}c++}},$c=[{name:"AvaMultilingualNeural",voice:"en-US-AvaMultilingualNeural"},{name:"AndrewMultilingualNeural",voice:"en-US-AndrewMultilingualNeural"},{name:"EmmaMultilingualNeural",voice:"en-US-EmmaMultilingualNeural"},{name:"BrianMultilingualNeural",voice:"en-US-BrianMultilingualNeural"},{name:"AvaNeural",voice:"en-US-AvaNeural"},{name:"AndrewNeural",voice:"en-US-AndrewNeural"},{name:"EmmaNeural",voice:"en-US-EmmaNeural"},{name:"BrianNeural",voice:"en-US-BrianNeural"},{name:"JennyNeural",voice:"en-US-JennyNeural"},{name:"GuyNeural",voice:"en-US-GuyNeural"},{name:"AriaNeural",voice:"en-US-AriaNeural"},{name:"DavisNeural",voice:"en-US-DavisNeural"},{name:"JaneNeural",voice:"en-US-JaneNeural"},{name:"JasonNeural",voice:"en-US-JasonNeural"},{name:"SaraNeural",voice:"en-US-SaraNeural"},{name:"TonyNeural",voice:"en-US-TonyNeural"},{name:"NancyNeural",voice:"en-US-NancyNeural"},{name:"AmberNeural",voice:"en-US-AmberNeural"},{name:"AnaNeural",voice:"en-US-AnaNeural"},{name:"AshleyNeural",voice:"en-US-AshleyNeural"},{name:"BrandonNeural",voice:"en-US-BrandonNeural"},{name:"ChristopherNeural",voice:"en-US-ChristopherNeural"},{name:"CoraNeural",voice:"en-US-CoraNeural"},{name:"ElizabethNeural",voice:"en-US-ElizabethNeural"},{name:"EricNeural",voice:"en-US-EricNeural"},{name:"JacobNeural",voice:"en-US-JacobNeural"},{name:"JennyMultilingualNeural",voice:"en-US-JennyMultilingualNeural"},{name:"MichelleNeural",voice:"en-US-MichelleNeural"},{name:"MonicaNeural",voice:"en-US-MonicaNeural"},{name:"RogerNeural",voice:"en-US-RogerNeural"},{name:"RyanMultilingualNeural",voice:"en-US-RyanMultilingualNeural"},{name:"SteffanNeural",voice:"en-US-SteffanNeural"},{name:"AdamMultilingualNeural",voice:"en-US-AdamMultilingualNeural"},{name:"AIGenerateNeural",voice:"en-US-AIGenerateNeural"},{name:"AIGenerateNeural",voice:"en-US-AIGenerateNeural"},{name:"AlloyTurboMultilingualNeural",voice:"en-US-AlloyTurboMultilingualNeural"},{name:"AmandaMultilingualNeural",voice:"en-US-AmandaMultilingualNeural"},{name:"BlueNeural",voice:"en-US-BlueNeural"},{name:"BrandonMultilingualNeural",voice:"en-US-BrandonMultilingualNeural"},{name:"ChristopherMultilingualNeural",voice:"en-US-ChristopherMultilingualNeural"},{name:"CoraMultilingualNeural",voice:"en-US-CoraMultilingualNeural"},{name:"DavisMultilingualNeural",voice:"en-US-DavisMultilingualNeural"},{name:"DerekMultilingualNeural",voice:"en-US-DerekMultilingualNeural"},{name:"DustinMultilingualNeural",voice:"en-US-DustinMultilingualNeural"},{name:"EchoTurboMultilingualNeural",voice:"en-US-EchoTurboMultilingualNeural"},{name:"EvelynMultilingualNeural",voice:"en-US-EvelynMultilingualNeural"},{name:"FableTurboMultilingualNeural",voice:"en-US-FableTurboMultilingualNeural"},{name:"KaiNeural",voice:"en-US-KaiNeural"},{name:"LewisMultilingualNeural",voice:"en-US-LewisMultilingualNeural"},{name:"LolaMultilingualNeural",voice:"en-US-LolaMultilingualNeural"},{name:"LunaNeural",voice:"en-US-LunaNeural"},{name:"NancyMultilingualNeural",voice:"en-US-NancyMultilingualNeural"},{name:"NovaTurboMultilingualNeural",voice:"en-US-NovaTurboMultilingualNeural"},{name:"OnyxTurboMultilingualNeural",voice:"en-US-OnyxTurboMultilingualNeural"},{name:"PhoebeMultilingualNeural",voice:"en-US-PhoebeMultilingualNeural"},{name:"SamuelMultilingualNeural",voice:"en-US-SamuelMultilingualNeural"},{name:"SerenaMultilingualNeural",voice:"en-US-SerenaMultilingualNeural"},{name:"ShimmerTurboMultilingualNeural",voice:"en-US-ShimmerTurboMultilingualNeural"},{name:"SteffanMultilingualNeural",voice:"en-US-SteffanMultilingualNeural"},{name:"AlloyMultilingualNeural",voice:"en-US-AlloyMultilingualNeural"},{name:"EchoMultilingualNeural",voice:"en-US-EchoMultilingualNeural"},{name:"FableMultilingualNeural",voice:"en-US-FableMultilingualNeural"},{name:"OnyxMultilingualNeural",voice:"en-US-OnyxMultilingualNeural"},{name:"NovaMultilingualNeural",voice:"en-US-NovaMultilingualNeural"},{name:"ShimmerMultilingualNeural",voice:"en-US-ShimmerMultilingualNeural"},{name:"AlloyMultilingualNeuralHD",voice:"en-US-AlloyMultilingualNeuralHD"},{name:"EchoMultilingualNeuralHD",voice:"en-US-EchoMultilingualNeuralHD"},{name:"FableMultilingualNeuralHD",voice:"en-US-FableMultilingualNeuralHD"},{name:"OnyxMultilingualNeuralHD",voice:"en-US-OnyxMultilingualNeuralHD"},{name:"NovaMultilingualNeuralHD",voice:"en-US-NovaMultilingualNeuralHD"},{name:"ShimmerMultilingualNeuralHD",voice:"en-US-ShimmerMultilingualNeuralHD"}];var Fi=sr(Au());var Hs=class{db=null;dbName="LumaChatImages";version=3;maxRetries=3;maxBlobSize=50*1024*1024;initPromise=null;
1400async init(){if(!this.db){this.initPromise||(this.initPromise=this.createConnection());try{await this.initPromise}catch(e){throw this.initPromise=null,e}}}async deleteDatabase(){if(this.db){try{this.db.close()}catch(r){console.warn("Error closing DB before delete:",r)}this.db=null}await new Promise((r,s)=>{let c=indexedDB.deleteDatabase(this.dbName),f=setTimeout(()=>{console.warn("deleteDatabase timeout (possible blocked state)"),s(new Error("Timed out deleting database (likely blocked by another tab)"))},5e3);c.onblocked=()=>{console.warn("Database deletion blocked: existing open connections")},c.onerror=()=>{clearTimeout(f);let i=c.error;console.error("Error deleting database:",i),s(i instanceof Error?i:new Error("Unknown error deleting database"))},c.onsuccess=()=>{clearTimeout(f),console.log("Database deleted successfully"),r()}})}async storeImage(e,r){if(!e.trim())throw new Error("Filename cannot be empty");this.validateBlob(r);let s={filename:e,blob:r,size:r.size,type:r.type,timestamp:Date.now()};await this.withRetry(async()=>(this.db||await this.init(),new Promise((c,f)=>{let i=this.db.transaction("imageBlobs","readwrite");i.oncomplete=()=>c(),i.onerror=()=>f(i.error),i.objectStore("imageBlobs").put(s)})))}async getImage(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("imageBlobs","readonly");c.onerror=()=>s(c.error);let i=c.objectStore("imageBlobs").get(e);i.onsuccess=()=>{let d=i.result;r(d?d.blob:null)},i.onerror=()=>s(i.error)})))}async deleteImage(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("imageBlobs","readwrite");c.oncomplete=()=>r(),c.onerror=()=>s(c.error),c.objectStore("imageBlobs").delete(e)})))}async cleanupOldImages(e=7*24*60*60*1e3){let r=Date.now()-e;return this.withRetry(async()=>(this.db||await this.init(),new Promise((s,c)=>{let f=this.db.transaction("imageBlobs","readwrite");f.oncomplete=()=>s(),f.onerror=()=>c(f.error);let i=f.objectStore("imageBlobs"),d=i.index("timestamp"),n=IDBKeyRange.upperBound(r);d.openCursor(n).onsuccess=o=>{let a=o.target.result;a&&(i.delete(a.value.filename),a.continue())}})))}async storeOcr(e,r){if(!e.trim())throw new Error("Filename cannot be empty");let s={filename:e,data:r,timestamp:Date.now()};await this.withRetry(async()=>(this.db||await this.init(),new Promise((c,f)=>{let i=this.db.transaction("ocrData","readwrite");i.oncomplete=()=>c(),i.onerror=()=>f(i.error),i.objectStore("ocrData").put(s)})))}async getOcr(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("ocrData","readonly");c.onerror=()=>s(c.error);let i=c.objectStore("ocrData").get(e);i.onsuccess=()=>{let d=i.result;r(d?d.data:null)},i.onerror=()=>s(i.error)})))}async deleteOcr(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("ocrData","readwrite");c.oncomplete=()=>r(),c.onerror=()=>s(c.error),c.objectStore("ocrData").delete(e)})))}async storeTranscript(e,r){if(!e.trim())throw new Error("Filename cannot be empty");let s={filename:e,data:r,timestamp:Date.now()};await this.withRetry(async()=>(this.db||await this.init(),new Promise((c,f)=>{let i=this.db.transaction("transcriptData","readwrite");i.oncomplete=()=>c(),i.onerror=()=>f(i.error),i.objectStore("transcriptData").put(s)})))}async getTranscript(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("transcriptData","readonly");c.onerror=()=>s(c.error);let i=c.objectStore("transcriptData").get(e);i.onsuccess=()=>{let d=i.result;r(d?d.data:null)},i.onerror=()=>s(i.error)})))}async deleteTranscript(e){if(!e.trim())throw new Error("Filename cannot be empty");return this.withRetry(async()=>(this.db||await this.init(),new Promise((r,s)=>{let c=this.db.transaction("transcriptData","readwrite");c.oncomplete=()=>r(),c.onerror=()=>s(c.error),c.objectStore("transcriptData").delete(e)})))}close(){this.db&&(this.db.close(),this.db=null)}async createConnection(){return new Promise((e,r)=>{let s=indexedDB.open(this.dbName,this.version);s.onerror=()=>{console.error("IndexedDB error:",s.error),r(new Error(`Failed to open IndexedDB: ${s.error}`))},s.onblocked=()=>{console.warn("IndexedDB blocked - please close other tabs with this app"),r(new Error("IndexedDB blocked"))},s.onupgradeneeded=()=>{let c=s.result;if(!c.objectStoreNames.contains("imageBlobs")){let f=c.createObjectStore("imageBlobs",{keyPath:"filename"});f.createIndex("timestamp","timestamp",{unique:!1}),f.createIndex("size","size",{unique:!1})}c.objectStoreNames.contains("ocrData")||c.createObjectStore("ocrData",{keyPath:"filename"}).createIndex("timestamp","timestamp",{unique:!1}),c.objectStoreNames.contains("transcriptData")||c.createObjectStore("transcriptData",{keyPath:"filename"}).createIndex("timestamp","timestamp",{unique:!1})},s.onsuccess=()=>{this.db=s.result,this.db.onversionchange=()=>{this.db?.close(),this.db=null,console.warn("IndexedDB version changed in another tab")},this.db.onerror=c=>{console.error("IndexedDB error:",c)},e()}})}validateBlob(e){if(e.size>this.maxBlobSize)throw new Error(`Blob size ${e.size} exceeds maximum allowed size of ${this.maxBlobSize}`)}async withRetry(e,r=this.maxRetries){try{return await e()}catch(s){if(r>0&&this.db)return console.warn(`Retrying operation, ${r} attempts remaining`),this.db.close(),this.db=null,await this.init(),this.withRetry(e,r-1);throw s}}},Ie=new Hs;var Tu=2,Wm=4,ku=Math.min(Math.max(navigator.hardwareConcurrency||Tu,Tu),Wm),zm=5e3,Vr=null,Di=null,Sr=0,Kr=null,Mu=async()=>Vr||(Di||(Di=(async()=>{let t=(0,Fi.createScheduler)(),e=await Promise.all(Array.from({length:ku},()=>(0,Fi.createWorker)("eng",1,{})));for(let r of e)t.addWorker(r);return Vr=t,console.log(`OCR: Initialized Tesseract worker pool with ${ku} worker(s)`),t})()),Di),Pi=()=>{Kr!==null&&(clearTimeout(Kr),Kr=null)},jm=async()=>{Pi();let t=Vr;if(Vr=null,Di=null,t)try{await t.terminate()}catch(e){console.warn("OCR: error terminating worker pool",e)}},Lu=()=>{Pi(),Kr=setTimeout(()=>{Kr=null,Sr===0&&jm()},zm)},Ru=async()=>{Pi(),await Mu(),Sr===0&&Lu()},Bi=t=>`${t}.ocr`,cr=async t=>{let e=Bi(t),r=t.startsWith("pasted_image_");r&&console.log(`getOcrData: Attempting to retrieve OCR data for ${t} from path ${e}`);try{await Ie.init(),r&&console.log(`getOcrData: Checking IndexedDB for ${e}`);let s=await Ie.getOcr(e);if(s){r&&console.log(`getOcrData: Found OCR data in IndexedDB for ${t}, size: ${s.size} bytes`);let c=await s.text();try{let f=JSON.parse(c);return r&&console.log(`getOcrData: Successfully parsed OCR data for ${t} - found ${f.words.length} words, ${f.lines.length} lines, ${f.paragraphs.length} paragraphs`),f}catch(f){return console.error(`Error parsing OCR data for ${t}:`,f),null}}if(r&&console.log(`getOcrData: IndexedDB lookup failed, checking wasmStore for ${e}`),await we.doesFileExist(e)){r&&console.log(`getOcrData: Found OCR data in wasmStore for ${t}`);let c=await we.readFile(e,{encoding:"utf8"});try{let f=JSON.parse(c);return r&&console.log(`getOcrData: Successfully parsed OCR data from wasmStore for ${t} - found ${f.words.length} words`),f}catch(f){return console.error(`Error parsing wasmStore OCR data for ${t}:`,f),null}}r&&console.log(`getOcrData: No OCR data found for ${t} in either store`)}catch(s){console.error(`Error reading or parsing OCR data for ${t}:`,s)}return null},Gm=async(t,e)=>{try{let r=new Blob([t],{type:"image/png"}),s=URL.createObjectURL(r);return new Promise(c=>{let f=new Image;f.onload=()=>{URL.revokeObjectURL(s);let i=10,d=10,n=50,o=f.width,a=f.height,l=Math.max(o/a,a/o),u=o>=i&&a>=d&&l<=n;u||console.warn(`OCR: Image ${e} has problematic dimensions (${o}x${a}, aspect ratio: ${l.toFixed(2)})`),c(u)},f.onerror=()=>{URL.revokeObjectURL(s),console.warn(`OCR: Could not load image ${e} to check dimensions`),c(!1)},f.src=s})}catch(r){return console.error(`OCR: Error checking image dimensions for ${e}:`,r),!1}},Vn=async(t,e)=>{let r=Bi(e),s=e.startsWith("pasted_image_");s&&console.log(`OCR: Processing pasted image: ${e}`);try{await Ie.init();let c=await Ie.getOcr(r).then(Boolean).catch(()=>!1),f=await we.doesFileExist(r);if(s&&console.log(`OCR: Pasted image ${e} already has OCR data? IndexedDB: ${c}, wasmStore: ${f}`),c||f){s&&console.log(`OCR: Using existing OCR data for ${e}`);return}s&&console.log(`OCR: Starting OCR process for pasted image ${e}`);
1400try{if(!await Gm(t,e)){console.warn(`OCR: Skipping OCR for ${e} due to problematic image dimensions`);let l={words:[],lines:[],paragraphs:[]},u=new Blob([JSON.stringify(l,null,2)],{type:"application/json"});await Ie.storeOcr(r,u),console.log(`OCR: Stored empty OCR data for ${e} to prevent further processing attempts`);return}let d=await Mu();s&&console.log(`OCR: Submitting ${e} to Tesseract worker pool...`),Pi(),Sr++;let n;try{n=await d.addJob("recognize",new Blob([t]))}finally{Sr=Math.max(0,Sr-1),Sr===0&&Lu()}s&&console.log(`OCR: Recognition completed for ${e}`);let o={words:[],lines:[],paragraphs:[]};for(let l of n.data.words)o.words.push({word:l.choices.length>0?l.choices[0].text:"",rectLTWH:`${l.bbox.x0}, ${l.bbox.y0}, ${l.bbox.x1-l.bbox.x0}, ${l.bbox.y1-l.bbox.y0}`});for(let l of n.data.lines)o.lines.push({line:l.text.length>0?l.text:"",rectLTWH:`${l.bbox.x0}, ${l.bbox.y0}, ${l.bbox.x1-l.bbox.x0}, ${l.bbox.y1-l.bbox.y0}`});for(let l of n.data.paragraphs)o.paragraphs.push({paragraph:l.text.length>0?l.text:"",rectLTWH:`${l.bbox.x0}, ${l.bbox.y0}, ${l.bbox.x1-l.bbox.x0}, ${l.bbox.y1-l.bbox.y0}`});s&&(console.log(`OCR: Extracted ${o.words.length} words, ${o.lines.length} lines, and ${o.paragraphs.length} paragraphs for ${e}`),console.log(`OCR: Saving OCR data to IndexedDB for ${e}`));let a=new Blob([JSON.stringify(o,null,2)],{type:"application/json"});await Ie.storeOcr(r,a),s&&console.log(`OCR: Successfully saved OCR data for pasted image ${e}`)}catch(i){console.error(`OCR failed for ${e}:`,i);try{let d={words:[],lines:[],paragraphs:[]},n=new Blob([JSON.stringify(d,null,2)],{type:"application/json"});await Ie.storeOcr(r,n),console.log(`OCR: Stored empty OCR data for ${e} after failure to prevent repeated attempts`)}catch(d){console.error(`Failed to save empty OCR data for ${e}:`,d)}}s&&console.log(`OCR: Completed entire OCR process for ${e}`)}catch(c){throw console.error(`Error in OCR processing for ${e}:`,c),c}};var Us=class{isStoreReadOnly=!0;libraryHandle=null;constructor(){this.libraryHandle=null}async isStoreConfigured(){return Promise.resolve(this.libraryHandle!==null)}async getFile(e){if(this.libraryHandle!==null)try{return(await this.libraryHandle.getFileHandle(e,{create:!1})).getFile()}catch{let c=await Ie.getImage(e);return c?new File([c],e,{type:c.type}):(console.error(`File not found in FileSystem or ImageStore: ${e}`),Promise.reject("File not found"))}let r=await Ie.getImage(e);return r?new File([r],e,{type:r.type}):Promise.reject("No library handle configured")}async readFile(e,r){if(this.libraryHandle!==null)try{let f=await(await this.libraryHandle.getFileHandle(e,{create:!1})).getFile();if(r.encoding==="binary"){let i=await f.arrayBuffer();return new Uint8Array(i)}return f.text()}catch{let f=await Ie.getImage(e);if(f){if(r.encoding==="binary"){let i=await f.arrayBuffer();return new Uint8Array(i)}return await f.text()}return console.error(`File not found in FileSystem or ImageStore: ${e}`),"error"}let s=await Ie.getImage(e);if(s){if(r.encoding==="binary"){let c=await s.arrayBuffer();return new Uint8Array(c)}return await s.text()}return"error"}async doesFileExist(e){if(!this.libraryHandle)return await Ie.getImage(e)!==null;try{return await this.libraryHandle.getFileHandle(e,{create:!1}),!0}catch(r){return console.log(`${r} - ${e}`),await Ie.getImage(e)!==null?(console.log(`File found in ImageStore: ${e}`),!0):!1}}async upsertLibraryHandle(e){try{if(await e.requestPermission({mode:"read"})!=="granted")throw new Error("Permission not granted");this.libraryHandle=e,await this.saveLibraryHandleToIndexedDB(e)}catch(r){throw console.error("Failed to set library handle:",r),r}}async initialize(){try{let e=await this.loadLibraryHandleFromIndexedDB();e&&(this.libraryHandle=e,await this.libraryHandle.queryPermission({mode:"read"})!=="granted"&&(console.warn("Library handle does not have read permission; please grant permission via user action."),this.libraryHandle=null))}catch(e){console.warn("Error initializing library handle:",e),this.libraryHandle=null}}async getSortedFileList(){if(this.libraryHandle===null)return[];let e=[];for await(let[r,s]of this.libraryHandle.entries())if(s.kind==="file"&&r.toLowerCase().match(/\.(jpg|jpeg|png|gif|snagx)$/)){let f=await s.getFile();e.push(f)}return e.sort((r,s)=>s.lastModified-r.lastModified)}async saveLibraryHandleToIndexedDB(e){try{let r=window.indexedDB.open("LumaChatStorage",1);r.onupgradeneeded=s=>{let c=s.target.result;c.objectStoreNames.contains("libraryHandles")||c.createObjectStore("libraryHandles")},r.onsuccess=()=>{let s=r.result;return s.transaction("libraryHandles","readwrite").objectStore("libraryHandles").put(e,"currentHandle"),s.close(),Promise.resolve()}}catch(r){return console.error("Error saving library handle:",r),Promise.reject(r)}}async loadLibraryHandleFromIndexedDB(){return new Promise(e=>{let r=window.indexedDB.open("LumaChatStorage",1);r.onupgradeneeded=s=>{let c=s.target.result;c.objectStoreNames.contains("libraryHandles")||c.createObjectStore("libraryHandles")},r.onsuccess=()=>{let s=r.result,i=s.transaction("libraryHandles","readonly").objectStore("libraryHandles").get("currentHandle");i.onsuccess=()=>{s.close(),e(i.result||null)},i.onerror=()=>{s.close(),e(null)}},r.onerror=()=>e(null)})}}
1400,ft=new Us;function Vi(t){return Ki(t.map(([e,r])=>new Array(e).fill(r,0,e)))}function Ki(t){return t.reduce((e,r)=>e.concat(Array.isArray(r)?Ki(r):r),[])}var Iu=[0,1,2,3].concat(...Vi([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function ot(){let t=this;function e(c){let f=t.dyn_tree,i=t.stat_desc.static_tree,d=t.stat_desc.extra_bits,n=t.stat_desc.extra_base,o=t.stat_desc.max_length,a,l,u,h,p,g,m=0;for(h=0;h<=15;h++)c.bl_count[h]=0;for(f[c.heap[c.heap_max]*2+1]=0,a=c.heap_max+1;a<573;a++)l=c.heap[a],h=f[f[l*2+1]*2+1]+1,h>o&&(h=o,m++),f[l*2+1]=h,!(l>t.max_code)&&(c.bl_count[h]++,p=0,l>=n&&(p=d[l-n]),g=f[l*2],c.opt_len+=g*(h+p),i&&(c.static_len+=g*(i[l*2+1]+p)));if(m!==0){do{for(h=o-1;c.bl_count[h]===0;)h--;c.bl_count[h]--,c.bl_count[h+1]+=2,c.bl_count[o]--,m-=2}while(m>0);for(h=o;h!==0;h--)for(l=c.bl_count[h];l!==0;)u=c.heap[--a],!(u>t.max_code)&&(f[u*2+1]!=h&&(c.opt_len+=(h-f[u*2+1])*f[u*2],f[u*2+1]=h),l--)}}function r(c,f){let i=0;do i|=c&1,c>>>=1,i<<=1;while(--f>0);return i>>>1}function s(c,f,i){let d=[],n=0,o,a,l;for(o=1;o<=15;o++)d[o]=n=n+i[o-1]<<1;for(a=0;a<=f;a++)l=c[a*2+1],l!==0&&(c[a*2]=r(d[l]++,l))}t.build_tree=function(c){let f=t.dyn_tree,i=t.stat_desc.static_tree,d=t.stat_desc.elems,n,o,a=-1,l;for(c.heap_len=0,c.heap_max=573,n=0;n<d;n++)f[n*2]!==0?(c.heap[++c.heap_len]=a=n,c.depth[n]=0):f[n*2+1]=0;for(;c.heap_len<2;)l=c.heap[++c.heap_len]=a<2?++a:0,f[l*2]=1,c.depth[l]=0,c.opt_len--,i&&(c.static_len-=i[l*2+1]);for(t.max_code=a,n=Math.floor(c.heap_len/2);n>=1;n--)c.pqdownheap(f,n);l=d;do n=c.heap[1],c.heap[1]=c.heap[c.heap_len--],c.pqdownheap(f,1),o=c.heap[1],c.heap[--c.heap_max]=n,c.heap[--c.heap_max]=o,f[l*2]=f[n*2]+f[o*2],c.depth[l]=Math.max(c.depth[n],c.depth[o])+1,f[n*2+1]=f[o*2+1]=l,c.heap[1]=l++,c.pqdownheap(f,1);while(c.heap_len>=2);c.heap[--c.heap_max]=c.heap[1],e(c),s(f,t.max_code,c.bl_count)}}ot._length_code=[0,1,2,3,4,5,6,7].concat(...Vi([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]]));ot.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0];ot.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576];ot.d_code=function(t){return t<256?Iu[t]:Iu[256+(t>>>7)]};ot.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];ot.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];ot.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];ot.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function $t(t,e,r,s,c){let f=this;f.static_tree=t,f.extra_bits=e,f.extra_base=r,f.elems=s,f.max_length=c}var Vm=[12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,16
14007,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227],Km=Vi([[144,8],[112,9],[24,7],[8,8]]);$t.static_ltree=Ki(Vm.map((t,e)=>[t,Km[e]]));var Ym=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23],Zm=Vi([[30,5]]);$t.static_dtree=Ki(Ym.map((t,e)=>[t,Zm[e]]));$t.static_l_desc=new $t($t.static_ltree,ot.extra_lbits,257,286,15);$t.static_d_desc=new $t($t.static_dtree,ot.extra_dbits,0,30,15);$t.static_bl_desc=new $t(null,ot.extra_blbits,0,19,7);var Xm=9,qm=8;function An(t,e,r,s,c){let f=this;f.good_length=t,f.max_lazy=e,f.nice_length=r,f.max_chain=s,f.func=c}var Ou=0,ji=1,ur=2,vn=[new An(0,0,0,0,Ou),new An(4,4,8,4,ji),new An(4,5,16,8,ji),new An(4,6,32,32,ji),new An(4,4,16,16,ur),new An(8,16,32,32,ur),new An(8,16,128,128,ur),new An(8,32,128,256,ur),new An(32,128,258,1024,ur),new An(32,258,258,4096,ur)],Hi=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],an=0,Ui=1,Yr=2,Wi=3,Jm=32,Ws=42,zi=113,Zr=666,zs=8,Qm=0,js=1,ev=2,at=3,Gi=258,qt=Gi+at+1;function $u(t,e,r,s){let c=t[e*2],f=t[r*2];return c<f||c==f&&s[e]<=s[r]}function tv(){let t=this,e,r,s,c,f,i,d,n,o,a,l,u,h,p,g,m,y,b,C,E,w,k,I,L,F,R,M,A,_,O,D,B,P,H=new ot,W=new ot,K=new ot;t.depth=[];let G,X,Z,q,Q,ie;t.bl_count=[],t.heap=[],D=[],B=[],P=[];function ae(){o=2*f,l[h-1]=0;for(let re=0;re<h-1;re++)l[re]=0;R=vn[M].max_lazy,_=vn[M].good_length,O=vn[M].nice_length,F=vn[M].max_chain,w=0,y=0,I=0,b=L=at-1,E=0,u=0}function oe(){let re;for(re=0;re<286;re++)D[re*2]=0;for(re=0;re<30;re++)B[re*2]=0;for(re=0;re<19;re++)P[re*2]=0;D[256*2]=1,t.opt_len=t.static_len=0,X=Z=0}function fe(){H.dyn_tree=D,H.stat_desc=$t.static_l_desc,W.dyn_tree=B,W.stat_desc=$t.static_d_desc,K.dyn_tree=P,K.stat_desc=$t.static_bl_desc,Q=0,ie=0,q=8,oe()}t.pqdownheap=function(re,de){let ce=t.heap,pe=ce[de],ve=de<<1;for(;ve<=t.heap_len&&(ve<t.heap_len&&$u(re,ce[ve+1],ce[ve],t.depth)&&ve++,!$u(re,pe,ce[ve],t.depth));)ce[de]=ce[ve],de=ve,ve<<=1;ce[de]=pe};function he(re,de){let ce=-1,pe,ve=re[0*2+1],_e=0,Fe=7,_t=4;ve===0&&(Fe=138,_t=3),re[(de+1)*2+1]=65535;for(let Bt=0;Bt<=de;Bt++)pe=ve,ve=re[(Bt+1)*2+1],!(++_e<Fe&&pe==ve)&&(_e<_t?P[pe*2]+=_e:pe!==0?(pe!=ce&&P[pe*2]++,P[16*2]++):_e<=10?P[17*2]++:P[18*2]++,_e=0,ce=pe,ve===0?(Fe=138,_t=3):pe==ve?(Fe=6,_t=3):(Fe=7,_t=4))}function xe(){let re;for(he(D,H.max_code),he(B,W.max_code),K.build_tree(t),re=18;re>=3&&P[ot.bl_order[re]*2+1]===0;re--);return t.opt_len+=3*(re+1)+5+5+4,re}function ke(re){t.pending_buf[t.pending++]=re}function Re(re){ke(re&255),ke(re>>>8&255)}function Ce(re){ke(re>>8&255),ke(re&255&255)}function Ae(re,de){let ce,pe=de;ie>16-pe?(ce=re,Q|=ce<<ie&65535,Re(Q),Q=ce>>>16-ie,ie+=pe-16):(Q|=re<<ie&65535,ie+=pe)}function ue(re,de){let ce=re*2;Ae(de[ce]&65535,de[ce+1]&65535)}function ut(re,de){let ce,pe=-1,ve,_e=re[0*2+1],Fe=0,_t=7,Bt=4;for(_e===0&&(_t=138,Bt=3),ce=0;ce<=de;ce++)if(ve=_e,_e=re[(ce+1)*2+1],!(++Fe<_t&&ve==_e)){if(Fe<Bt)do ue(ve,P);while(--Fe!==0);else ve!==0?(ve!=pe&&(ue(ve,P),Fe--),ue(16,P),Ae(Fe-3,2)):Fe<=10?(ue(17,P),Ae(Fe-3,3)):(ue(18,P),Ae(Fe-11,7));Fe=0,pe=ve,_e===0?(_t=138,Bt=3):ve==_e?(_t=6,Bt=3):(_t=7,Bt=4)}}function Je(re,de,ce){let pe;for(Ae(re-257,5),Ae(de-1,5),Ae(ce-4,4),pe=0;pe<ce;pe++)Ae(P[ot.bl_order[pe]*2+1],3);ut(D,re-1),ut(B,de-1)}function Me(){ie==16?(Re(Q),Q=0,ie=0):ie>=8&&(ke(Q&255),Q>>>=8,ie-=8)}function Ue(){Ae(js<<1,3),ue(256,$t.static_ltree),Me(),1+q+10-ie<9&&(Ae(js<<1,3),ue(256,$t.static_ltree),Me()),q=7}function Ve(re,de){let ce,pe,ve;if(t.dist_buf[X]=re,t.lc_buf[X]=de&255,X++,re===0?D[de*2]++:(Z++,re--,D[(ot._length_code[de]+256+1)*2]++,B[ot.d_code(re)*2]++),(X&8191)===0&&M>2){for(ce=X*8,pe=w-y,ve=0;ve<30;ve++)ce+=B[ve*2]*(5+ot.extra_dbits[ve]);if(ce>>>=3,Z<Math.floor(X/2)&&ce<Math.floor(pe/2))return!0}return X==G-1}function Ne(re,de){let ce,pe,ve=0,_e,Fe;if(X!==0)do ce=t.dist_buf[ve],pe=t.lc_buf[ve],ve++,ce===0?ue(pe,re):(_e=ot._length_code[pe],ue(_e+256+1,re),Fe=ot.extra_lbits[_e],Fe!==0&&(pe-=ot.base_length[_e],Ae(pe,Fe)),ce--,_e=ot.d_code(ce),ue(_e,de),Fe=ot.extra_dbits[_e],Fe!==0&&(ce-=ot.base_dist[_e],Ae(ce,Fe)));while(ve<X);ue(256,re),q=re[256*2+1]}function Pt(){ie>8?Re(Q):ie>0&&ke(Q&255),Q=0,ie=0}function se(re,de,ce){Pt(),q=8,ce&&(Re(de),Re(~de)),t.pending_buf.set(n.subarray(re,re+de),t.pending),t.pending+=de}function ye(re,de,ce){Ae((Qm<<1)+(ce?1:0),3),se(re,de,!0)}function Ee(re,de,ce){let pe,ve,_e=0;M>0?(H.build_tree(t),W.build_tree(t),_e=xe(),pe=t.opt_len+3+7>>>3,ve=t.static_len+3+7>>>3,ve<=pe&&(pe=ve)):pe=ve=de+5,de+4<=pe&&re!=-1?ye(re,de,ce):ve==pe?(Ae((js<<1)+(ce?1:0),3),Ne($t.static_ltree,$t.static_dtree)):(Ae((ev<<1)+(ce?1:0),3),Je(H.max_code+1,W.max_code+1,_e+1),Ne(D,B)),oe(),ce&&Pt()}function Le(re){Ee(y>=0?y:-1,w-y,re),y=w,e.flush_pending()}function De(){let re,de,ce,pe;do{if(pe=o-I-w,pe===0&&w===0&&I===0)pe=f;else if(pe==-1)pe--;else if(w>=f+f-qt){n.set(n.subarray(f,f+f),0),k-=f,w-=f,y-=f,re=h,ce=re;do de=l[--ce]&65535,l[ce]=de>=f?de-f:0;while(--re!==0);re=f,ce=re;do de=a[--ce]&65535,a[ce]=de>=f?de-f:0;while(--re!==0);pe+=f}if(e.avail_in===0)return;re=e.read_buf(n,w+I,pe),I+=re,I>=at&&(u=n[w]&255,u=(u<<m^n[w+1]&255)&g)}while(I<qt&&e.avail_in!==0)}function Qe(re){let de=65535,ce;for(de>s-5&&(de=s-5);;){if(I<=1){if(De(),I===0&&re==0)return an;if(I===0)break}if(w+=I,I=0,ce=y+de,(w===0||w>=ce)&&(I=w-ce,w=ce,Le(!1),e.avail_out===0)||w-y>=f-qt&&(Le(!1),e.avail_out===0))return an}return Le(re==4),e.avail_out===0?re==4?Yr:an:re==4?Wi:Ui}function rt(re){let de=F,ce=w,pe,ve,_e=L,Fe=w>f-qt?w-(f-qt):0,_t=O,Bt=d,Hr=w+Gi,rn=n[ce+_e-1],Li=n[ce+_e];L>=_&&(de>>=2),_t>I&&(_t=I);do if(pe=re,!(n[pe+_e]!=Li||n[pe+_e-1]!=rn||n[pe]!=n[ce]||n[++pe]!=n[ce+1])){ce+=2,pe++;do;while(n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&n[++ce]==n[++pe]&&ce<Hr);if(ve=Gi-(Hr-ce),ce=Hr-Gi,ve>_e){if(k=re,_e=ve,ve>=_t)break;rn=n[ce+_e-1],Li=n[ce+_e]}}while((re=a[re&Bt]&65535)>Fe&&--de!==0);return _e<=I?_e:I}function Ze(re){let de=0,ce;for(;;){if(I<qt){if(De(),I<qt&&re==0)return an;if(I===0)break}if(I>=at&&(u=(u<<m^n[w+(at-1)]&255)&g,de=l[u]&65535,a[w&d]=l[u],l[u]=w),de!==0&&(w-de&65535)<=f-qt&&A!=2&&(b=rt(de)),b>
1400=at)if(ce=Ve(w-k,b-at),I-=b,b<=R&&I>=at){b--;do w++,u=(u<<m^n[w+(at-1)]&255)&g,de=l[u]&65535,a[w&d]=l[u],l[u]=w;while(--b!==0);w++}else w+=b,b=0,u=n[w]&255,u=(u<<m^n[w+1]&255)&g;else ce=Ve(0,n[w]&255),I--,w++;if(ce&&(Le(!1),e.avail_out===0))return an}return Le(re==4),e.avail_out===0?re==4?Yr:an:re==4?Wi:Ui}function $e(re){let de=0,ce,pe;for(;;){if(I<qt){if(De(),I<qt&&re==0)return an;if(I===0)break}if(I>=at&&(u=(u<<m^n[w+(at-1)]&255)&g,de=l[u]&65535,a[w&d]=l[u],l[u]=w),L=b,C=k,b=at-1,de!==0&&L<R&&(w-de&65535)<=f-qt&&(A!=2&&(b=rt(de)),b<=5&&(A==1||b==at&&w-k>4096)&&(b=at-1)),L>=at&&b<=L){pe=w+I-at,ce=Ve(w-1-C,L-at),I-=L-1,L-=2;do++w<=pe&&(u=(u<<m^n[w+(at-1)]&255)&g,de=l[u]&65535,a[w&d]=l[u],l[u]=w);while(--L!==0);if(E=0,b=at-1,w++,ce&&(Le(!1),e.avail_out===0))return an}else if(E!==0){if(ce=Ve(0,n[w-1]&255),ce&&Le(!1),w++,I--,e.avail_out===0)return an}else E=1,w++,I--}return E!==0&&(ce=Ve(0,n[w-1]&255),E=0),Le(re==4),e.avail_out===0?re==4?Yr:an:re==4?Wi:Ui}function ze(re){return re.total_in=re.total_out=0,re.msg=null,t.pending=0,t.pending_out=0,r=zi,c=0,fe(),ae(),0}t.deflateInit=function(re,de,ce,pe,ve,_e){return pe||(pe=zs),ve||(ve=qm),_e||(_e=0),re.msg=null,de==-1&&(de=6),ve<1||ve>Xm||pe!=zs||ce<9||ce>15||de<0||de>9||_e<0||_e>2?-2:(re.dstate=t,i=ce,f=1<<i,d=f-1,p=ve+7,h=1<<p,g=h-1,m=Math.floor((p+at-1)/at),n=new Uint8Array(f*2),a=[],l=[],G=1<<ve+6,t.pending_buf=new Uint8Array(G*4),s=G*4,t.dist_buf=new Uint16Array(G),t.lc_buf=new Uint8Array(G),M=de,A=_e,ze(re))},t.deflateEnd=function(){return r!=Ws&&r!=zi&&r!=Zr?-2:(t.lc_buf=null,t.dist_buf=null,t.pending_buf=null,l=null,a=null,n=null,t.dstate=null,r==zi?-3:0)},t.deflateParams=function(re,de,ce){let pe=0;return de==-1&&(de=6),de<0||de>9||ce<0||ce>2?-2:(vn[M].func!=vn[de].func&&re.total_in!==0&&(pe=re.deflate(1)),M!=de&&(M=de,R=vn[M].max_lazy,_=vn[M].good_length,O=vn[M].nice_length,F=vn[M].max_chain),A=ce,pe)},t.deflateSetDictionary=function(re,de,ce){let pe=ce,ve,_e=0;if(!de||r!=Ws)return-2;if(pe<at)return 0;for(pe>f-qt&&(pe=f-qt,_e=ce-pe),n.set(de.subarray(_e,_e+pe),0),w=pe,y=pe,u=n[0]&255,u=(u<<m^n[1]&255)&g,ve=0;ve<=pe-at;ve++)u=(u<<m^n[ve+(at-1)]&255)&g,a[ve&d]=l[u],l[u]=ve;return 0},t.deflate=function(re,de){let ce,pe,ve,_e,Fe;if(de>4||de<0)return-2;if(!re.next_out||!re.next_in&&re.avail_in!==0||r==Zr&&de!=4)return re.msg=Hi[4],-2;if(re.avail_out===0)return re.msg=Hi[7],-5;if(e=re,_e=c,c=de,r==Ws&&(pe=zs+(i-8<<4)<<8,ve=(M-1&255)>>1,ve>3&&(ve=3),pe|=ve<<6,w!==0&&(pe|=Jm),pe+=31-pe%31,r=zi,Ce(pe)),t.pending!==0){if(e.flush_pending(),e.avail_out===0)return c=-1,0}else if(e.avail_in===0&&de<=_e&&de!=4)return e.msg=Hi[7],-5;if(r==Zr&&e.avail_in!==0)return re.msg=Hi[7],-5;if(e.avail_in!==0||I!==0||de!=0&&r!=Zr){switch(Fe=-1,vn[M].func){case Ou:Fe=Qe(de);break;case ji:Fe=Ze(de);break;case ur:Fe=$e(de);break;default:}if((Fe==Yr||Fe==Wi)&&(r=Zr),Fe==an||Fe==Yr)return e.avail_out===0&&(c=-1),0;if(Fe==Ui){if(de==1)Ue();else if(ye(0,0,!1),de==3)for(ce=0;ce<h;ce++)l[ce]=0;if(e.flush_pending(),e.avail_out===0)return c=-1,0}}return de!=4?0:1}}function Nu(){let t=this;t.next_in_index=0,t.next_out_index=0,t.avail_in=0,t.total_in=0,t.avail_out=0,t.total_out=0}Nu.prototype={deflateInit(t,e){let r=this;return r.dstate=new tv,e||(e=15),r.dstate.deflateInit(r,t,e)},deflate(t){let e=this;return e.dstate?e.dstate.deflate(e,t):-2},deflateEnd(){let t=this;if(!t.dstate)return-2;let e=t.dstate.deflateEnd();return t.dstate=null,e},deflateParams(t,e){let r=this;return r.dstate?r.dstate.deflateParams(r,t,e):-2},deflateSetDictionary(t,e){let r=this;return r.dstate?r.dstate.deflateSetDictionary(r,t,e):-2},read_buf(t,e,r){let s=this,c=s.avail_in;return c>r&&(c=r),c===0?0:(s.avail_in-=c,t.set(s.next_in.subarray(s.next_in_index,s.next_in_index+c),e),s.next_in_index+=c,s.total_in+=c,c)},flush_pending(){let t=this,e=t.dstate.pending;e>t.avail_out&&(e=t.avail_out),e!==0&&(t.next_out.set(t.dstate.pending_buf.subarray(t.dstate.pending_out,t.dstate.pending_out+e),t.next_out_index),t.next_out_index+=e,t.dstate.pending_out+=e,t.total_out+=e,t.avail_out-=e,t.dstate.pending-=e,t.dstate.pending===0&&(t.dstate.pending_out=0))}};function Du(t){let e=this,r=new Nu,s=nv(t&&t.chunkSize?t.chunkSize:64*1024),c=0,f=new Uint8Array(s),i=t?t.level:-1;typeof i>"u"&&(i=-1),r.deflateInit(i),r.next_out=f,e.append=function(d,n){let o,a,l=0,u=0,h=0,p=[];if(d.length){r.next_in_index=0,r.next_in=d,r.avail_in=d.length;do{if(r.next_out_index=0,r.avail_out=s,o=r.deflate(c),o!=0)throw new Error("deflating: "+r.msg);r.next_out_index&&(r.next_out_index==s?p.push(new Uint8Array(f)):p.push(f.subarray(0,r.next_out_index))),h+=r.next_out_index,n&&r.next_in_index>0&&r.next_in_index!=l&&(n(r.next_in_index),l=r.next_in_index)}while(r.avail_in>0||r.avail_out===0);return p.length>1?(a=new Uint8Array(h),p.forEach(function(g){a.set(g,u),u+=g.length})):a=p[0]?new Uint8Array(p[0]):new Uint8Array,a}},e.flush=function(){let d,n,o=0,a=0,l=[];do{if(r.next_out_index=0,r.avail_out=s,d=r.deflate(4),d!=1&&d!=0)throw new Error("deflating: "+r.msg);s-r.avail_out>0&&l.push(f.slice(0,r.next_out_index)),a+=r.next_out_index}while(r.avail_in>0||r.avail_out===0);return r.deflateEnd(),n=new Uint8Array(a),l.forEach(function(u){n.set(u,o),o+=u.length}),n}}function nv(t){return t+5*(Math.floor(t/16383)+1)}var Jt=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],nd=1440,rv=0,iv=4,ov=9,sv=5,av=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,8
14000,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],lv=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],cv=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],uv=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],dv=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],hv=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Kn=15;function Ys(){let t=this,e,r,s,c,f,i;function d(o,a,l,u,h,p,g,m,y,b,C){let E,w,k,I,L,F,R,M,A,_,O,D,B,P,H;_=0,L=l;do s[o[a+_]]++,_++,L--;while(L!==0);if(s[0]==l)return g[0]=-1,m[0]=0,0;for(M=m[0],F=1;F<=Kn&&s[F]===0;F++);for(R=F,M<F&&(M=F),L=Kn;L!==0&&s[L]===0;L--);for(k=L,M>L&&(M=L),m[0]=M,P=1<<F;F<L;F++,P<<=1)if((P-=s[F])<0)return-3;if((P-=s[L])<0)return-3;for(s[L]+=P,i[1]=F=0,_=1,B=2;--L!==0;)i[B]=F+=s[_],B++,_++;L=0,_=0;do(F=o[a+_])!==0&&(C[i[F]++]=L),_++;while(++L<l);for(l=i[k],i[0]=L=0,_=0,I=-1,D=-M,f[0]=0,O=0,H=0;R<=k;R++)for(E=s[R];E--!==0;){for(;R>D+M;){if(I++,D+=M,H=k-D,H=H>M?M:H,(w=1<<(F=R-D))>E+1&&(w-=E+1,B=R,F<H))for(;++F<H&&!((w<<=1)<=s[++B]);)w-=s[B];if(H=1<<F,b[0]+H>nd)return-3;f[I]=O=b[0],b[0]+=H,I!==0?(i[I]=L,c[0]=F,c[1]=M,F=L>>>D-M,c[2]=O-f[I-1]-F,y.set(c,(f[I-1]+F)*3)):g[0]=O}for(c[1]=R-D,_>=l?c[0]=192:C[_]<u?(c[0]=C[_]<256?0:96,c[2]=C[_++]):(c[0]=p[C[_]-u]+16+64,c[2]=h[C[_++]-u]),w=1<<R-D,F=L>>>D;F<H;F+=w)y.set(c,(O+F)*3);for(F=1<<R-1;(L&F)!==0;F>>>=1)L^=F;for(L^=F,A=(1<<D)-1;(L&A)!=i[I];)I--,D-=M,A=(1<<D)-1}return P!==0&&k!=1?-5:0}function n(o){let a;for(e||(e=[],r=[],s=new Int32Array(Kn+1),c=[],f=new Int32Array(Kn),i=new Int32Array(Kn+1)),r.length<o&&(r=[]),a=0;a<o;a++)r[a]=0;for(a=0;a<Kn+1;a++)s[a]=0;for(a=0;a<3;a++)c[a]=0;f.set(s.subarray(0,Kn),0),i.set(s.subarray(0,Kn+1),0)}t.inflate_trees_bits=function(o,a,l,u,h){let p;return n(19),e[0]=0,p=d(o,0,19,19,null,null,l,a,u,e,r),p==-3?h.msg="oversubscribed dynamic bit lengths tree":(p==-5||a[0]===0)&&(h.msg="incomplete dynamic bit lengths tree",p=-3),p},t.inflate_trees_dynamic=function(o,a,l,u,h,p,g,m,y){let b;return n(288),e[0]=0,b=d(l,0,o,257,cv,uv,p,u,m,e,r),b!=0||u[0]===0?(b==-3?y.msg="oversubscribed literal/length tree":b!=-4&&(y.msg="incomplete literal/length tree",b=-3),b):(n(288),b=d(l,o,a,0,dv,hv,g,h,m,e,r),b!=0||h[0]===0&&o>257?(b==-3?y.msg="oversubscribed distance tree":b==-5?(y.msg="incomplete distance tree",b=-3):b!=-4&&(y.msg="empty distance tree with lengths",b=-3),b):0)}}Ys.inflate_trees_fixed=function(t,e,r,s){return t[0]=ov,e[0]=sv,r[0]=av,s[0]=lv,0};var Yi=0,Fu=1,Pu=2,Bu=3,Hu=4,Uu=5,Wu=6,Gs=7,zu=8,Zi=9;function fv(){let t=this,e,r=0,s,c=0,f=0,i=0,d=0,n=0,o=0,a=0,l,u=0,h,p=0;function g(m,y,b,C,E,w,k,I){let L,F,R,M,A,_,O,D,B,P,H,W,K,G,X,Z;O=I.next_in_index,D=I.avail_in,A=k.bitb,_=k.bitk,B=k.write,P=B<k.read?k.read-B-1:k.end-B,H=Jt[m],W=Jt[y];do{for(;_<20;)D--,A|=(I.read_byte(O++)&255)<<_,_+=8;if(L=A&H,F=b,R=C,Z=(R+L)*3,(M=F[Z])===0){A>>=F[Z+1],_-=F[Z+1],k.win[B++]=F[Z+2],P--;continue}do{if(A>>=F[Z+1],_-=F[Z+1],(M&16)!==0){for(M&=15,K=F[Z+2]+(A&Jt[M]),A>>=M,_-=M;_<15;)D--,A|=(I.read_byte(O++)&255)<<_,_+=8;L=A&W,F=E,R=w,Z=(R+L)*3,M=F[Z];do if(A>>=F[Z+1],_-=F[Z+1],(M&16)!==0){for(M&=15;_<M;)D--,A|=(I.read_byte(O++)&255)<<_,_+=8;if(G=F[Z+2]+(A&Jt[M]),A>>=M,_-=M,P-=K,B>=G)X=B-G,B-X>0&&2>B-X?(k.win[B++]=k.win[X++],k.win[B++]=k.win[X++],K-=2):(k.win.set(k.win.subarray(X,X+2),B),B+=2,X+=2,K-=2);else{X=B-G;do X+=k.end;while(X<0);if(M=k.end-X,K>M){if(K-=M,B-X>0&&M>B-X)do k.win[B++]=k.win[X++];while(--M!==0);else k.win.set(k.win.subarray(X,X+M),B),B+=M,X+=M,M=0;X=0}}if(B-X>0&&K>B-X)do k.win[B++]=k.win[X++];while(--K!==0);else k.win.set(k.win.subarray(X,X+K),B),B+=K,X+=K,K=0;break}else if((M&64)===0)L+=F[Z+2],L+=A&Jt[M],Z=(R+L)*3,M=F[Z];else return I.msg="invalid distance code",K=I.avail_in-D,K=_>>3<K?_>>3:K,D+=K,O-=K,_-=K<<3,k.bitb=A,k.bitk=_,I.avail_in=D,I.total_in+=O-I.next_in_index,I.next_in_index=O,k.write=B,-3;while(!0);break}if((M&64)===0){if(L+=F[Z+2],L+=A&Jt[M],Z=(R+L)*3,(M=F[Z])===0){A>>=F[Z+1],_-=F[Z+1],k.win[B++]=F[Z+2],P--;break}}else return(M&32)!==0?(K=I.avail_in-D,K=_>>3<K?_>>3:K,D+=K,O-=K,_-=K<<3,k.bitb=A,k.bitk=_,I.avail_in=D,I.total_in+=O-I.next_in_index,I.next_in_index=O,k.write=B,1):(I.msg="invalid literal/length code",K=I.avail_in-D,K=_>>3<K?_>>3:K,D+=K,O-=K,_-=K<<3,k.bitb=A,k.bitk=_,I.avail_in=D,I.total_in+=O-I.next_in_index,I.next_in_index=O,k.write=B,-3)}while(!0)}while(P>=258&&D>=10);return K=I.avail_in-D,K=_>>3<K?_>>3:K,D+=K,O-=K,_-=K<<3,k.bitb=A,k.bitk=_,I.avail_in=D,I.total_in+=O-I.next_in_index,I.next_in_index=O,k.write=B,0}t.init=function(m,y,b,C,E,w){e=Yi,o=m,a=y,l=b,u=C,h=E,p=w,s=null}
1400,t.proc=function(m,y,b){let C,E,w,k=0,I=0,L=0,F,R,M,A;for(L=y.next_in_index,F=y.avail_in,k=m.bitb,I=m.bitk,R=m.write,M=R<m.read?m.read-R-1:m.end-R;;)switch(e){case Yi:if(M>=258&&F>=10&&(m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,b=g(o,a,l,u,h,p,m,y),L=y.next_in_index,F=y.avail_in,k=m.bitb,I=m.bitk,R=m.write,M=R<m.read?m.read-R-1:m.end-R,b!=0)){e=b==1?Gs:Zi;break}f=o,s=l,c=u,e=Fu;case Fu:for(C=f;I<C;){if(F!==0)b=0;else return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);F--,k|=(y.read_byte(L++)&255)<<I,I+=8}if(E=(c+(k&Jt[C]))*3,k>>>=s[E+1],I-=s[E+1],w=s[E],w===0){i=s[E+2],e=Wu;break}if((w&16)!==0){d=w&15,r=s[E+2],e=Pu;break}if((w&64)===0){f=w,c=E/3+s[E+2];break}if((w&32)!==0){e=Gs;break}return e=Zi,y.msg="invalid literal/length code",b=-3,m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);case Pu:for(C=d;I<C;){if(F!==0)b=0;else return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);F--,k|=(y.read_byte(L++)&255)<<I,I+=8}r+=k&Jt[C],k>>=C,I-=C,f=a,s=h,c=p,e=Bu;case Bu:for(C=f;I<C;){if(F!==0)b=0;else return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);F--,k|=(y.read_byte(L++)&255)<<I,I+=8}if(E=(c+(k&Jt[C]))*3,k>>=s[E+1],I-=s[E+1],w=s[E],(w&16)!==0){d=w&15,n=s[E+2],e=Hu;break}if((w&64)===0){f=w,c=E/3+s[E+2];break}return e=Zi,y.msg="invalid distance code",b=-3,m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);case Hu:for(C=d;I<C;){if(F!==0)b=0;else return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);F--,k|=(y.read_byte(L++)&255)<<I,I+=8}n+=k&Jt[C],k>>=C,I-=C,e=Uu;case Uu:for(A=R-n;A<0;)A+=m.end;for(;r!==0;){if(M===0&&(R==m.end&&m.read!==0&&(R=0,M=R<m.read?m.read-R-1:m.end-R),M===0&&(m.write=R,b=m.inflate_flush(y,b),R=m.write,M=R<m.read?m.read-R-1:m.end-R,R==m.end&&m.read!==0&&(R=0,M=R<m.read?m.read-R-1:m.end-R),M===0)))return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);m.win[R++]=m.win[A++],M--,A==m.end&&(A=0),r--}e=Yi;break;case Wu:if(M===0&&(R==m.end&&m.read!==0&&(R=0,M=R<m.read?m.read-R-1:m.end-R),M===0&&(m.write=R,b=m.inflate_flush(y,b),R=m.write,M=R<m.read?m.read-R-1:m.end-R,R==m.end&&m.read!==0&&(R=0,M=R<m.read?m.read-R-1:m.end-R),M===0)))return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);b=0,m.win[R++]=i,M--,e=Yi;break;case Gs:if(I>7&&(I-=8,F++,L--),m.write=R,b=m.inflate_flush(y,b),R=m.write,M=R<m.read?m.read-R-1:m.end-R,m.read!=m.write)return m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);e=zu;case zu:return b=1,m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);case Zi:return b=-3,m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b);default:return b=-2,m.bitb=k,m.bitk=I,y.avail_in=F,y.total_in+=L-y.next_in_index,y.next_in_index=L,m.write=R,m.inflate_flush(y,b)}},t.free=function(){}}var ju=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Er=0,Vs=1,Gu=2,Vu=3,Ku=4,Yu=5,Xi=6,qi=7,Zu=8,dr=9;function pv(t,e){let r=this,s=Er,c=0,f=0,i=0,d,n=[0],o=[0],a=new fv,l=0,u=new Int32Array(nd*3),h=0,p=new Ys;r.bitk=0,r.bitb=0,r.win=new Uint8Array(e),r.end=e,r.read=0,r.write=0,r.reset=function(g,m){m&&(m[0]=h),s==Xi&&a.free(g),s=Er,r.bitk=0,r.bitb=0,r.read=r.write=0},r.reset(t,null),r.inflate_flush=function(g,m){let y,b,C;return b=g.next_out_index,C=r.read,y=(C<=r.write?r.write:r.end)-C,y>g.avail_out&&(y=g.avail_out),y!==0&&m==-5&&(m=0),g.avail_out-=y,g.total_out+=y,g.next_out.set(r.win.subarray(C,C+y),b),b+=y,C+=y,C==r.end&&(C=0,r.write==r.end&&(r.write=0),y=r.write-C,y>g.avail_out&&(y=g.avail_out),y!==0&&m==-5&&(m=0),g.avail_out-=y,g.total_out+=y,g.next_out.set(r.win.subarray(C,C+y),b),b+=y,C+=y),g.next_out_index=b,r.read=C,m},r.proc=function(g,m){let y,b,C,E,w,k,I,L;for(E=g.next_in_index,w=g.avail_in,b=r.bitb,C=r.bitk,k=r.write,I=k<r.read?r.read-k-1:r.end-k;;){let F,R,M,A,_,O,D,B;switch(s){case Er:for(;C<3;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}switch(y=b&7,l=y&1,y>>>1){case 0:b>>>=3,C-=3,y=C&7,b>>>=y,C-=y,s=Vs;break;case 1:F=[],R=[],M=[[]],A=[[]],Ys.inflate_trees_fixed(F,R,M,A),a.init(F[0],R[0],M[0],0,A[0],0),b>>>=3,C-=3,s=Xi;break;case 2:b>>>=3,C-=3,s=Vu;break;case 3:return b>>>=3,C-=3,s=dr,g.msg="invalid block type",m=-3,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m)}
1400break;case Vs:for(;C<32;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}if((~b>>>16&65535)!=(b&65535))return s=dr,g.msg="invalid stored block lengths",m=-3,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);c=b&65535,b=C=0,s=c!==0?Gu:l!==0?qi:Er;break;case Gu:if(w===0||I===0&&(k==r.end&&r.read!==0&&(k=0,I=k<r.read?r.read-k-1:r.end-k),I===0&&(r.write=k,m=r.inflate_flush(g,m),k=r.write,I=k<r.read?r.read-k-1:r.end-k,k==r.end&&r.read!==0&&(k=0,I=k<r.read?r.read-k-1:r.end-k),I===0)))return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);if(m=0,y=c,y>w&&(y=w),y>I&&(y=I),r.win.set(g.read_buf(E,y),k),E+=y,w-=y,k+=y,I-=y,(c-=y)!==0)break;s=l!==0?qi:Er;break;case Vu:for(;C<14;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}if(f=y=b&16383,(y&31)>29||(y>>5&31)>29)return s=dr,g.msg="too many length or distance symbols",m=-3,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);if(y=258+(y&31)+(y>>5&31),!d||d.length<y)d=[];else for(L=0;L<y;L++)d[L]=0;b>>>=14,C-=14,i=0,s=Ku;case Ku:for(;i<4+(f>>>10);){for(;C<3;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}d[ju[i++]]=b&7,b>>>=3,C-=3}for(;i<19;)d[ju[i++]]=0;if(n[0]=7,y=p.inflate_trees_bits(d,n,o,u,g),y!=0)return m=y,m==-3&&(d=null,s=dr),r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);i=0,s=Yu;case Yu:for(;y=f,!(i>=258+(y&31)+(y>>5&31));){let P,H;for(y=n[0];C<y;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}if(y=u[(o[0]+(b&Jt[y]))*3+1],H=u[(o[0]+(b&Jt[y]))*3+2],H<16)b>>>=y,C-=y,d[i++]=H;else{for(L=H==18?7:H-14,P=H==18?11:3;C<y+L;){if(w!==0)m=0;else return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);w--,b|=(g.read_byte(E++)&255)<<C,C+=8}if(b>>>=y,C-=y,P+=b&Jt[L],b>>>=L,C-=L,L=i,y=f,L+P>258+(y&31)+(y>>5&31)||H==16&&L<1)return d=null,s=dr,g.msg="invalid bit length repeat",m=-3,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);H=H==16?d[L-1]:0;do d[L++]=H;while(--P!==0);i=L}}if(o[0]=-1,_=[],O=[],D=[],B=[],_[0]=9,O[0]=6,y=f,y=p.inflate_trees_dynamic(257+(y&31),1+(y>>5&31),d,_,O,D,B,u,g),y!=0)return y==-3&&(d=null,s=dr),m=y,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);a.init(_[0],O[0],u,D[0],u,B[0]),s=Xi;case Xi:if(r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,(m=a.proc(r,g,m))!=1)return r.inflate_flush(g,m);if(m=0,a.free(g),E=g.next_in_index,w=g.avail_in,b=r.bitb,C=r.bitk,k=r.write,I=k<r.read?r.read-k-1:r.end-k,l===0){s=Er;break}s=qi;case qi:if(r.write=k,m=r.inflate_flush(g,m),k=r.write,I=k<r.read?r.read-k-1:r.end-k,r.read!=r.write)return r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);s=Zu;case Zu:return m=1,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);case dr:return m=-3,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m);default:return m=-2,r.bitb=b,r.bitk=C,g.avail_in=w,g.total_in+=E-g.next_in_index,g.next_in_index=E,r.write=k,r.inflate_flush(g,m)}}},r.free=function(g){r.reset(g,null),r.win=null,u=null},r.set_dictionary=function(g,m,y){r.win.set(g.subarray(m,m+y),0),r.read=r.write=y},r.sync_point=function(){return s==Vs?1:0}}var gv=32,mv=8,vv=0,Xu=1,qu=2,Ju=3,Qu=4,ed=5,Ks=6,Xr=7,td=12,Yn=13,yv=[0,0,255,255];function bv(){let t=this;t.mode=0,t.method=0,t.was=[0],t.need=0,t.marker=0,t.wbits=0;function e(r){return!r||!r.istate?-2:(r.total_in=r.total_out=0,r.msg=null,r.istate.mode=Xr,r.istate.blocks.reset(r,null),0)}t.inflateEnd=function(r){return t.blocks&&t.blocks.free(r),t.blocks=null,0},t.inflateInit=function(r,s){return r.msg=null,t.blocks=null,s<8||s>15?(t.inflateEnd(r),-2):(t.wbits=s,r.istate.blocks=new pv(r,1<<s),e(r),0)},t.inflate=function(r,s){let c,f;if(!r||!r.istate||!r.next_in)return-2;let i=r.istate;for(s=s==iv?-5:0,c=-5;;)switch(i.mode){case vv:if(r.avail_in===0)return c;if(c=s,r.avail_in--,r.total_in++,((i.method=r.read_byte(r.next_in_index++))&15)!=mv){i.mode=Yn,r.msg="unknown compression method",i.marker=5;break}if((i.method>>4)+8>i.wbits){i.mode=Yn,r.msg="invalid win size",i.marker=5;break}i.mode=Xu;case Xu:if(r.avail_in===0)return c;if(c=s,r.avail_in--,r.total_in++,f=r.read_byte(r.next_in_index++)&255,((i.method<<8)+f)%31!==0){i.mode=Yn,r.msg="incorrect header check",i.marker=5;break}if((f&gv)===0){i.mode=Xr;break}i.mode=qu;case qu:if(r.avail_in===0)return c;c=s,r.avail_in--,r.total_in++,i.need=(r.read_byte(r.next_in_index++)&255)<<24&4278190080,i.mode=Ju;case Ju:if(r.avail_in===0)return c;c=s,r.avail_in--,r.total_in++,i.need+=(r.read_byte(r.next_in_index++)&255)<<16&16711680,i.mode=Qu;
1400case Qu:if(r.avail_in===0)return c;c=s,r.avail_in--,r.total_in++,i.need+=(r.read_byte(r.next_in_index++)&255)<<8&65280,i.mode=ed;case ed:return r.avail_in===0?c:(c=s,r.avail_in--,r.total_in++,i.need+=r.read_byte(r.next_in_index++)&255,i.mode=Ks,2);case Ks:return i.mode=Yn,r.msg="need dictionary",i.marker=0,-2;case Xr:if(c=i.blocks.proc(r,c),c==-3){i.mode=Yn,i.marker=0;break}if(c==0&&(c=s),c!=1)return c;c=s,i.blocks.reset(r,i.was),i.mode=td;case td:return r.avail_in=0,1;case Yn:return-3;default:return-2}},t.inflateSetDictionary=function(r,s,c){let f=0,i=c;if(!r||!r.istate||r.istate.mode!=Ks)return-2;let d=r.istate;return i>=1<<d.wbits&&(i=(1<<d.wbits)-1,f=c-i),d.blocks.set_dictionary(s,f,i),d.mode=Xr,0},t.inflateSync=function(r){let s,c,f,i,d;if(!r||!r.istate)return-2;let n=r.istate;if(n.mode!=Yn&&(n.mode=Yn,n.marker=0),(s=r.avail_in)===0)return-5;for(c=r.next_in_index,f=n.marker;s!==0&&f<4;)r.read_byte(c)==yv[f]?f++:r.read_byte(c)!==0?f=0:f=4-f,c++,s--;return r.total_in+=c-r.next_in_index,r.next_in_index=c,r.avail_in=s,n.marker=f,f!=4?-3:(i=r.total_in,d=r.total_out,e(r),r.total_in=i,r.total_out=d,n.mode=Xr,0)},t.inflateSyncPoint=function(r){return!r||!r.istate||!r.istate.blocks?-2:r.istate.blocks.sync_point()}}function rd(){}rd.prototype={inflateInit(t){let e=this;return e.istate=new bv,t||(t=15),e.istate.inflateInit(e,t)},inflate(t){let e=this;return e.istate?e.istate.inflate(e,t):-2},inflateEnd(){let t=this;if(!t.istate)return-2;let e=t.istate.inflateEnd(t);return t.istate=null,e},inflateSync(){let t=this;return t.istate?t.istate.inflateSync(t):-2},inflateSetDictionary(t,e){let r=this;return r.istate?r.istate.inflateSetDictionary(r,t,e):-2},read_byte(t){return this.next_in[t]},read_buf(t,e){return this.next_in.subarray(t,t+e)}};function id(t){let e=this,r=new rd,s=t&&t.chunkSize?Math.floor(t.chunkSize*2):128*1024,c=rv,f=new Uint8Array(s),i=!1;r.inflateInit(),r.next_out=f,e.append=function(d,n){let o=[],a,l,u=0,h=0,p=0;if(d.length!==0){r.next_in_index=0,r.next_in=d,r.avail_in=d.length;do{if(r.next_out_index=0,r.avail_out=s,r.avail_in===0&&!i&&(r.next_in_index=0,i=!0),a=r.inflate(c),i&&a===-5){if(r.avail_in!==0)throw new Error("inflating: bad input")}else if(a!==0&&a!==1)throw new Error("inflating: "+r.msg);if((i||a===1)&&r.avail_in===d.length)throw new Error("inflating: bad input");r.next_out_index&&(r.next_out_index===s?o.push(new Uint8Array(f)):o.push(f.subarray(0,r.next_out_index))),p+=r.next_out_index,n&&r.next_in_index>0&&r.next_in_index!=u&&(n(r.next_in_index),u=r.next_in_index)}while(r.avail_in>0||r.avail_out===0);return o.length>1?(l=new Uint8Array(p),o.forEach(function(g){l.set(g,h),h+=g.length})):l=o[0]?new Uint8Array(o[0]):new Uint8Array,l}},e.flush=function(){r.inflateEnd()}}var hr="/",Zs=new Date(2107,11,31),Xs=new Date(1980,0,1),Oe=void 0,Qt="undefined",Tn="function";var qr=class{constructor(e){return class extends TransformStream{constructor(r,s){let c=new e(s);super({transform(f,i){i.enqueue(c.append(f))},flush(f){let i=c.flush();i&&f.enqueue(i)}})}}}};var wv=64,od=2;try{typeof navigator!=Qt&&navigator.hardwareConcurrency&&(od=navigator.hardwareConcurrency)}catch{}var xv={chunkSize:512*1024,maxWorkers:od,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:Oe,CompressionStreamNative:typeof CompressionStream!=Qt&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=Qt&&DecompressionStream},Xn=Object.assign({},xv);function Jr(){return Xn}function Ji(t){return Math.max(t.chunkSize,wv)}function Cr(t){let{baseURL:e,chunkSize:r,maxWorkers:s,terminateWorkerTimeout:c,useCompressionStream:f,useWebWorkers:i,Deflate:d,Inflate:n,CompressionStream:o,DecompressionStream:a,workerScripts:l}=t;if(Zn("baseURL",e),Zn("chunkSize",r),Zn("maxWorkers",s),Zn("terminateWorkerTimeout",c),Zn("useCompressionStream",f),Zn("useWebWorkers",i),d&&(Xn.CompressionStream=new qr(d)),n&&(Xn.DecompressionStream=new qr(n)),Zn("CompressionStream",o),Zn("DecompressionStream",a),l!==Oe){let{deflate:u,inflate:h}=l;if((u||h)&&(Xn.workerScripts||(Xn.workerScripts={})),u){if(!Array.isArray(u))throw new Error("workerScripts.deflate must be an array");Xn.workerScripts.deflate=u}
1400if(h){if(!Array.isArray(h))throw new Error("workerScripts.inflate must be an array");Xn.workerScripts.inflate=h}}}function Zn(t,e){e!==Oe&&(Xn[t]=e)}var qs={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin","cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot","wiz"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf","xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","xpdl"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot","ppa","pwz"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":["odm","otm"],"vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw","vsdx","vssx","vstx","vssm","vstm"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-director":["dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-latex":"latex","x-lyx":"lyx","x-lzx":"lzx","x-maker":["frm","fb","fbdoc"],"x-ms-wmd":"wmd","x-msdos-program":["com","exe","bat","dll"],"x-netcdf":["nc"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager"
vendor: 14,507 bytes, line 1400
1400:["rpm","rpa"],"x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":["mathml","mml"],mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","application/x-ms-installer":"msi","x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-perfmon":["pma","pmc","pmr","pmw"],"ynd.ms-pkipko":"pko",gzip:["gz","tgz"],"smil+xml":["smi","smil"],"vnd.debian.binary-package":["deb","udeb"],"vnd.hzn-3d-crossword":"x3d","vnd.sqlite3":["db","sqlite","sqlite3","db-wal","sqlite-wal","db-shm","sqlite-shm"],"vnd.wap.sic":"sic","vnd.wap.slc":"slc","x-krita":["kra","krz"],"x-perl":["pm","pl"],yaml:["yaml","yml"]},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":"aifc","x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",aac:"aac",aiff:["aiff","aif","aff"],opus:"opus",wav:"wav"},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input"
vendor: 12,502 bytes, line 1400
1400:"mmod","x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":"sd","x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":"val","x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},font:{otf:"otf",woff:"woff",woff2:"woff2"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe","jfif","jfif-tbnl","jif"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",avif:"avifs",heic:["heif","heic"],pjpeg:["pjpg"],"vnd.adobe.photoshop":"psd","x-adobe-dng":"dng","x-fuji-raf":"raf","x-icns":"icns","x-kodak-dcr":"dcr","x-kodak-k25":"k25","x-kodak-kdc":"kdc","x-minolta-mrw":"mrw","x-panasonic-raw":["raw","rw2","rwl"],"x-pentax-pef":["pef","ptx"],"x-sigma-x3f":"x3f","x-sony-arw":"arw","x-sony-sr2":"sr2","x-sony-srf":"srf"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":"x3dz","x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.usdz+zip":"usdz","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",plain:["txt","text","brf","conf","def","list","log","in","bas","diff","ksh"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:"tm","tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":"patch","x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas","pp","inc"],"x-pcs-gcd":"gcd","x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","h","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt",javascript:"js",json:"json",markdown:["md","markdown","mdown","markdn"],"vnd.wap.si":"si","vnd.wap.sl":"sl"},video:{avif:"avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv",mp2t:"ts"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","flr","wrz","xaf","xof"]}},zS=(()=>{let t={};for(let e of Object.keys(qs))for(let r of Object.keys(qs[e])){let s=qs[e][r];if(typeof s=="string")t[s]=e+"/"+r;else for(let c=0;c<s.length;c++)t[s[c]]=e+"/"+r}return t})();var sd=[];for(let t=0;t<256;t++){let e=t;for(let r=0;r<8;r++)e&1?e=e>>>1^3988292384:e=e>>>1;sd[t]=e}var Nn=class{constructor(e){this.crc=e||-1}append(e){let r=this.crc|0;for(let s=0,c=e.length|0;s<c;s++)r=r>>>8^sd[(r^e[s])&255];this.crc=r}get(){return~this.crc}};var Qr=class extends TransformStream{constructor(){let e,r=new Nn;super({transform(s,c){r.append(s),c.enqueue(s)},flush(){let s=new Uint8Array(4);new DataView(s.buffer).setUint32(0,r.get()),e.value=s}}),e=this}};function _r(t){if(typeof TextEncoder==Qt){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return e}else return new TextEncoder().encode(t)}var zt={concat(t,e){if(t.length===0||e.length===0)return t.concat(e);let r=t[t.length-1],s=zt.getPartial(r);return s===32?t.concat(e):zt._shiftRight(e,s,r|0,t.slice(0,t.length-1))},bitLength(t){let e=t.length;if(e===0)return 0;let r=t[e-1];return(e-1)*32+zt.getPartial(r)},clamp(t,e){if(t.length*32<e)return t;t=t.slice(0,Math.ceil(e/32));let r=t.length;return e=e&31,r>0&&e&&(t[r-1]=zt.partial(e,t[r-1]&2147483648>>e-1,1)),t},partial(t,e,r){return t===32?e:(r?e|0:e<<32-t)+t*1099511627776},getPartial(t){return Math.round(t/1099511627776)||32},_shiftRight(t,e,r,s){for(s===void 0&&(s=[]);e>=32;e-=32)s.push(r),r=0;if(e===0)return s.concat(t);for(let i=0;i<t.length;i++)s.push(r|t[i]>>>e),r=t[i]<<32-e;let c=t.length?t[t.length-1]:0,f=zt.getPartial(c);return s.push(zt.partial(e+f&31,e+f>32?r:s.pop(),1)),s}},ei={bytes:{fromBits(t){let r=zt.bitLength(t)/8,s=new Uint8Array(r),c;for(let f=0;f<r;f++)(f&3)===0&&(c=t[f/4]),s[f]=c>>>24,c<<=8;return s},toBits(t){let e=[],r,s=0;for(r=0;r<t.length;r++)s=s<<8|t[r],(r&3)===3&&(e.push(s),s=0);return r&3&&e.push(zt.partial(8*(r&3),s)),e}}},ad={};ad.sha1=class{constructor(t){let e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],t?(e._h=t._h.slice(0),e._buffer=t._buffer.slice(0),e._length=t._length):e.reset()}reset(){let t=this;return t._h=t._init.slice(0),t._buffer=[],t._length=0,t}update(t){let e=this;typeof t=="string"&&(t=ei.utf8String.toBits(t));let r=e._buffer=zt.concat(e._buffer,t),s=e._length,c=e._length=s+zt.bitLength(t);if(c>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");let f=new Uint32Array(r),i=0;for(let d=e.blockSize+s-(e.blockSize+s&e.blockSize-1);d<=c;d+=e.blockSize)e._block(f.subarray(16*i,16*(i+1))),i+=1;return r.splice(0,16*i),e}finalize(){let t=this,e=t._buffer,r=t._h;e=zt.concat(e,[zt.partial(1,1)]);for(let s=e.length+2;s&15;s++)e.push(0);for(e.push(Math.floor(t._length/4294967296)),e.push(t._length|0);e.length;)t._block(e.splice(0,16));return t.reset(),r}_f(t,e,r,s){if(t<=19)return e&r|~e&s;if(t<=39)return e^r^s;if(t<=59)return e&r|e&s|r&s;if(t<=79)return e^r^s}_S(t,e){return e<<t|e>>>32-t}_block(t){let e=this,r=e._h,s=Array(80);for(let o=0;o<16;o++)s[o]=t[o];let c=r[0],f=r[1],i=r[2],d=r[3],n=r[4];for(let o=0;o<=79;o++){o>=16&&(s[o]=e._S(1,s[o-3]^s[o-8]^s[o-14]^s[o-16]));let a=e._S(5,c)+e._f(o,f,i,d)+n+s[o]+e._key[Math.floor(o/20)]|0;n=d,d=i,i=e._S(30,f),f=c,c=a}r[0]=r[0]+c|0,r[1]=r[1]+f|0,r[2]=r[2]+i|0,r[3]=r[3]+d|0,r[4]=r[4]+n|0}};var Js={};Js.aes=class{constructor(t){let e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();let r=e._tables[0][4],s=e._tables[1],c=t.length,f,i,d,n=1;if(c!==4&&c!==6&&c!==8)throw new Error("invalid aes key size");for(e._key=[i=t.slice(0),d=[]],f=c;f<4*c+28;f++){let o=i[f-1];(f%c===0||c===8&&f%c===4)&&(o=r[o>>>24]<<24^r[o>>16&255]<<16^r[o>>8&255]<<8^r[o&255],f%c===0&&(o=o<<8^o>>>24^n<<24,n=n<<1^(n>>7)*283)),i[f]=i[f-c]^o}for(let o=0;f;o++,f--){let a=i[o&3?f:f-4];f<=4||o<4?d[o]=a:d[o]=s[0][r[a>>>24]]^s[1][r[a>>16&255]]^s[2][r[a>>8&255]]^s[3][r[a&255]]}}encrypt(t){return this._crypt(t,0)}decrypt(t){return this._crypt(t,1)}_precompute(){let t=this._tables[0],e=this._tables[1],r=t[4],s=e[4],c=[],f=[],i,d,n,o;for(let a=0;a<256;a++)f[(c[a]=a<<1^(a>>7)*283)^a]=a;for(let a=i=0;!r[a];a^=d||1,i=f[i]||1){let l=i^i<<1^i<<2^i<<3^i<<4;l=l>>8^l&255^99,r[a]=l,s[l]=a,o=c[n=c[d=c[a]]];let u=o*16843009^n*65537^d*257^a*16843008,h=c[l]*257^l*16843008;for(let p=0;p<4;p++)t[p][a]=h=h<<24^h>>>8,e[p][l]=u=u<<24^u>>>8}for(let a=0;a<5;a++)t[a]=t[a].slice(0),e[a]=e[a].slice(0)}_crypt(t,e){if(t.length!==4)throw new Error("invalid aes block size");let r=this._key[e],s=r.length/4-2,c=[0,0,0,0],f=this._tables[e],i=f[0],d=f[1],n=f[2],o=f[3],a=f[4],l=t[0]^r[0],u=t[e?3:1]^r[1],h=t[2]^r[2],p=t[e?1:3]^r[3],g=4,m,y,b;for(let C=0;C<s;C++)m=i[l>>>24]^d[u>>16&255]^n[h>>8&255]^o[p&255]^r[g],y=i[u>>>24]^d[h>>16&255]^n[p>>8&255]^o[l&255]^r[g+1],b=i[h>>>24]^d[p>>16&255]^n[l>>8&255]^o[u&255]^r[g+2],p=i[p>>>24]^d[l>>16&255]^n[u>>8&255]^o[h&255]^r[g+3],g+=4,l=m,u=y,h=b;for(let C=0;C<4;C++)c[e?3&-C:C]=a[l>>>24]<<24^a[u>>16&255]<<16^a[h>>8&255]<<8^a[p&255]^r[g++],m=l,l=u,u=h,h=p,p=m;return c}};var ld={getRandomValues(t){let e=new Uint32Array(t.buffer),r=s=>{let c=987654321,f=4294967295;return function(){return c=36969*(c&65535)+(c>>16)&f,s=18e3*(s&65535)+(s>>16)&f,(((c<<16)+s&f)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let s=0,c;s<t.length;s+=4){let f=r((c||Math.random())*4294967296);c=f()*987654071,e[s/4]=f()*4294967296|0}return t}},Qs={};Qs.ctrGladman=class{constructor(t,e){this._prf=t,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(t){return this.calculate(this._prf,t,this._iv)}incWord(t){if((t>>24&255)===255){let e=t>>16&255,r=t>>8&255,s=t&255;e===255?(e=0,r===255?(r=0,s===255?s=0:++s):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=s}else t+=1<<24;return t}incCounter(t){(t[0]=this.incWord(t[0]))===0&&(t[1]=this.incWord(t[1]))}calculate(t,e,r){let s;if(!(s=e.length))return[];let c=zt.bitLength(e);for(let f=0;f<s;f+=4){this.incCounter(r);let i=t.encrypt(r);e[f]^=i[0],e[f+1]^=i[1],e[f+2]^=i[2],e[f+3]^=i[3]}return zt.clamp(e,c)}};var qn={importKey(t){return new qn.hmacSha1(ei.bytes.toBits(t))},pbkdf2(t,e,r,s){if(r=r||1e4,s<0||r<0)throw new Error("invalid params to pbkdf2");let c=(s>>5)+1<<2,f,i,d,n,o,a=new ArrayBuffer(c),l=new DataView(a),u=0,h=zt;for(e=ei.bytes.toBits(e),o=1;u<(c||1);o++){for(f=i=t.encrypt(h.concat(e,[o])),d=1;d<r;d++)for(i=t.encrypt(i),n=0;n<i.length;n++)f[n]^=i[n];for(d=0;u<(c||1)&&d<f.length;d++)l.setInt32(u,f[d]),u+=4}return a.slice(0,s/8)}};qn.hmacSha1=class{constructor(t){let e=this,r=e._hash=ad.sha1,s=[[],[]];e._baseHash=[new r,new r];let c=e._baseHash[0].blockSize/32;t.length>c&&(t=new r().update(t).finalize());for(let f=0;f<c;f++)s[0][f]=t[f]^909522486,s[1][f]=t[f]^1549556828;e._baseHash[0].update(s[0]),e._baseHash[1].update(s[1]),e._resultHash=new r(e._baseHash[0])}reset(){let t=this;t._resultHash=new t._hash(t._baseHash[0]),t._updated=!1}update(t){let e=this;e._updated=!0,e._resultHash.update(t)}digest(){let t=this,e=t._resultHash.finalize(),r=new t._hash(t._baseHash[1]).update(e).finalize();return t.reset(),r}encrypt(t){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}};var Ev=typeof crypto!=Qt&&typeof crypto.getRandomValues==Tn,kn="Invalid password",Jn="Invalid signature",Dn="zipjs-abort-check-password";function Qi(t){return Ev?crypto.getRandomValues(t):ld.getRandomValues(t)}var Ar=16,Cv="raw",dd={name:"PBKDF2"},_v={name:"HMAC"},Av="SHA-1",Tv=Object.assign({hash:_v},dd),ea=Object.assign({iterations:1e3,hash:{name:Av}},dd),kv=["deriveBits"],ni=[8,12,16],ti=[16,24,32],Qn=10,Mv=[0,0,0,0],no=typeof crypto!=Qt,oi=no&&crypto.subtle,hd=no&&typeof oi!=Qt,Mn=ei.bytes,Lv=Js.aes,Rv=Qs.ctrGladman,Iv=q
1400n.hmacSha1,cd=no&&hd&&typeof oi.importKey==Tn,ud=no&&hd&&typeof oi.deriveBits==Tn,eo=class extends TransformStream{constructor({password:e,rawPassword:r,signed:s,encryptionStrength:c,checkPasswordOnly:f}){super({start(){Object.assign(this,{ready:new Promise(i=>this.resolveReady=i),password:gd(e,r),signed:s,strength:c-1,pending:new Uint8Array})},async transform(i,d){let n=this,{password:o,strength:a,resolveReady:l,ready:u}=n;o?(await $v(n,a,o,ln(i,0,ni[a]+2)),i=ln(i,ni[a]+2),f?d.error(new Error(Dn)):l()):await u;let h=new Uint8Array(i.length-Qn-(i.length-Qn)%Ar);d.enqueue(fd(n,i,h,0,Qn,!0))},async flush(i){let{signed:d,ctr:n,hmac:o,pending:a,ready:l}=this;if(o&&n){await l;let u=ln(a,0,a.length-Qn),h=ln(a,a.length-Qn),p=new Uint8Array;if(u.length){let g=ii(Mn,u);o.update(g);let m=n.update(g);p=ri(Mn,m)}if(d){let g=ln(ri(Mn,o.digest()),0,Qn);for(let m=0;m<Qn;m++)if(g[m]!=h[m])throw new Error(Jn)}i.enqueue(p)}}})}},to=class extends TransformStream{constructor({password:e,rawPassword:r,encryptionStrength:s}){let c;super({start(){Object.assign(this,{ready:new Promise(f=>this.resolveReady=f),password:gd(e,r),strength:s-1,pending:new Uint8Array})},async transform(f,i){let d=this,{password:n,strength:o,resolveReady:a,ready:l}=d,u=new Uint8Array;n?(u=await Ov(d,o,n),a()):await l;let h=new Uint8Array(u.length+f.length-f.length%Ar);h.set(u,0),i.enqueue(fd(d,f,h,u.length,0))},async flush(f){let{ctr:i,hmac:d,pending:n,ready:o}=this;if(d&&i){await o;let a=new Uint8Array;
1400if(n.length){let l=i.update(ii(Mn,n));d.update(l),a=ri(Mn,l)}c.signature=ri(Mn,d.digest()).slice(0,Qn),f.enqueue(ta(a,c.signature))}}}),c=this}};function fd(t,e,r,s,c,f){let{ctr:i,hmac:d,pending:n}=t,o=e.length-c;n.length&&(e=ta(n,e),r=Fv(r,o-o%Ar));let a;for(a=0;a<=o-Ar;a+=Ar){let l=ii(Mn,ln(e,a,a+Ar));f&&d.update(l);let u=i.update(l);f||d.update(u),r.set(ri(Mn,u),a+s)}return t.pending=ln(e,a),r}async function $v(t,e,r,s){let c=await pd(t,e,r,ln(s,0,ni[e])),f=ln(s,ni[e]);if(c[0]!=f[0]||c[1]!=f[1])throw new Error(kn)}async function Ov(t,e,r){let s=Qi(new Uint8Array(ni[e])),c=await pd(t,e,r,s);return ta(s,c)}async function pd(t,e,r,s){t.password=null;let c=await Nv(Cv,r,Tv,!1,kv),f=await Dv(Object.assign({salt:s},ea),c,8*(ti[e]*2+2)),i=new Uint8Array(f),d=ii(Mn,ln(i,0,ti[e])),n=ii(Mn,ln(i,ti[e],ti[e]*2)),o=ln(i,ti[e]*2);return Object.assign(t,{keys:{key:d,authentication:n,passwordVerification:o},ctr:new Rv(new Lv(d),Array.from(Mv)),hmac:new Iv(n)}),o}async function Nv(t,e,r,s,c){if(cd)try{return await oi.importKey(t,e,r,s,c)}catch{return cd=!1,qn.importKey(e)}else return qn.importKey(e)}async function Dv(t,e,r){if(ud)try{return await oi.deriveBits(t,e,r)}catch{return ud=!1,qn.pbkdf2(e,t.salt,ea.iterations,r)}else return qn.pbkdf2(e,t.salt,ea.iterations,r)}function gd(t,e){return e===Oe?_r(t):e}function ta(t,e){let r=t;return t.length+e.length&&(r=new Uint8Array(t.length+e.length),r.set(t,0),r.set(e,t.length)),r}function Fv(t,e){if(e&&e>t.length){let r=t;t=new Uint8Array(e),t.set(r,0)}return t}function ln(t,e,r){return t.subarray(e,r)}function ri(t,e){return t.fromBits(e)}function ii(t,e){return t.toBits(e)}var Tr=12,ro=class extends TransformStream{constructor({password:e,passwordVerification:r,checkPasswordOnly:s}){super({start(){Object.assign(this,{password:e,passwordVerification:r}),bd(this,e)},transform(c,f){let i=this;if(i.password){let d=md(i,c.subarray(0,Tr));if(i.password=null,d[Tr-1]!=i.passwordVerification)throw new Error(kn);c=c.subarray(Tr)}s?f.error(new Error(Dn)):f.enqueue(md(i,c))}})}},io=class extends TransformStream{constructor({password:e,passwordVerification:r}){super({start(){Object.assign(this,{password:e,passwordVerification:r}),bd(this,e)},transform(s,c){let f=this,i,d;if(f.password){f.password=null;let n=Qi(new Uint8Array(Tr));n[Tr-1]=f.passwordVerification,i=new Uint8Array(s.length+n.length),i.set(vd(f,n),0),d=Tr}else i=new Uint8Array(s.length),d=0;i.set(vd(f,s),d),c.enqueue(i)}})}};function md(t,e){let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=wd(t)^e[s],na(t,r[s]);return r}function vd(t,e){let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=wd(t)^e[s],na(t,e[s]);return r}function bd(t,e){let r=[305419896,591751049,878082192];Object.assign(t,{keys:r,crcKey0:new Nn(r[0]),crcKey2:new Nn(r[2])});for(let s=0;s<e.length;s++)na(t,e.charCodeAt(s))}function na(t,e){let[r,s,c]=t.keys;t.crcKey0.append([e]),r=~t.crcKey0.get(),s=yd(Math.imul(yd(s+xd(r)),134775813)+1),t.crcKey2.append([s>>>24]),c=~t.crcKey2.get(),t.keys=[r,s,c]}function wd(t){let e=t.keys[2]|2;return xd(Math.imul(e,e^1)>>>8)}function xd(t){return t&255}function yd(t){return t&4294967295}var Sd="deflate-raw",oo=class extends TransformStream{constructor(e,{chunkSize:r,CompressionStream:s,CompressionStreamNative:c}){super({});let{compressed:f,encrypted:i,useCompressionStream:d,zipCrypto:n,signed:o,level:a}=e,l=this,u,h,p=Ed(super.readable);(!i||n)&&o&&(u=new Qr,p=Ln(p,u)),f&&(p=_d(p,d,{level:a,chunkSize:r},c,s)),i&&(n?p=Ln(p,new io(e)):(h=new to(e),p=Ln(p,h))),Cd(l,p,()=>{let g;i&&!n&&(g=h.signature),(!i||n)&&o&&(g=new DataView(u.value.buffer).getUint32(0)),l.signature=g})}},so=class extends TransformStream{constructor(e,{chunkSize:r,DecompressionStream:s,DecompressionStreamNative:c}){super({});let{zipCrypto:f,encrypted:i,signed:d,signature:n,compressed:o,useCompressionStream:a}=e,l,u,h=Ed(super.readable);i&&(f?h=Ln(h,new ro(e)):(u=new eo(e),h=Ln(h,u))),o&&(h=_d(h,a,{chunkSize:r}
1400,c,s)),(!i||f)&&d&&(l=new Qr,h=Ln(h,l)),Cd(this,h,()=>{if((!i||f)&&d){let p=new DataView(l.value.buffer);if(n!=p.getUint32(0,!1))throw new Error(Jn)}})}};function Ed(t){return Ln(t,new TransformStream({transform(e,r){e&&e.length&&r.enqueue(e)}}))}function Cd(t,e,r){e=Ln(e,new TransformStream({flush:r})),Object.defineProperty(t,"readable",{get(){return e}})}function _d(t,e,r,s,c){try{let f=e&&s?s:c;t=Ln(t,new f(Sd,r))}catch{if(e)try{t=Ln(t,new c(Sd,r))}catch{return t}else return t}return t}function Ln(t,e){return t.pipeThrough(e)}var Ad="message",Td="start",kd="pull",ra="data",Md="ack",ia="close",co="deflate",uo="inflate";var ao=class extends TransformStream{constructor(e,r){super({});let s=this,{codecType:c}=e,f;c.startsWith(co)?f=oo:c.startsWith(uo)&&(f=so);let i=0,d=0,n=new f(e,r),o=super.readable,a=new TransformStream({transform(u,h){u&&u.length&&(d+=u.length,h.enqueue(u))},flush(){Object.assign(s,{inputSize:d})}}),l=new TransformStream({transform(u,h){u&&u.length&&(i+=u.length,h.enqueue(u))},flush(){let{signature:u}=n;Object.assign(s,{signature:u,outputSize:i,inputSize:d})}});Object.defineProperty(s,"readable",{get(){return o.pipeThrough(a).pipeThrough(n).pipeThrough(l)}})}},lo=class extends TransformStream{constructor(e){let r;super({transform:s,flush(c){r&&r.length&&c.enqueue(r)}});function s(c,f){if(r){let i=new Uint8Array(r.length+c.length);i.set(r),i.set(c,r.length),c=i,r=null}c.length>e?(f.enqueue(c.slice(0,e)),s(c.slice(e),f)):r=c}}};var Id=typeof Worker!=Qt;var kr=class{constructor(e,{readable:r,writable:s},{options:c,config:f,streamOptions:i,useWebWorkers:d,transferStreams:n,scripts:o},a){let{signal:l}=i;return Object.assign(e,{busy:!0,readable:r.pipeThrough(new lo(f.chunkSize)).pipeThrough(new sa(r,i),{signal:l}),writable:s,options:Object.assign({},c),scripts:o,transferStreams:n,terminate(){return new Promise(u=>{let{worker:h,busy:p}=e;h?(p?e.resolveTerminated=u:(h.terminate(),u()),e.interface=null):u()})},onTaskFinished(){let{resolveTerminated:u}=e;u&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),u()),e.busy=!1,a(e)}}),(d&&Id?Pv:$d)(e,f)}},sa=class extends TransformStream{constructor(e,{onstart:r,onprogress:s,size:c,onend:f}){let i=0;super({async start(){r&&await oa(r,c)},async transform(d,n){i+=d.length,s&&await oa(s,i,c),n.enqueue(d)},async flush(){e.size=i,f&&await oa(f,i)}})}};async function oa(t,...e){try{await t(...e)}catch{}}function $d(t,e){return{run:()=>Bv(t,e)}}function Pv(t,e){let{baseURL:r,chunkSize:s}=e;if(!t.interface){let c;try{c=Wv(t.scripts[0],r,t)}catch{return Id=!1,$d(t,e)}Object.assign(t,{worker:c,interface:{run:()=>Hv(t,{chunkSize:s})}})}return t.interface}async function Bv({options:t,readable:e,writable:r,onTaskFinished:s},c){try{let f=new ao(t,c);await e.pipeThrough(f).pipeTo(r,{preventClose:!0,preventAbort:!0});let{signature:i,inputSize:d,outputSize:n}=f;return{signature:i,inputSize:d,outputSize:n}}finally{s()}}async function Hv(t,e){let r,s,c=new Promise((u,h)=>{r=u,s=h});Object.assign(t,{reader:null,writer:null,resolveResult:r,rejectResult:s,result:c});let{readable:f,options:i,scripts:d}=t,{writable:n,closed:o}=Uv(t.writable),a=ho({type:Td,scripts:d.slice(1),options:i,config:e,readable:f,writable:n},t);a||Object.assign(t,{reader:f.getReader(),writer:n.getWriter()});let l=await c;return a||await n.getWriter().close(),await o,l}function Uv(t){let e,r=new Promise(c=>e=c);return{writable:new WritableStream({async write(c){let f=t.getWriter();await f.ready,await f.write(c),f.releaseLock()},close(){e()},abort(c){return t.getWriter().abort(c)}}),closed:r}}var Ld=!0,Rd=!0;function Wv(t,e,r){let s={type:"module"},c,f;typeof t==Tn&&(t=t());try{c=new URL(t,e)}catch{c=t}if(Ld)try{f=new Worker(c)}catch{Ld=!1,f=new Worker(c,s)}else f=new Worker(c,s);return f.addEventListener(Ad,i=>zv(i,r)),f}function ho(t,{worker:e,writer:r,onTaskFinished:s,transferStreams:c}){try{let{value:f,readable:i,writable:d}=t,n=[];if(f&&(f.byteLength<f.buffer.byteLength?t.value=f.buffer.slice(0,f.byteLength):t.value=f.buffer,n.push(t.value)),c&&Rd?(i&&n.push(i),d&&n.push(d)):t.readable=t.writable=null,n.length)try{return e.postMessage(t,n),!0}catch{Rd=!1,t.readable=t.writable=null,e.postMessage(t)}else e.postMessage(t)}catch(f){throw r&&r.releaseLock(),s(),f}}async function zv({data:t},e){let{type:r,value:s,messageId:c,result:f,error:i}
1400=t,{reader:d,writer:n,resolveResult:o,rejectResult:a,onTaskFinished:l}=e;try{if(i){let{message:h,stack:p,code:g,name:m}=i,y=new Error(h);Object.assign(y,{stack:p,code:g,name:m}),u(y)}else{if(r==kd){let{value:h,done:p}=await d.read();ho({type:ra,value:h,done:p,messageId:c},e)}r==ra&&(await n.ready,await n.write(new Uint8Array(s)),ho({type:Md,messageId:c},e)),r==ia&&u(null,f)}}catch(h){ho({type:ia,messageId:c},e),u(h)}function u(h,p){h?a(h):o(p),n&&n.releaseLock(),l()}}var fr=[],aa=[];var Od=0;async function fo(t,e){let{options:r,config:s}=e,{transferStreams:c,useWebWorkers:f,useCompressionStream:i,codecType:d,compressed:n,signed:o,encrypted:a}=r,{workerScripts:l,maxWorkers:u}=s;e.transferStreams=c||c===Oe;let h=!n&&!o&&!a&&!e.transferStreams;return e.useWebWorkers=!h&&(f||f===Oe&&s.useWebWorkers),e.scripts=e.useWebWorkers&&l?l[d]:[],r.useCompressionStream=i||i===Oe&&s.useCompressionStream,(await p()).run();async function p(){let m=fr.find(y=>!y.busy);if(m)return Nd(m),new kr(m,t,e,g);if(fr.length<u){let y={indexWorker:Od};return Od++,fr.push(y),new kr(y,t,e,g)}else return new Promise(y=>aa.push({resolve:y,stream:t,workerOptions:e}))}function g(m){if(aa.length){let[{resolve:y,stream:b,workerOptions:C}]=aa.splice(0,1);y(new kr(m,b,C,g))}else m.worker?(Nd(m),jv(m,e)):fr=fr.filter(y=>y!=m)}}function jv(t,e){let{config:r}=e,{terminateWorkerTimeout:s}=r;Number.isFinite(s)&&s>=0&&(t.terminated?t.terminated=!1:t.terminateTimeout=setTimeout(async()=>{fr=fr.filter(c=>c!=t);try{await t.terminate()}catch{}},s))}function Nd(t){let{terminateTimeout:e}=t;e&&(clearTimeout(e),t.terminateTimeout=null)}function Dd(t,e={}){let r=`const{Array:e,Object:t,Number:n,Math:r,Error:s,Uint8Array:i,Uint16Array:o,Uint32Array:c,Int32Array:f,Map:a,DataView:l,Promise:u,TextEncoder:w,crypto:h,postMessage:d,TransformStream:p,ReadableStream:y,WritableStream:m,CompressionStream:b,DecompressionStream:g}=self,k=void 0,v="undefined",S="function";class z{constructor(e){return class extends p{constructor(t,n){const r=new e(n);super({transform(e,t){t.enqueue(r.append(e))},flush(e){const t=r.flush();t&&e.enqueue(t)}})}}}}const C=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;C[e]=t}class x{constructor(e){this.t=e||-1}append(e){let t=0|this.t;for(let n=0,r=0|e.length;r>n;n++)t=t>>>8^C[255&(t^e[n])];this.t=t}get(){return~this.t}}class A extends p{constructor(){let e;const t=new x;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new l(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const _={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],r=_.i(n);return 32===r?e.concat(t):_.o(t,r,0|n,e.slice(0,e.length-1))},l(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+_.i(n)},u(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,r.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=_.h(t,e[n-1]&2147483648>>t-1,1)),e},h:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,i:e=>r.round(e/1099511627776)||32,o(e,t,n,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(let s=0;s<e.length;s++)r.push(n|e[s]>>>t),n=e[s]<<32-t;const s=e.length?e[e.length-1]:0,i=_.i(s);return r.push(_.h(t+i&31,t+i>32?n:r.pop(),1)),r}},I={bytes:{p(e){const t=_.l(e)/8,n=new i(t);let r;for(let s=0;t>s;s++)3&s||(r=e[s/4]),n[s]=r>>>24,r<<=8;return n},m(e){const t=[];let n,r=0;for(n=0;n<e.length;n++)r=r<<8|e[n],3&~n||(t.push(r),r=0);return 3&n&&t.push(_.h(8*(3&n),r)),t}}},P=class{constructor(e){const t=this;t.blockSize=512,t.k=[1732584193,4023233417,2562383102,271733878,3285377520],t.v=[1518500249,1859775393,2400959708,3395469782],e?(t.S=e.S.slice(0),t.C=e.C.slice(0),t.A=e.A):t.reset()}reset(){const e=this;return e.S=e.k.slice(0),e.C=[],e.A=0,e}update(e){const t=this;"string"==typeof e&&(e=I._.m(e));const n=t.C=_.concat(t.C,e),r=t.A,i=t.A=r+_.l(e);if(i>9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const o=new c(n);let f=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);i>=e;e+=t.blockSize)t.I(o.subarray(16*f,16*(f+1))),f+=1;return n.splice(0,16*f),t}P(){const e=this;let t=e.C;const n=e.S;t=_.concat(t,[_.h(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(r.floor(e.A/4294967296)),t.push(0|e.A);t.length;)e.I(t.splice(0,16));return e.reset(),n}D(e,t,n,r){return e>19?e>39?e>59?e>79?void 0:t^n^r:t&n|t&r|n&r:t^n^r:t&n|~t&r}V(e,t){return t<<e|t>>>32-e}I(t){const n=this,s=n.S,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let o=s[0],c=s[1],f=s[2],a=s[3],l=s[4];for(let e=0;79>=e;e++){16>e||(i[e]=n.V(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n.V(5,o)+n.D(e,c,f,a)+l+i[e]+n.v[r.floor(e/20)]|0;l=a,a=f,f=n.V(30,c),c=o,o=t}s[0]=s[0]+o|0,s[1]=s[1]+c|0,s[2]=s[2]+f|0,s[3]=s[3]+a|0,s[4]=s[4]+l|0}},D={getRandomValues(e){const t=new c(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(r.random()>.5?1:-1))};for(let s,i=0;i<e.length;i+=4){const e=n(4294967296*(s||r.random()));s=987654071*e(),t[i/4]=4294967296*e()|0}return e}},V={importKey:e=>
1400new V.R(I.bytes.m(e)),B(e,t,n,r){if(n=n||1e4,0>r||0>n)throw new s("invalid params to pbkdf2");const i=1+(r>>5)<<2;let o,c,f,a,u;const w=new ArrayBuffer(i),h=new l(w);let d=0;const p=_;for(t=I.bytes.m(t),u=1;(i||1)>d;u++){for(o=c=e.encrypt(p.concat(t,[u])),f=1;n>f;f++)for(c=e.encrypt(c),a=0;a<c.length;a++)o[a]^=c[a];for(f=0;(i||1)>d&&f<o.length;f++)h.setInt32(d,o[f]),d+=4}return w.slice(0,r/8)},R:class{constructor(e){const t=this,n=t.M=P,r=[[],[]];t.U=[new n,new n];const s=t.U[0].blockSize/32;e.length>s&&(e=(new n).update(e).P());for(let t=0;s>t;t++)r[0][t]=909522486^e[t],r[1][t]=1549556828^e[t];t.U[0].update(r[0]),t.U[1].update(r[1]),t.K=new n(t.U[0])}reset(){const e=this;e.K=new e.M(e.U[0]),e.N=!1}update(e){this.N=!0,this.K.update(e)}digest(){const e=this,t=e.K.P(),n=new e.M(e.U[1]).update(t).P();return e.reset(),n}encrypt(e){if(this.N)throw new s("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},R=typeof h!=v&&typeof h.getRandomValues==S,B="Invalid password",E="Invalid signature",M="zipjs-abort-check-password";function U(e){return R?h.getRandomValues(e):D.getRandomValues(e)}const K=16,N={name:"PBKDF2"},O=t.assign({hash:{name:"HMAC"}},N),T=t.assign({iterations:1e3,hash:{name:"SHA-1"}},N),W=["deriveBits"],j=[8,12,16],H=[16,24,32],L=10,F=[0,0,0,0],q=typeof h!=v,G=q&&h.subtle,J=q&&typeof G!=v,Q=I.bytes,X=class{constructor(e){const t=this;t.O=[[[],[],[],[],[]],[[],[],[],[],[]]],t.O[0][0][0]||t.T();const n=t.O[0][4],r=t.O[1],i=e.length;let o,c,f,a=1;if(4!==i&&6!==i&&8!==i)throw new s("invalid aes key size");for(t.v=[c=e.slice(0),f=[]],o=i;4*i+28>o;o++){let e=c[o-1];(o%i==0||8===i&&o%i==4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%i==0&&(e=e<<8^e>>>24^a<<24,a=a<<1^283*(a>>7))),c[o]=c[o-i]^e}for(let e=0;o;e++,o--){const t=c[3&e?o:o-4];f[e]=4>=o||4>e?t:r[0][n[t>>>24]]^r[1][n[t>>16&255]]^r[2][n[t>>8&255]]^r[3][n[255&t]]}}encrypt(e){return this.W(e,0)}decrypt(e){return this.W(e,1)}T(){const e=this.O[0],t=this.O[1],n=e[4],r=t[4],s=[],i=[];let o,c,f,a;for(let e=0;256>e;e++)i[(s[e]=e<<1^283*(e>>7))^e]=e;for(let l=o=0;!n[l];l^=c||1,o=i[o]||1){let i=o^o<<1^o<<2^o<<3^o<<4;i=i>>8^255&i^99,n[l]=i,r[i]=l,a=s[f=s[c=s[l]]];let u=16843009*a^65537*f^257*c^16843008*l,w=257*s[i]^16843008*i;for(let n=0;4>n;n++)e[n][l]=w=w<<24^w>>>8,t[n][i]=u=u<<24^u>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}W(e,t){if(4!==e.length)throw new s("invalid aes block size");const n=this.v[t],r=n.length/4-2,i=[0,0,0,0],o=this.O[t],c=o[0],f=o[1],a=o[2],l=o[3],u=o[4];let w,h,d,p=e[0]^n[0],y=e[t?3:1]^n[1],m=e[2]^n[2],b=e[t?1:3]^n[3],g=4;for(let e=0;r>e;e++)w=c[p>>>24]^f[y>>16&255]^a[m>>8&255]^l[255&b]^n[g],h=c[y>>>24]^f[m>>16&255]^a[b>>8&255]^l[255&p]^n[g+1],d=c[m>>>24]^f[b>>16&255]^a[p>>8&255]^l[255&y]^n[g+2],b=c[b>>>24]^f[p>>16&255]^a[y>>8&255]^l[255&m]^n[g+3],g+=4,p=w,y=h,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=u[p>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&b]^n[g++],w=p,p=y,y=m,m=b,b=w;return i}},Y=class{constructor(e,t){this.j=e,this.H=t,this.L=t}reset(){this.L=this.H}update(e){return this.F(this.j,e,this.L)}q(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}return e}G(e){0===(e[0]=this.q(e[0]))&&(e[1]=this.q(e[1]))}F(e,t,n){let r;if(!(r=t.length))return[];const s=_.l(t);for(let s=0;r>s;s+=4){this.G(n);const r=e.encrypt(n);t[s]^=r[0],t[s+1]^=r[1],t[s+2]^=r[2],t[s+3]^=r[3]}return _.u(t,s)}},Z=V.R;let $=q&&J&&typeof G.importKey==S,ee=q&&J&&typeof G.deriveBits==S;class te extends p{constructor({password:e,rawPassword:n,signed:r,encryptionStrength:o,checkPasswordOnly:c}){super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:ie(e,n),signed:r,X:o-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:o,J:f,ready:a}=n;r?(await(async(e,t,n,r)=>{const i=await se(e,t,n,ce(r,0,j[t])),o=ce(r,j[t]);if(i[0]!=o[0]||i[1]!=o[1])throw new s(B)})(n,o,r,ce(e,0,j[o]+2)),e=ce(e,j[o]+2),c?t.error(new s(M)):f()):await a;const l=new i(e.length-L-(e.length-L)%K);t.enqueue(re(n,e,l,0,L,!0))},async flush(e){const{signed:t,Y:n,Z:r,pending:o,ready:c}=this;if(r&&n){await c;const f=ce(o,0,o.length-L),a=ce(o,o.length-L);let l=new i;if(f.length){const e=ae(Q,f);r.update(e);const t=n.update(e);l=fe(Q,t)}if(t){const e=ce(fe(Q,r.digest()),0,L);for(let t=0;L>t;t++)if(e[t]!=a[t])throw new s(E)}e.enqueue(l)}}})}}class ne extends p{constructor({password:e,rawPassword:n,encryptionStrength:r}){let s;super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:ie(e,n),X:r-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:s,J:o,ready:c}=n;let f=new i;r?(f=await(async(e,t,n)=>{const r=U(new i(j[t]));return oe(r,await se(e,t,n,r))})(n,s,r),o()):await c;const a=new i(f.length+e.length-e.length%K);a.set(f,0),t.enqueue(re(n,e,a,f.length,0))},async flush(e){const{Y:t,Z:n,pending:r,ready:o}=this;if(n&&t){await o;let c=new i;if(r.length){const e=t.update(ae(Q,r));n.update(e),c=fe(Q,e)}s.signature=fe(Q,n.digest()).slice(0,L),e.enqueue(oe(c,s.signature))}}}),s=this}}function re(e,t,n,r,s,o){const{Y:c,Z:f,pending:a}=e,l=t.length-s;let u;for(a.length&&(t=oe(a,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,l-l%K)),u=0;l-K>=u;u+=K){const e=ae(Q,ce(t,u,u+K));o&&f.update(e);const s=c.update(e);o||f.update(s),n.set(fe(Q,s),u+r)}return e.pending=ce(t,u),n}async function se(n,r,s,o){n.password=null;
1400const c=await(async(e,t,n,r,s)=>{if(!$)return V.importKey(t);try{return await G.importKey("raw",t,n,!1,s)}catch(e){return $=!1,V.importKey(t)}})(0,s,O,0,W),f=await(async(e,t,n)=>{if(!ee)return V.B(t,e.salt,T.iterations,n);try{return await G.deriveBits(e,t,n)}catch(r){return ee=!1,V.B(t,e.salt,T.iterations,n)}})(t.assign({salt:o},T),c,8*(2*H[r]+2)),a=new i(f),l=ae(Q,ce(a,0,H[r])),u=ae(Q,ce(a,H[r],2*H[r])),w=ce(a,2*H[r]);return t.assign(n,{keys:{key:l,$:u,passwordVerification:w},Y:new Y(new X(l),e.from(F)),Z:new Z(u)}),w}function ie(e,t){return t===k?(e=>{if(typeof w==v){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new w).encode(e)})(e):t}function oe(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ce(e,t,n){return e.subarray(t,n)}function fe(e,t){return e.p(t)}function ae(e,t){return e.m(t)}class le extends p{constructor({password:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;if(n.password){const t=we(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new s(B);e=e.subarray(12)}r?t.error(new s(M)):t.enqueue(we(n,e))}})}}class ue extends p{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;let r,s;if(n.password){n.password=null;const t=U(new i(12));t[11]=n.passwordVerification,r=new i(e.length+t.length),r.set(he(n,t),0),s=12}else r=new i(e.length),s=0;r.set(he(n,e),s),t.enqueue(r)}})}}function we(e,t){const n=new i(t.length);for(let r=0;r<t.length;r++)n[r]=ye(e)^t[r],pe(e,n[r]);return n}function he(e,t){const n=new i(t.length);for(let r=0;r<t.length;r++)n[r]=ye(e)^t[r],pe(e,t[r]);return n}function de(e,n){const r=[305419896,591751049,878082192];t.assign(e,{keys:r,ee:new x(r[0]),te:new x(r[2])});for(let t=0;t<n.length;t++)pe(e,n.charCodeAt(t))}function pe(e,t){let[n,s,i]=e.keys;e.ee.append([t]),n=~e.ee.get(),s=be(r.imul(be(s+me(n)),134775813)+1),e.te.append([s>>>24]),i=~e.te.get(),e.keys=[n,s,i]}function ye(e){const t=2|e.keys[2];return me(r.imul(t,1^t)>>>8)}function me(e){return 255&e}function be(e){return 4294967295&e}const ge="deflate-raw";class ke extends p{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:r}){super({});const{compressed:s,encrypted:i,useCompressionStream:o,zipCrypto:c,signed:f,level:a}=e,u=this;let w,h,d=Se(super.readable);i&&!c||!f||(w=new A,d=xe(d,w)),s&&(d=Ce(d,o,{level:a,chunkSize:t},r,n)),i&&(c?d=xe(d,new ue(e)):(h=new ne(e),d=xe(d,h))),ze(u,d,(()=>{let e;i&&!c&&(e=h.signature),i&&!c||!f||(e=new l(w.value.buffer).getUint32(0)),u.signature=e}))}}class ve extends p{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:r}){super({});const{zipCrypto:i,encrypted:o,signed:c,signature:f,compressed:a,useCompressionStream:u}=e;let w,h,d=Se(super.readable);o&&(i?d=xe(d,new le(e)):(h=new te(e),d=xe(d,h))),a&&(d=Ce(d,u,{chunkSize:t},r,n)),o&&!i||!c||(w=new A,d=xe(d,w)),ze(this,d,(()=>{if((!o||i)&&c){const e=new l(w.value.buffer);if(f!=e.getUint32(0,!1))throw new s(E)}}))}}function Se(e){return xe(e,new p({transform(e,t){e&&e.length&&t.enqueue(e)}}))}function ze(e,n,r){n=xe(n,new p({flush:r})),t.defineProperty(e,"readable",{get:()=>n})}function Ce(e,t,n,r,s){try{e=xe(e,new(t&&r?r:s)(ge,n))}catch(r){if(!t)return e;try{e=xe(e,new s(ge,n))}catch(t){return e}}return e}function xe(e,t){return e.pipeThrough(t)}const Ae="data",_e="close";class Ie extends p{constructor(e,n){super({});const r=this,{codecType:s}=e;let i;s.startsWith("deflate")?i=ke:s.startsWith("inflate")&&(i=ve);let o=0,c=0;const f=new i(e,n),a=super.readable,l=new p({transform(e,t){e&&e.length&&(c+=e.length,t.enqueue(e))},flush(){t.assign(r,{inputSize:c})}}),u=new p({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){const{signature:e}=f;t.assign(r,{signature:e,outputSize:o,inputSize:c})}});t.defineProperty(r,"readable",{get:()=>a.pipeThrough(l).pipeThrough(f).pipeThrough(u)})}}class Pe extends p{constructor(e){let t;super({transform:function n(r,s){if(t){const e=new i(t.length+r.length);e.set(t),e.set(r,t.length),r=e,t=null}r.length>e?(s.enqueue(r.slice(0,e)),n(r.slice(e),s)):t=r},flush(e){t&&t.length&&e.enqueue(t)}})}}const De=new a,Ve=new a;let Re,Be=0,Ee=!0;async function Me(e){try{const{options:t,scripts:r,config:s}=e;if(r&&r.length)try{Ee?importScripts.apply(k,r):await Ue(r)}catch(e){Ee=!1,await Ue(r)}self.initCodec&&self.initCodec(),s.CompressionStreamNative=self.CompressionStream,s.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(s.CompressionStream=new z(self.Deflate)),self.Inflate&&(s.DecompressionStream=new z(self.Inflate));const i={highWaterMark:1},o=e.readable||new y({async pull(e){const t=new u((e=>De.set(Be,e)));Ke({type:"pull",messageId:Be}),Be=(Be+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await t;e.enqueue(r),s&&e.close()}},i),c=e.writable||new m({async write(e){let t;const r=new u((e=>t=e));Ve.set(Be,t),Ke({type:Ae,value:e,messageId:Be}),Be=(Be+1)%n.MAX_SAFE_INTEGER,await r}},i),f=new Ie(t,s);Re=new AbortController;const{signal:a}=Re;await o.pipeThrough(f).pipeThrough(new Pe(s.chunkSize)).pipeTo(c,{signal:a,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{signature:l,inputSize:w,outputSize:h}=f;Ke({type:_e,result:{signature:l,inputSize:w,outputSize:h}})}catch(e){Ne(e)}}async function Ue(e){for(const t of e)await import(t)}function Ke(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Ne(e=new s("Unknown error")){const{message:t,stack:n,code:r,name:i}=e;d({error:{message:t,stack:n,code:r,name:i}})}addEventListener("message",(({data:e})=>{const{type:t,messageId:n,value:r,done:s}=e;try{if("start"==t&&Me(e),t==Ae){const e=De.get(n);De.delete(n),e({value:new i(r),done:s})}if("ack"==t){const e=Ve.get(n);Ve.delete(n),e()}t==_e&&Re.abort()}catch(e){Ne(e)}}));const Oe=-2;function Te(t){return We(t.map((([t,n])=>new e(t).fill(n,0,t))))}function We(t){return t.reduce(((t,n)=>t.concat(e.isArray(n)?We(n):n)),[])}const je=[0,1,2,3].concat(...Te([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function He(){const e=this;function t(e,t){let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}e.ne=n=>{const s=e.re,i=e.ie.se,o=e.ie.oe;let c,f,a,l=-1;for(n.ce=0,n.fe=573,c=0;o>c;c++)0!==s[2*c]?(n.ae[++n.ce]=l=c,n.le[c]=0):s[2*c+1]=0;for(;2>n.ce;)a=n.ae[++n.ce]=2>l?++l:0,s[2*a]=1,n.le[a]=0,n.ue--,i&&(n.we-=i[2*a+1]);for(e.he=l,c=r.floor(n.ce/2);c>=1;c--)n.de(s,c);a=o;do{c=n.ae[1],n.ae[1]=n.ae[n.ce--],n.de(s,1),f=n.ae[1],n.ae[--n.fe]=c,n.ae[--n.fe]=f,s[2*a]=s[2*c]+s[2*f],n.le[a]=r.max(n.le[c],n.le[f])+1,s[2*c+1]=s[2*f+1]=a,n.ae[1]=a++,n.de(s,1)}while(n.ce>=2);n.ae[--n.fe]=n.ae[1],(t=>{const n=e.re,r=e.ie.se,s=e.ie.pe,i=e.ie.ye,o=e.ie.me;
1400let c,f,a,l,u,w,h=0;for(l=0;15>=l;l++)t.be[l]=0;for(n[2*t.ae[t.fe]+1]=0,c=t.fe+1;573>c;c++)f=t.ae[c],l=n[2*n[2*f+1]+1]+1,l>o&&(l=o,h++),n[2*f+1]=l,f>e.he||(t.be[l]++,u=0,i>f||(u=s[f-i]),w=n[2*f],t.ue+=w*(l+u),r&&(t.we+=w*(r[2*f+1]+u)));if(0!==h){do{for(l=o-1;0===t.be[l];)l--;t.be[l]--,t.be[l+1]+=2,t.be[o]--,h-=2}while(h>0);for(l=o;0!==l;l--)for(f=t.be[l];0!==f;)a=t.ae[--c],a>e.he||(n[2*a+1]!=l&&(t.ue+=(l-n[2*a+1])*n[2*a],n[2*a+1]=l),f--)}})(n),((e,n,r)=>{const s=[];let i,o,c,f=0;for(i=1;15>=i;i++)s[i]=f=f+r[i-1]<<1;for(o=0;n>=o;o++)c=e[2*o+1],0!==c&&(e[2*o]=t(s[c]++,c))})(s,e.he,n.be)}}function Le(e,t,n,r,s){const i=this;i.se=e,i.pe=t,i.ye=n,i.oe=r,i.me=s}He.ge=[0,1,2,3,4,5,6,7].concat(...Te([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),He.ke=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],He.ve=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],He.Se=e=>256>e?je[e]:je[256+(e>>>7)],He.ze=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],He.Ce=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],He.xe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],He.Ae=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const Fe=Te([[144,8],[112,9],[24,7],[8,8]]);Le._e=We([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,16
14007,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((e,t)=>[e,Fe[t]])));const qe=Te([[30,5]]);function Ge(e,t,n,r,s){const i=this;i.Ie=e,i.Pe=t,i.De=n,i.Ve=r,i.Re=s}Le.Be=We([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((e,t)=>[e,qe[t]]))),Le.Ee=new Le(Le._e,He.ze,257,286,15),Le.Me=new Le(Le.Be,He.Ce,0,30,15),Le.Ue=new Le(null,He.xe,0,19,7);const Je=[new Ge(0,0,0,0,0),new Ge(4,4,8,4,1),new Ge(4,5,16,8,1),new Ge(4,6,32,32,1),new Ge(4,4,16,16,2),new Ge(8,16,32,32,2),new Ge(8,16,128,128,2),new Ge(8,32,128,256,2),new Ge(32,128,258,1024,2),new Ge(32,258,258,4096,2)],Qe=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],Xe=113,Ye=666,Ze=262;function $e(e,t,n,r){const s=e[2*t],i=e[2*n];return i>s||s==i&&r[t]<=r[n]}function et(){const e=this;let t,n,s,c,f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z,C,x,A,_,I,P,D,V,R,B,E,M,U;const K=new He,N=new He,O=new He;let T,W,j,H,L,F;function q(){let t;for(t=0;286>t;t++)E[2*t]=0;for(t=0;30>t;t++)M[2*t]=0;for(t=0;19>t;t++)U[2*t]=0;E[512]=1,e.ue=e.we=0,W=j=0}function G(e,t){let n,r=-1,s=e[1],i=0,o=7,c=4;0===s&&(o=138,c=3),e[2*(t+1)+1]=65535;for(let f=0;t>=f;f++)n=s,s=e[2*(f+1)+1],++i<o&&n==s||(c>i?U[2*n]+=i:0!==n?(n!=r&&U[2*n]++,U[32]++):i>10?U[36]++:U[34]++,i=0,r=n,0===s?(o=138,c=3):n==s?(o=6,c=3):(o=7,c=4))}function J(t){e.Ke[e.pending++]=t}function Q(e){J(255&e),J(e>>>8&255)}function X(e,t){let n;const r=t;F>16-r?(n=e,L|=n<<F&65535,Q(L),L=n>>>16-F,F+=r-16):(L|=e<<F&65535,F+=r)}function Y(e,t){const n=2*e;X(65535&t[n],65535&t[n+1])}function Z(e,t){let n,r,s=-1,i=e[1],o=0,c=7,f=4;for(0===i&&(c=138,f=3),n=0;t>=n;n++)if(r=i,i=e[2*(n+1)+1],++o>=c||r!=i){if(f>o)do{Y(r,U)}while(0!=--o);else 0!==r?(r!=s&&(Y(r,U),o--),Y(16,U),X(o-3,2)):o>10?(Y(18,U),X(o-11,7)):(Y(17,U),X(o-3,3));o=0,s=r,0===i?(c=138,f=3):r==i?(c=6,f=3):(c=7,f=4)}}function $(){16==F?(Q(L),L=0,F=0):8>F||(J(255&L),L>>>=8,F-=8)}function ee(t,n){let s,i,o;if(e.Ne[W]=t,e.Oe[W]=255&n,W++,0===t?E[2*n]++:(j++,t--,E[2*(He.ge[n]+256+1)]++,M[2*He.Se(t)]++),!(8191&W)&&D>2){for(s=8*W,i=C-k,o=0;30>o;o++)s+=M[2*o]*(5+He.Ce[o]);if(s>>>=3,j<r.floor(W/2)&&s<r.floor(i/2))return!0}return W==T-1}function te(t,n){let r,s,i,o,c=0;if(0!==W)do{r=e.Ne[c],s=e.Oe[c],c++,0===r?Y(s,t):(i=He.ge[s],Y(i+256+1,t),o=He.ze[i],0!==o&&(s-=He.ke[i],X(s,o)),r--,i=He.Se(r),Y(i,n),o=He.Ce[i],0!==o&&(r-=He.ve[i],X(r,o)))}while(W>c);Y(256,t),H=t[513]}function ne(){F>8?Q(L):F>0&&J(255&L),L=0,F=0}function re(t,n,r){X(0+(r?1:0),3),((t,n)=>{ne(),H=8,Q(n),Q(~n),e.Ke.set(u.subarray(t,t+n),e.pending),e.pending+=n})(t,n)}function se(n){((t,n,r)=>{let s,i,o=0;D>0?(K.ne(e),N.ne(e),o=(()=>{let t;for(G(E,K.he),G(M,N.he),O.ne(e),t=18;t>=3&&0===U[2*He.Ae[t]+1];t--);return e.ue+=14+3*(t+1),t})(),s=e.ue+3+7>>>3,i=e.we+3+7>>>3,i>s||(s=i)):s=i=n+5,n+4>s||-1==t?i==s?(X(2+(r?1:0),3),te(Le._e,Le.Be)):(X(4+(r?1:0),3),((e,t,n)=>{let r;for(X(e-257,5),X(t-1,5),X(n-4,4),r=0;n>r;r++)X(U[2*He.Ae[r]+1],3);Z(E,e-1),Z(M,t-1)})(K.he+1,N.he+1,o+1),te(E,M)):re(t,n,r),q(),r&&ne()})(0>k?-1:k,C-k,n),k=C,t.Te()}function ie(){let e,n,r,s;do{if(s=w-A-C,0===s&&0===C&&0===A)s=f;else if(-1==s)s--;else if(C>=f+f-Ze){u.set(u.subarray(f,f+f),0),x-=f,C-=f,k-=f,e=y,r=e;do{n=65535&d[--r],d[r]=f>n?0:n-f}while(0!=--e);e=f,r=e;do{n=65535&h[--r],h[r]=f>n?0:n-f}while(0!=--e);s+=f}if(0===t.We)return;e=t.je(u,C+A,s),A+=e,3>A||(p=255&u[C],p=(p<<g^255&u[C+1])&b)}while(Ze>A&&0!==t.We)}function oe(e){let t,n,r=I,s=C,i=_;const o=C>f-Ze?C-(f-Ze):0;let c=B;const a=l,w=C+258;let d=u[s+i-1],p=u[s+i];R>_||(r>>=2),c>A&&(c=A);do{if(t=e,u[t+i]==p&&u[t+i-1]==d&&u[t]==u[s]&&u[++t]==u[s+1]){s+=2,t++;do{}while(u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&w>s);if(n=258-(w-s),s=w-258,n>i){if(x=e,i=n,n>=c)break;d=u[s+i-1],p=u[s+i]}}}while((e=65535&h[e&a])>o&&0!=--r);return i>A?A:i}e.le=[],e.be=[],e.ae=[],E=[],M=[],U=[],e.de=(t,n)=>{const r=e.ae,s=r[n];let i=n<<1;for(;i<=e.ce&&(i<e.ce&&$e(t,r[i+1],r[i],e.le)&&i++,!$e(t,s,r[i],e.le));)r[n]=r[i],n=i,i<<=1;r[n]=s},e.He=(t,S,x,W,j,G)=>(W||(W=8),j||(j=8),G||(G=0),t.Le=null,-1==S&&(S=6),1>j||j>9||8!=W||9>x||x>15||0>S||S>9||0>G||G>2?Oe:(t.Fe=e,a=x,f=1<<a,l=f-1,m=j+7,y=1<<m,b=y-1,g=r.floor((m+3-1)/3),u=new i(2*f),h=[],d=[],T=1<<j+6,e.Ke=new i(4*T),s=4*T,e.Ne=new o(T),e.Oe=new i(T),D=S,V=G,(t=>(t.qe=t.Ge=0,t.Le=null,e.pending=0,e.Je=0,n=Xe,c=0,K.re=E,K.ie=Le.Ee,N.re=M,N.ie=Le.Me,O.re=U,O.ie=Le.Ue,L=0,F=0,H=8,q(),(()=>{w=2*f,d[y-1]=0;for(let e=0;y-1>e;e++)d[e]=0;P=Je[D].Pe,R=Je[D].Ie,B=Je[D].De,I=Je[D].Ve,C=0,k=0,A=0,v=_=2,z=0,p=0})(),0))(t))),e.Qe=()=>42!=n&&n!=Xe&&n!=Ye?Oe:(e.Oe=null,e.Ne=null,e.Ke=null,d=null,h=null,u=null,e.Fe=null,n==Xe?-3:0),e.Xe=(e,t,n)=>{let r=0;return-1==t&&(t=6),0>t||t>9||0>n||n>2?Oe:(Je[D].Re!=Je[t].Re&&0!==e.qe&&(r=e.Ye(1)),D!=t&&(D=t,P=Je[D].Pe,R=Je[D].Ie,B=Je[D].De,I=Je[D].Ve),V=n,r)},e.Ze=(e,t,r)=>{let s,i=r,o=0;
1400if(!t||42!=n)return Oe;if(3>i)return 0;for(i>f-Ze&&(i=f-Ze,o=r-i),u.set(t.subarray(o,o+i),0),C=i,k=i,p=255&u[0],p=(p<<g^255&u[1])&b,s=0;i-3>=s;s++)p=(p<<g^255&u[s+2])&b,h[s&l]=d[p],d[p]=s;return 0},e.Ye=(r,i)=>{let o,w,m,I,R;if(i>4||0>i)return Oe;if(!r.$e||!r.et&&0!==r.We||n==Ye&&4!=i)return r.Le=Qe[4],Oe;if(0===r.tt)return r.Le=Qe[7],-5;var B;if(t=r,I=c,c=i,42==n&&(w=8+(a-8<<4)<<8,m=(D-1&255)>>1,m>3&&(m=3),w|=m<<6,0!==C&&(w|=32),w+=31-w%31,n=Xe,J((B=w)>>8&255),J(255&B)),0!==e.pending){if(t.Te(),0===t.tt)return c=-1,0}else if(0===t.We&&I>=i&&4!=i)return t.Le=Qe[7],-5;if(n==Ye&&0!==t.We)return r.Le=Qe[7],-5;if(0!==t.We||0!==A||0!=i&&n!=Ye){switch(R=-1,Je[D].Re){case 0:R=(e=>{let n,r=65535;for(r>s-5&&(r=s-5);;){if(1>=A){if(ie(),0===A&&0==e)return 0;if(0===A)break}if(C+=A,A=0,n=k+r,(0===C||C>=n)&&(A=C-n,C=n,se(!1),0===t.tt))return 0;if(C-k>=f-Ze&&(se(!1),0===t.tt))return 0}return se(4==e),0===t.tt?4==e?2:0:4==e?3:1})(i);break;case 1:R=(e=>{let n,r=0;for(;;){if(Ze>A){if(ie(),Ze>A&&0==e)return 0;if(0===A)break}if(3>A||(p=(p<<g^255&u[C+2])&b,r=65535&d[p],h[C&l]=d[p],d[p]=C),0===r||(C-r&65535)>f-Ze||2!=V&&(v=oe(r)),3>v)n=ee(0,255&u[C]),A--,C++;else if(n=ee(C-x,v-3),A-=v,v>P||3>A)C+=v,v=0,p=255&u[C],p=(p<<g^255&u[C+1])&b;else{v--;do{C++,p=(p<<g^255&u[C+2])&b,r=65535&d[p],h[C&l]=d[p],d[p]=C}while(0!=--v);C++}if(n&&(se(!1),0===t.tt))return 0}return se(4==e),0===t.tt?4==e?2:0:4==e?3:1})(i);break;case 2:R=(e=>{let n,r,s=0;for(;;){if(Ze>A){if(ie(),Ze>A&&0==e)return 0;if(0===A)break}if(3>A||(p=(p<<g^255&u[C+2])&b,s=65535&d[p],h[C&l]=d[p],d[p]=C),_=v,S=x,v=2,0!==s&&P>_&&f-Ze>=(C-s&65535)&&(2!=V&&(v=oe(s)),5>=v&&(1==V||3==v&&C-x>4096)&&(v=2)),3>_||v>_)if(0!==z){if(n=ee(0,255&u[C-1]),n&&se(!1),C++,A--,0===t.tt)return 0}else z=1,C++,A--;else{r=C+A-3,n=ee(C-1-S,_-3),A-=_-1,_-=2;do{++C>r||(p=(p<<g^255&u[C+2])&b,s=65535&d[p],h[C&l]=d[p],d[p]=C)}while(0!=--_);if(z=0,v=2,C++,n&&(se(!1),0===t.tt))return 0}}return 0!==z&&(n=ee(0,255&u[C-1]),z=0),se(4==e),0===t.tt?4==e?2:0:4==e?3:1})(i)}if(2!=R&&3!=R||(n=Ye),0==R||2==R)return 0===t.tt&&(c=-1),0;if(1==R){if(1==i)X(2,3),Y(256,Le._e),$(),9>1+H+10-F&&(X(2,3),Y(256,Le._e),$()),H=7;else if(re(0,0,!1),3==i)for(o=0;y>o;o++)d[o]=0;if(t.Te(),0===t.tt)return c=-1,0}}return 4!=i?0:1}}function tt(){const e=this;e.nt=0,e.rt=0,e.We=0,e.qe=0,e.tt=0,e.Ge=0}function nt(e){const t=new tt,n=(o=e&&e.chunkSize?e.chunkSize:65536)+5*(r.floor(o/16383)+1);var o;const c=new i(n);let f=e?e.level:-1;void 0===f&&(f=-1),t.He(f),t.$e=c,this.append=(e,r)=>{let o,f,a=0,l=0,u=0;const w=[];if(e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,o=t.Ye(0),0!=o)throw new s("deflating: "+t.Le);t.rt&&(t.rt==n?w.push(new i(c)):w.push(c.subarray(0,t.rt))),u+=t.rt,r&&t.nt>0&&t.nt!=a&&(r(t.nt),a=t.nt)}while(t.We>0||0===t.tt);return w.length>1?(f=new i(u),w.forEach((e=>{f.set(e,l),l+=e.length}))):f=w[0]?new i(w[0]):new i,f}},this.flush=()=>{let e,r,o=0,f=0;const a=[];do{if(t.rt=0,t.tt=n,e=t.Ye(4),1!=e&&0!=e)throw new s("deflating: "+t.Le);n-t.tt>0&&a.push(c.slice(0,t.rt)),f+=t.rt}while(t.We>0||0===t.tt);return t.Qe(),r=new i(f),a.forEach((e=>{r.set(e,o),o+=e.length})),r}}tt.prototype={He(e,t){const n=this;return n.Fe=new et,t||(t=15),n.Fe.He(n,e,t)},Ye(e){const t=this;return t.Fe?t.Fe.Ye(t,e):Oe},Qe(){const e=this;if(!e.Fe)return Oe;const t=e.Fe.Qe();return e.Fe=null,t},Xe(e,t){const n=this;return n.Fe?n.Fe.Xe(n,e,t):Oe},Ze(e,t){const n=this;return n.Fe?n.Fe.Ze(n,e,t):Oe},je(e,t,n){const r=this;let s=r.We;return s>n&&(s=n),0===s?0:(r.We-=s,e.set(r.et.subarray(r.nt,r.nt+s),t),r.nt+=s,r.qe+=s,s)},Te(){const e=this;let t=e.Fe.pending;t>e.tt&&(t=e.tt),0!==t&&(e.$e.set(e.Fe.Ke.subarray(e.Fe.Je,e.Fe.Je+t),e.rt),e.rt+=t,e.Fe.Je+=t,e.Ge+=t,e.tt-=t,e.Fe.pending-=t,0===e.Fe.pending&&(e.Fe.Je=0))}};const rt=-2,st=-3,it=-5,ot=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],ct=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,8
14000,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],ft=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],at=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],lt=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],ut=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],wt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function ht(){let e,t,n,r,s,i;function o(e,t,o,c,f,a,l,u,w,h,d){let p,y,m,b,g,k,v,S,z,C,x,A,_,I,P;C=0,g=o;do{n[e[t+C]]++,C++,g--}while(0!==g);if(n[0]==o)return l[0]=-1,u[0]=0,0;for(S=u[0],k=1;15>=k&&0===n[k];k++);for(v=k,k>S&&(S=k),g=15;0!==g&&0===n[g];g--);for(m=g,S>g&&(S=g),u[0]=S,I=1<<k;g>k;k++,I<<=1)if(0>(I-=n[k]))return st;if(0>(I-=n[g]))return st;for(n[g]+=I,i[1]=k=0,C=1,_=2;0!=--g;)i[_]=k+=n[C],_++,C++;g=0,C=0;do{0!==(k=e[t+C])&&(d[i[k]++]=g),C++}while(++g<o);for(o=i[m],i[0]=g=0,C=0,b=-1,A=-S,s[0]=0,x=0,P=0;m>=v;v++)for(p=n[v];0!=p--;){for(;v>A+S;){if(b++,A+=S,P=m-A,P=P>S?S:P,(y=1<<(k=v-A))>p+1&&(y-=p+1,_=v,P>k))for(;++k<P&&(y<<=1)>n[++_];)y-=n[_];if(P=1<<k,h[0]+P>1440)return st;s[b]=x=h[0],h[0]+=P,0!==b?(i[b]=g,r[0]=k,r[1]=S,k=g>>>A-S,r[2]=x-s[b-1]-k,w.set(r,3*(s[b-1]+k))):l[0]=x}for(r[1]=v-A,o>C?d[C]<c?(r[0]=256>d[C]?0:96,r[2]=d[C++]):(r[0]=a[d[C]-c]+16+64,r[2]=f[d[C++]-c]):r[0]=192,y=1<<v-A,k=g>>>A;P>k;k+=y)w.set(r,3*(x+k));for(k=1<<v-1;g&k;k>>>=1)g^=k;for(g^=k,z=(1<<A)-1;(g&z)!=i[b];)b--,A-=S,z=(1<<A)-1}return 0!==I&&1!=m?it:0}function c(o){let c;for(e||(e=[],t=[],n=new f(16),r=[],s=new f(15),i=new f(16)),t.length<o&&(t=[]),c=0;o>c;c++)t[c]=0;for(c=0;16>c;c++)n[c]=0;for(c=0;3>c;c++)r[c]=0;s.set(n.subarray(0,15),0),i.set(n.subarray(0,16),0)}this.st=(n,r,s,i,f)=>{let a;return c(19),e[0]=0,a=o(n,0,19,19,null,null,s,r,i,e,t),a==st?f.Le="oversubscribed dynamic bit lengths tree":a!=it&&0!==r[0]||(f.Le="incomplete dynamic bit lengths tree",a=st),a},this.it=(n,r,s,i,f,a,l,u,w)=>{let h;return c(288),e[0]=0,h=o(s,0,n,257,at,lt,a,i,u,e,t),0!=h||0===i[0]?(h==st?w.Le="oversubscribed literal/length tree":-4!=h&&(w.Le="incomplete literal/length tree",h=st),h):(c(288),h=o(s,n,r,0,ut,wt,l,f,u,e,t),0!=h||0===f[0]&&n>257?(h==st?w.Le="oversubscribed distance tree":h==it?(w.Le="incomplete distance tree",h=st):-4!=h&&(w.Le="empty distance tree with lengths",h=st),h):0)}}function dt(){const e=this;let t,n,r,s,i=0,o=0,c=0,f=0,a=0,l=0,u=0,w=0,h=0,d=0;function p(e,t,n,r,s,i,o,c){let f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z;d=c.nt,p=c.We,w=o.ot,h=o.ct,y=o.write,m=y<o.read?o.read-y-1:o.end-y,b=ot[e],g=ot[t];do{for(;20>h;)p--,w|=(255&c.ft(d++))<<h,h+=8;if(f=w&b,a=n,l=r,z=3*(l+f),0!==(u=a[z]))for(;;){if(w>>=a[z+1],h-=a[z+1],16&u){for(u&=15,k=a[z+2]+(w&ot[u]),w>>=u,h-=u;15>h;)p--,w|=(255&c.ft(d++))<<h,h+=8;for(f=w&g,a=s,l=i,z=3*(l+f),u=a[z];;){if(w>>=a[z+1],h-=a[z+1],16&u){for(u&=15;u>h;)p--,w|=(255&c.ft(d++))<<h,h+=8;if(v=a[z+2]+(w&ot[u]),w>>=u,h-=u,m-=k,v>y){S=y-v;do{S+=o.end}while(0>S);if(u=o.end-S,k>u){if(k-=u,y-S>0&&u>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--u);else o.lt.set(o.lt.subarray(S,S+u),y),y+=u,S+=u,u=0;S=0}}else S=y-v,y-S>0&&2>y-S?(o.lt[y++]=o.lt[S++],o.lt[y++]=o.lt[S++],k-=2):(o.lt.set(o.lt.subarray(S,S+2),y),y+=2,S+=2,k-=2);if(y-S>0&&k>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--k);else o.lt.set(o.lt.subarray(S,S+k),y),y+=k,S+=k,k=0;break}if(64&u)return c.Le="invalid distance code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,st;f+=a[z+2],f+=w&ot[u],z=3*(l+f),u=a[z]}break}if(64&u)return 32&u?(k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,1):(c.Le="invalid literal/length code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,st);if(f+=a[z+2],f+=w&ot[u],z=3*(l+f),0===(u=a[z])){w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--;break}}else w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--}while(m>=258&&p>=10);return k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,0}e.init=(e,i,o,c,f,a)=>{t=0,u=e,w=i,r=o,h=c,s=f,d=a,n=null},e.ut=(e,y,m)=>{let b,g,k,v,S,z,C,x=0,A=0,_=0;for(_=y.nt,v=y.We,x=e.ot,A=e.ct,S=e.write,z=S<e.read?e.read-S-1:e.end-S;;)switch(t){case 0:if(z>=258&&v>=10&&(e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,m=p(u,w,r,h,s,d,e,y),_=y.nt,v=y.We,x=e.ot,A=e.ct,S=e.write,z=S<e.read?e.read-S-1:e.end-S,0!=m)){t=1==m?7:9;break}c=u,n=r,o=h,t=1;case 1:for(b=c;b>A;){if(0===v)return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(_++))<<A,A+=8}if(g=3*(o+(x&ot[b])),x>>>=n[g+1],A-=n[g+1],k=n[g],0===k){f=n[g+2],t=6;break}if(16&k){a=15&k,i=n[g+2],t=2;break}if(!(64&k)){c=k,o=g/3+n[g+2];break}if(32&k){t=7;break}return t=9,y.Le="invalid literal/length code",m=st,e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);case 2:for(b=a;b>A;){if(0===v)return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(_++))<<A,A+=8}i+=x&ot[b],x>>=b,A-=b,c=w,n=s,o=d,t=3;case 3:for(b=c;b>A;){if(0===v)return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(_++))<<A,A+=8}if(g=3*(o+(x&ot[b])),x>>=n[g+1],A-=n[g+1],k=n[g],16&k){a=15&k,l=n[g+2],t=4;break}if(!(64&k)){c=k,o=g/3+n[g+2];break}return t=9,y.Le="invalid distance code",m=st,e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);case 4:for(b=a;b>A;){if(0===v)return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(_++))<<A,A+=8}l+=x&ot[b],x>>=b,A-=b,t=5;case 5:for(C=S-l;0>C;)C+=e.end;for(;0!==i;){if(0===z&&(S==e.end&&0!==e.read&&(S=0,z=S<e.read?e.read-S-1:e.end-S),0===z&&(e.write=S,m=e.wt(y,m),S=e.write,z=S<e.read?e.read-S-1:e.end-S,S==e.end&&0!==e.read&&(S=0,z=S<e.read?e.read-S-1:e.end-S),0===z)))return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);e.lt[S++]=e.lt[C++],z--,C==e.end&&(C=0),i--}t=0;break;case 6:if(0===z&&(S==e.end&&0!==e.read&&(S=0,z=S<e.read?e.read-S-1:e.end-S),0===z&&(e.write=S,m=e.wt(y,m),S=e.write,z=S<e.read?e.read-S-1:e.end-S,S==e.end&&0!==e.read&&(S=0,z=S<e.read?e.read-S-1:e.end-S),0===z)))return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);m=0,e.lt[S++]=f,z--,t=0;break;case 7:if(A>
14007&&(A-=8,v++,_--),e.write=S,m=e.wt(y,m),S=e.write,z=S<e.read?e.read-S-1:e.end-S,e.read!=e.write)return e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);t=8;case 8:return m=1,e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);case 9:return m=st,e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m);default:return m=rt,e.ot=x,e.ct=A,y.We=v,y.qe+=_-y.nt,y.nt=_,e.write=S,e.wt(y,m)}},e.ht=()=>{}}ht.dt=(e,t,n,r)=>(e[0]=9,t[0]=5,n[0]=ct,r[0]=ft,0);const pt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function yt(e,t){const n=this;let r,s=0,o=0,c=0,a=0;const l=[0],u=[0],w=new dt;let h=0,d=new f(4320);const p=new ht;n.ct=0,n.ot=0,n.lt=new i(t),n.end=t,n.read=0,n.write=0,n.reset=(e,t)=>{t&&(t[0]=0),6==s&&w.ht(e),s=0,n.ct=0,n.ot=0,n.read=n.write=0},n.reset(e,null),n.wt=(e,t)=>{let r,s,i;return s=e.rt,i=n.read,r=(i>n.write?n.end:n.write)-i,r>e.tt&&(r=e.tt),0!==r&&t==it&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r,i==n.end&&(i=0,n.write==n.end&&(n.write=0),r=n.write-i,r>e.tt&&(r=e.tt),0!==r&&t==it&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r),e.rt=s,n.read=i,t},n.ut=(e,t)=>{let i,f,y,m,b,g,k,v;for(m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=g<n.read?n.read-g-1:n.end-g;;){let S,z,C,x,A,_,I,P;switch(s){case 0:for(;3>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}switch(i=7&f,h=1&i,i>>>1){case 0:f>>>=3,y-=3,i=7&y,f>>>=i,y-=i,s=1;break;case 1:S=[],z=[],C=[[]],x=[[]],ht.dt(S,z,C,x),w.init(S[0],z[0],C[0],0,x[0],0),f>>>=3,y-=3,s=6;break;case 2:f>>>=3,y-=3,s=3;break;case 3:return f>>>=3,y-=3,s=9,e.Le="invalid block type",t=st,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t)}break;case 1:for(;32>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}if((~f>>>16&65535)!=(65535&f))return s=9,e.Le="invalid stored block lengths",t=st,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);o=65535&f,f=y=0,s=0!==o?2:0!==h?7:0;break;case 2:if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(0===k&&(g==n.end&&0!==n.read&&(g=0,k=g<n.read?n.read-g-1:n.end-g),0===k&&(n.write=g,t=n.wt(e,t),g=n.write,k=g<n.read?n.read-g-1:n.end-g,g==n.end&&0!==n.read&&(g=0,k=g<n.read?n.read-g-1:n.end-g),0===k)))return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(t=0,i=o,i>b&&(i=b),i>k&&(i=k),n.lt.set(e.je(m,i),g),m+=i,b-=i,g+=i,k-=i,0!=(o-=i))break;s=0!==h?7:0;break;case 3:for(;14>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}if(c=i=16383&f,(31&i)>29||(i>>5&31)>29)return s=9,e.Le="too many length or distance symbols",t=st,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(i=258+(31&i)+(i>>5&31),!r||r.length<i)r=[];else for(v=0;i>v;v++)r[v]=0;f>>>=14,y-=14,a=0,s=4;case 4:for(;4+(c>>>10)>a;){for(;3>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}r[pt[a++]]=7&f,f>>>=3,y-=3}for(;19>a;)r[pt[a++]]=0;if(l[0]=7,i=p.st(r,l,u,d,e),0!=i)return(t=i)==st&&(r=null,s=9),n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);a=0,s=5;case 5:for(;i=c,258+(31&i)+(i>>5&31)>a;){let o,w;for(i=l[0];i>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}if(i=d[3*(u[0]+(f&ot[i]))+1],w=d[3*(u[0]+(f&ot[i]))+2],16>w)f>>>=i,y-=i,r[a++]=w;else{for(v=18==w?7:w-14,o=18==w?11:3;i+v>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<<y,y+=8}if(f>>>=i,y-=i,o+=f&ot[v],f>>>=v,y-=v,v=a,i=c,v+o>258+(31&i)+(i>>5&31)||16==w&&1>v)return r=null,s=9,e.Le="invalid bit length repeat",t=st,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w=16==w?r[v-1]:0;do{r[v++]=w}while(0!=--o);a=v}}if(u[0]=-1,A=[],_=[],I=[],P=[],A[0]=9,_[0]=6,i=c,i=p.it(257+(31&i),1+(i>>5&31),r,A,_,I,P,d,e),0!=i)return i==st&&(r=null,s=9),t=i,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w.init(A[0],_[0],d,I[0],d,P[0]),s=6;case 6:if(n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,1!=(t=w.ut(n,e,t)))return n.wt(e,t);if(t=0,w.ht(e),m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=g<n.read?n.read-g-1:n.end-g,0===h){s=0;break}s=7;case 7:if(n.write=g,t=n.wt(e,t),g=n.write,k=g<n.read?n.read-g-1:n.end-g,n.read!=n.write)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);s=8;case 8:return t=1,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);case 9:return t=st,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);default:return t=rt,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t)}}},n.ht=e=>{n.reset(e,null),n.lt=null,d=null},n.yt=(e,t,r)=>{n.lt.set(e.subarray(t,t+r),0),n.read=n.write=r},n.bt=()=>1==s?1:0}const mt=13,bt=[0,0,255,255];function gt(){const e=this;function t(e){return e&&e.gt?(e.qe=e.Ge=0,e.Le=null,e.gt.mode=7,e.gt.kt.reset(e,null),0):rt}e.mode=0,e.method=0,e.vt=[0],e.St=0,e.marker=0,e.zt=0,e.Ct=t=>(e.kt&&e.kt.ht(t),e.kt=null,0),e.xt=(n,r)=>(n.Le=null,e.kt=null,8>r||r>15?(e.Ct(n),rt):(e.zt=r,n.gt.kt=new yt(n,1<<r),t(n),0)),e.At=(e,t)=>{let n,r;if(!e||!e.gt||!e.et)return rt;const s=e.gt;for(t=4==t?it:0,n=it;;)switch(s.mode){case 0:if(0===e.We)return n;if(n=t,e.We--,e.qe++,8!=(15&(s.method=e.ft(e.nt++)))){s.mode=mt,e.Le="unknown compression method",s.marker=5;break}if(8+(s.method>>4)>s.zt){s.mode=mt,e.Le="invalid win size",s.marker=5;break}s.mode=1;case 1:if(0===e.We)return n;if(n=t,e.We--,e.qe++,r=255&e.ft(e.nt++),((s.method<<8)+r)%31!=0){s.mode=mt,e.Le="incorrect header check",s.marker=5;break}if(!(32&r)){s.mode=7;break}s.mode=2;case 2:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St=(255&e.ft(e.nt++))<<24&4278190080,s.mode=3;case 3:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<16&16711680,s.mode=4;case 4:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<8&65280,s.mode=5;case 5:return 0===e.We?n:(n=t,e.We--,e.qe++,s.St+=255&e.ft(e.nt++),s.mode=6,2);case 6:return s.mode=mt,e.Le="need dictionary",s.marker=0,rt;case 7:if(n=s.kt.ut(e,n),n==st){s.mode=mt,s.marker=0;break}if(0==n&&(n=t),1!=n)return n;n=t,s.kt.reset(e,s.vt),s.mode=12;case 12:return e.We=0,1;case mt:return st;default:return rt}},e._t=(e,t,n)=>{let r=0,s=n;if(!e||!e.gt||6!=e.gt.mode)return rt;const i=e.gt;return s<1<<i.zt||(s=(1<<i.zt)-1,r=n-s),i.kt.yt(t,r,s),i.mode=7,0},e.It=e=>{let n,r,s,i,o;if(!e||!e.gt)return rt;const c=e.gt;if(c.mode!=mt&&(c.mode=mt,c.marker=0),0===(n=e.We))return it;for(r=e.nt,s=c.marker;0!==n&&4>s;)e.ft(r)==bt[s]?s++:s=0!==e.ft(r)?0:4-s,r++,n--;return e.qe+=r-e.nt,e.nt=r,e.We=n,c.marker=s,4!=s?st:(i=e.qe,o=e.Ge,t(e),e.qe=i,e.Ge=o,c.mode=7,0)},e.Pt=e=>e&&e.gt&&e.gt.kt?e.gt.kt.bt():rt}function kt(){}function vt(e){const t=new kt,n=e&&e.chunkSize?r.floor(2*e.chunkSize):131072,o=new i(n);let c=!1;t.xt(),t.$e=o,this.append=(e,r)=>{const f=[];let a,l,u=0,w=0,h=0;if(0!==e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,0!==t.We||c||(t.nt=0,c=!0),a=t.At(0),c&&a===it){if(0!==t.We)throw new s("inflating: bad input")}else if(0!==a&&1!==a)throw new s("inflating: "+t.Le);
1400if((c||1===a)&&t.We===e.length)throw new s("inflating: bad input");t.rt&&(t.rt===n?f.push(new i(o)):f.push(o.subarray(0,t.rt))),h+=t.rt,r&&t.nt>0&&t.nt!=u&&(r(t.nt),u=t.nt)}while(t.We>0||0===t.tt);return f.length>1?(l=new i(h),f.forEach((e=>{l.set(e,w),w+=e.length}))):l=f[0]?new i(f[0]):new i,l}},this.flush=()=>{t.Ct()}}kt.prototype={xt(e){const t=this;return t.gt=new gt,e||(e=15),t.gt.xt(t,e)},At(e){const t=this;return t.gt?t.gt.At(t,e):rt},Ct(){const e=this;if(!e.gt)return rt;const t=e.gt.Ct(e);return e.gt=null,t},It(){const e=this;return e.gt?e.gt.It(e):rt},_t(e,t){const n=this;return n.gt?n.gt._t(n,e,t):rt},ft(e){return this.et[e]},je(e,t){return this.et.subarray(e,e+t)}},self.initCodec=()=>{self.Deflate=nt,self.Inflate=vt};
1401`,s=()=>e.useDataURI?"data:text/javascript,"+encodeURIComponent(r):URL.createObjectURL(new Blob([r],{type:"text/javascript"}));t({workerScripts:{inflate:[s],deflate:[s]}})}var Fd="Writer iterator completed too soon";var Gv="text/plain";var Vv="Content-Type";var Kv=64*1024,Pd="writable",si=class{constructor(){this.size=0}init(){this.initialized=!0}},pr=class extends si{get readable(){let e=this,{chunkSize:r=Kv}=e,s=new ReadableStream({start(){this.chunkOffset=0},async pull(c){let{offset:f=0,size:i,diskNumberStart:d}=s,{chunkOffset:n}=this,o=i===Oe?r:Math.min(r,i-n),a=await Ot(e,f+n,o,d);c.enqueue(a),n+r>i||i===Oe&&!a.length&&o?c.close():this.chunkOffset+=r}});return s}};var cn=class extends pr{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,r){let s=this,c=e+r,i=await(e||c<s.size?s.blob.slice(e,c):s.blob).arrayBuffer();return i.byteLength>r&&(i=i.slice(e,c)),new Uint8Array(i)}},Ft=class extends si{constructor(e){super();let r=this,s=new TransformStream,c=[];e&&c.push([Vv,e]),Object.defineProperty(r,Pd,{get(){return s.writable}}),r.blob=new Response(s.readable,{headers:c}).blob()}getData(){return this.blob}},yn=class extends cn{constructor(e){super(new Blob([e],{type:Gv}))}};var Mr=class extends pr{constructor(e){super(),Object.assign(this,{array:e,size:e.length})}readUint8Array(e,r){return this.array.slice(e,e+r)}};var po=class extends pr{constructor(e){super(),this.readers=e}async init(){let e=this,{readers:r}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(r.map(async(s,c)=>{await s.init(),c!=r.length-1&&(e.lastDiskOffset+=s.size),e.size+=s.size})),super.init()}async readUint8Array(e,r,s=0){let c=this,{readers:f}=this,i,d=s;d==-1&&(d=f.length-1);let n=e;for(;n>=f[d].size;)n-=f[d].size,d++;let o=f[d],a=o.size;if(n+r<=a)i=await Ot(o,n,r);else{let l=a-n;i=new Uint8Array(r),i.set(await Ot(o,n,l)),i.set(await c.readUint8Array(e+l,r-l,s),l)}return c.lastDiskNumber=Math.max(d,c.lastDiskNumber),i}},ai=class extends si{constructor(e,r=4294967295){super();let s=this;Object.assign(s,{diskNumber:0,diskOffset:0,size:0,maxSize:r,availableSize:r});let c,f,i,d=new WritableStream({async write(a){let{availableSize:l}=s;if(i)a.length>=l?(await n(a.slice(0,l)),await o(),s.diskOffset+=c.size,s.diskNumber++,i=null,await this.write(a.slice(l))):await n(a);else{let{value:u,done:h}=await e.next();if(h&&!u)throw new Error(Fd);c=u,c.size=0,c.maxSize&&(s.maxSize=c.maxSize),s.availableSize=s.maxSize,await bn(c),f=u.writable,i=f.getWriter(),await this.write(a)}},async close(){await i.ready,await o()}});Object.defineProperty(s,Pd,{get(){return d}});async function n(a){let l=a.length;l&&(await i.ready,await i.write(a),c.size+=l,s.size+=l,s.availableSize-=l)}async function o(){f.size=c.size,await i.close()}}};async function bn(t,e){if(t.init&&!t.initialized)await t.init(e);else return Promise.resolve()}function go(t){return Array.isArray(t)&&(t=new po(t)),t instanceof ReadableStream&&(t={readable:t}),t}function mo(t){t.writable===Oe&&typeof t.next==Tn&&(t=new ai(t)),t instanceof WritableStream&&(t={writable:t});let{writable:e}=t;return e.size===Oe&&(e.size=0),t instanceof ai||Object.assign(t,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),t}function Ot(t,e,r,s){return t.readUint8Array(e,r,s)}var Bd="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ".split(""),Yv=Bd.length==256;function Hd(t){if(Yv){let e="";for(let r=0;r<t.length;r++)e+=Bd[t[r]];return e}else return new TextDecoder().decode(t)}function li(t,e){return e&&e.trim().toLowerCase()=="cp437"?Hd(t):new TextDecoder(e).decode(t)}var la="filename",ca="rawFilename",ua="comment",da="rawComment",ha="uncompressedSize",fa="compressedSize",pa="offset",vo="diskNumberStart",Lr="lastModDate",yo="rawLastModDate",ci="lastAccessDate",Ud="rawLastAccessDate",ui="creationDate",Wd="rawCreationDate",ga="internalFileAttribute",ma="internalFileAttributes",va="externalFileAttribute",ya="externalFileAttributes",ba="msDosCompatible",bo="zip64",wa="encrypted",xa="version",Sa="versionMadeBy",Ea="zipCrypto",Ca="directory",_a="executable",Zv=[la,ca,fa,ha,Lr,yo,ua,da,ci,ui,pa,vo,vo,ga,ma,va,ya,ba,bo,wa,xa,Sa,Ea,Ca,_a,"bitFlag","signature","filenameUTF8","commentUTF8","compressionMethod","extraField","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"],Fn=class{constructor(e){Zv.forEach(r=>this[r]=e[r])}};var wo="File format is not recognized",Vd="End of central directory not found",Kd="End of Zip64 central directory locator not found",Yd="Central directory header not found",Zd="Local file header not found",Xd="Zip64 extra field not found",qd="File contains encrypted entry",Jd="Encryption method not supported",Ta="Compression method not supported",ka="Split zip file",zd="utf-8",jd="cp437",Qv=[[ha,4294967295],[fa,4294967295],[pa,4294967295],[vo,65535]],ey={[65535]:{getValue:gt,bytes:4},[4294967295]:{getValue:xo,bytes:8}},Ir=class{constructor(e,r={}){Object.assign(this,{reader:go(e),options:r,config:Jr()})}async*getEntriesGenerator(e={}){let r=this,{reader:s}=r,{config:c}=r;if(await bn(s),(s.size===Oe||!s.readUint8Array)&&(s=new cn(await new Response(s.readable).blob()),await bn(s)),s.size<22)throw new Error(wo);s.chunkSize=Ji(c);let f=await oy(s,101010256,s.size,22,65535*16);if(!f){let R=await Ot(s,0,4),M=Lt(R);throw gt(M)==134695760?new Error(ka):new Error(Vd)}let i=Lt(f),d=gt(i,12),n=gt(i,16),o=f.offset,a=Mt(i,20),l=o+22+a,u=Mt(i,4),h=s.lastDiskNumber||0,p=Mt(i,6),g=Mt(i,8),m=0,y=0;if(n==4294967295||d==4294967295||g==65535||p==65535){let R=await Ot(s,f.offset-20,20),M=Lt(R);if(gt(M,0)==117853008){n=xo(M,8);let A=await Ot(s,n,56,-1),_=Lt(A),O=f.offset-20-56;if(gt(_,0)!=101075792&&n!=O){let D=n;n=O,m=n-D,A=await Ot(s,n,56,-1),_=Lt(A)}if(gt(_,0)!=101075792)throw new Error(Kd);u==65535&&(u=gt(_,16)),p==65535&&(p=gt(_,20)),g==65535&&(g=xo(_,32)),d==4294967295&&(d=xo(_,40)),n-=d}}if(n>=s.size&&(m=s.size-n-d-22,n=s.size-d-22),h!=u)throw new Error(ka);if(n<0)throw new Error(wo);let b=0,C=await Ot(s,n,d,p),E=Lt(C);if(d){let R=f.offset-d;if(gt(E,b)!=33639248&&n!=R){let M=n;n=R,m+=n-M,C=await Ot(s,n,d,p),E=Lt(C)}}let w=f.offset-n-(s.lastDiskOffset||0);if(d!=w&&w>=0&&(d=w,C=await Ot(s,n,d,p),E=Lt(C)),n<0||n>=s.size)throw new Error(wo);let k=jt(r,e,"filenameEncoding"),I=jt(r,e,"commentEncoding");for(let R=0;R<g;R++){let M=new Ma(s,c,r.options);if(gt(E,b)!=33639248)throw new Error(Yd);Qd(M,E,b+6);let A=!!M.bitFlag.languageEncodingFlag,_=b+46,O=_+M.filenameLength,D=O+M.extraFieldLength,B=Mt(E,b+4),P=B>>8==0,H=B>>8==3,W=C.subarray(_,O),K=Mt(E,b+32),G=D+K,X=C.subarray(D,G),Z=A,q=A,Q=gt(E,b+38),ie=P&&(Rr(E,b+38)&16)==16||H&&(Q>>16&16384)==16384||W.length&&W[W.length-1]==hr.charCodeAt(0),ae=H&&(Q>>16&73)==73,oe=gt(E,b+42)+m;Object.assign(M,{versionMadeBy:B,msDosCompatible:P,compressedSize:0,uncompressedSize:0,commentLength:K,directory:ie,offset:oe,diskNumberStart:Mt(E,b+34),internalFileAttributes:Mt(E,b+36),externalFileAttributes:Q,rawFilename:W,filenameUTF8:Z,commentUTF8:q,rawExtraField:C.subarray(O,D),executable:ae}),M.internalFileAttribute=M.internalFileAttributes,M.externalFileAttribute=M.externalFileAttributes;let fe=jt(r,e,"decodeText")||li,he=Z?zd:k||jd,xe=q?zd:I||jd,ke=fe(W,he);ke===Oe&&(ke=li(W,he));let Re=fe(X,xe);
1401Re===Oe&&(Re=li(X,xe)),Object.assign(M,{rawComment:X,filename:ke,comment:Re,directory:ie||ke.endsWith(hr)}),y=Math.max(oe,y),eh(M,M,E,b+6),M.zipCrypto=M.encrypted&&!M.extraFieldAES;let Ce=new Fn(M);Ce.getData=(ue,ut)=>M.getData(ue,Ce,ut),b=G;let{onprogress:Ae}=e;if(Ae)try{await Ae(R+1,g,new Fn(M))}catch{}yield Ce}let L=jt(r,e,"extractPrependedData"),F=jt(r,e,"extractAppendedData");return L&&(r.prependedData=y>0?await Ot(s,0,y):new Uint8Array),r.comment=a?await Ot(s,o+22,a):new Uint8Array,F&&(r.appendedData=l<s.size?await Ot(s,l,s.size-l):new Uint8Array),!0}async getEntries(e={}){let r=[];for await(let s of this.getEntriesGenerator(e))r.push(s);return r}async close(){}};var Ma=class{constructor(e,r,s){Object.assign(this,{reader:e,config:r,options:s})}async getData(e,r,s={}){let c=this,{reader:f,offset:i,diskNumberStart:d,extraFieldAES:n,compressionMethod:o,config:a,bitFlag:l,signature:u,rawLastModDate:h,uncompressedSize:p,compressedSize:g}=c,m=r.localDirectory={},y=await Ot(f,i,30,d),b=Lt(y),C=jt(c,s,"password"),E=jt(c,s,"rawPassword"),w=jt(c,s,"passThrough");if(C=C&&C.length&&C,E=E&&E.length&&E,n&&n.originalCompressionMethod!=99)throw new Error(Ta);if(o!=0&&o!=8&&!w)throw new Error(Ta);if(gt(b,0)!=67324752)throw new Error(Zd);Qd(m,b,4),m.rawExtraField=m.extraFieldLength?await Ot(f,i+30+m.filenameLength,m.extraFieldLength,d):new Uint8Array,eh(c,m,b,4,!0),Object.assign(r,{lastAccessDate:m.lastAccessDate,creationDate:m.creationDate});let k=c.encrypted&&m.encrypted&&!w,I=k&&!n;if(w||(r.zipCrypto=I),k){if(!I&&n.strength===Oe)throw new Error(Jd);if(!C&&!E)throw new Error(qd)}let L=i+30+m.filenameLength+m.extraFieldLength,F=g,R=f.readable;Object.assign(R,{diskNumberStart:d,offset:L,size:F});let M=jt(c,s,"signal"),A=jt(c,s,"checkPasswordOnly");A&&(e=new WritableStream),e=mo(e),await bn(e,w?g:p);let{writable:_}=e,{onstart:O,onprogress:D,onend:B}=s,P={options:{codecType:uo,password:C,rawPassword:E,zipCrypto:I,encryptionStrength:n&&n.strength,signed:jt(c,s,"checkSignature")&&!w,passwordVerification:I&&(l.dataDescriptor?h>>>8&255:u>>>24&255),signature:u,compressed:o!=0&&!w,encrypted:c.encrypted&&!w,useWebWorkers:jt(c,s,"useWebWorkers"),useCompressionStream:jt(c,s,"useCompressionStream"),transferStreams:jt(c,s,"transferStreams"),checkPasswordOnly:A},config:a,streamOptions:{signal:M,size:F,onstart:O,onprogress:D,onend:B}},H=0;try{({outputSize:H}=await fo({readable:R,writable:_},P))}catch(W){if(!A||W.message!=Dn)throw W}finally{let W=jt(c,s,"preventClose");_.size+=H,!W&&!_.locked&&await _.getWriter().close()}return A?Oe:e.getData?e.getData():_}};function Qd(t,e,r){let s=t.rawBitFlag=Mt(e,r+2),c=(s&1)==1,f=gt(e,r+6);Object.assign(t,{encrypted:c,version:Mt(e,r),bitFlag:{level:(s&6)>>1,dataDescriptor:(s&8)==8,languageEncodingFlag:(s&2048)==2048},rawLastModDate:f,lastModDate:sy(f),filenameLength:Mt(e,r+22),extraFieldLength:Mt(e,r+24)})}function eh(t,e,r,s,c){let{rawExtraField:f}=e,i=e.extraField=new Map,d=Lt(new Uint8Array(f)),n=0;try{for(;n<f.length;){let y=Mt(d,n),b=Mt(d,n+2);i.set(y,{type:y,data:f.slice(n+4,n+4+b)}),n+=4+b}}catch{}let o=Mt(r,s+4);Object.assign(e,{signature:gt(r,s+10),uncompressedSize:gt(r,s+18),compressedSize:gt(r,s+14)});let a=i.get(1);a&&(ty(a,e),e.extraFieldZip64=a);let l=i.get(28789);l&&(Gd(l,la,ca,e,t),e.extraFieldUnicodePath=l);let u=i.get(25461);u&&(Gd(u,ua,da,e,t),e.extraFieldUnicodeComment=u);let h=i.get(39169);h?(ny(h,e,o),e.extraFieldAES=h):e.compressionMethod=o;let p=i.get(10);p&&(ry(p,e),e.extraFieldNTFS=p);let g=i.get(21589);g&&(iy(g,e,c),e.extraFieldExtendedTimestamp=g);let m=i.get(6534);m&&(e.extraFieldUSDZ=m)}function ty(t,e){e.zip64=!0;let r=Lt(t.data),s=Qv.filter(([c,f])=>e[c]==f);for(let c=0,f=0;c<s.length;c++){let[i,d]=s[c];if(e[i]==d){let n=ey[d];e[i]=t[i]=n.getValue(r,f),f+=n.bytes}else if(t[i])throw new Error(Xd)}}function Gd(t,e,r,s,c){let f=Lt(t.data),i=new Nn;i.append(c[r]);let d=Lt(new Uint8Array(4));d.setUint32(0,i.get(),!0);let n=gt(f,1);Object.assign(t,{version:Rr(f,0),[e]:li(t.data.subarray(5)),valid:!c.bitFlag.languageEncodingFlag&&n==gt(d,0)}),t.valid&&(s[e]=t[e],s[e+"UTF8"]=!0)}function ny(t,e,r){let s=Lt(t.data),c=Rr(s,4);Object.assign(t,{vendorVersion:Rr(s,0),vendorId:Rr(s,2),strength:c,originalCompressionMethod:r,compressionMethod:Mt(s,5)}),e.compressionMethod=t.compressionMethod}function ry(t,e){let r=Lt(t.data),s=4,c;try{for(;s<t.data.length&&!c;){let f=Mt(r,s),i=Mt(r,s+2);f==1&&(c=t.data.slice(s+4,s+4+i)),s+=4+i}}catch{}try{if(c&&c.length==24){let f=Lt(c),i=f.getBigUint64(0,!0),d=f.getBigUint64(8,!0),n=f.getBigUint64(16,!0);Object.assign(t,{rawLastModDate:i,rawLastAccessDate:d,rawCreationDate:n});let o=Aa(i),a=Aa(d),l=Aa(n),u={lastModDate:o,lastAccessDate:a,creationDate:l};Object.assign(t,u),Object.assign(e,u)}}catch{}}function iy(t,e,r){let s=Lt(t.data),c=Rr(s,0),f=[],i=[];r?((c&1)==1&&(f.push(Lr),i.push(yo)),(c&2)==2&&(f.push(ci),i.push(Ud)),(c&4)==4&&(f.push(ui),i.push(Wd))):t.data.length>=5&&(f.push(Lr),i.push(yo));let d=1;f.forEach((n,o)=>
1401{if(t.data.length>=d+4){let a=gt(s,d);e[n]=t[n]=new Date(a*1e3);let l=i[o];t[l]=a}d+=4})}async function oy(t,e,r,s,c){let f=new Uint8Array(4),i=Lt(f);ay(i,0,e);let d=s+c;return await n(s)||await n(Math.min(d,r));async function n(o){let a=r-o,l=await Ot(t,a,o);for(let u=l.length-s;u>=0;u--)if(l[u]==f[0]&&l[u+1]==f[1]&&l[u+2]==f[2]&&l[u+3]==f[3])return{offset:a+u,buffer:l.slice(u,u+s).buffer}}}function jt(t,e,r){return e[r]===Oe?t.options[r]:e[r]}function sy(t){let e=(t&4294901760)>>16,r=t&65535;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(r&63488)>>11,(r&2016)>>5,(r&31)*2,0)}catch{}}function Aa(t){return new Date(Number(t/BigInt(1e4)-BigInt(116444736e5)))}function Rr(t,e){return t.getUint8(e)}function Mt(t,e){return t.getUint16(e,!0)}function gt(t,e){return t.getUint32(e,!0)}function xo(t,e){return Number(t.getBigUint64(e,!0))}function ay(t,e,r){t.setUint32(e,r,!0)}function Lt(t){return new DataView(t.buffer)}var ah="File already exists",lh="Zip file comment exceeds 64KB",ch="File entry comment exceeds 64KB",uh="File entry name exceeds 64KB",za="Version exceeds 65535",dh="The strength must equal 1, 2, or 3",hh="Extra field type exceeds 65535",fh="Extra field data exceeds 64KB",Io="Zip64 is not supported (make sure 'keepOrder' is set to 'true')",ph="Undefined uncompressed size",ih=new Uint8Array([7,0,2,0,65,69,3,0,0]),Ua=0,oh=[],er=class{constructor(e,r={}){e=mo(e);let s=e.availableSize!==Oe&&e.availableSize>0&&e.availableSize!==1/0&&e.maxSize!==Oe&&e.maxSize>0&&e.maxSize!==1/0;Object.assign(this,{writer:e,addSplitZipSignature:s,options:r,config:Jr(),files:new Map,filenames:new Set,offset:r.offset===Oe?e.writable.size:r.offset,pendingEntriesSize:0,pendingAddFileCalls:new Set,bufferedWrites:0})}async add(e="",r,s={}){let c=this,{pendingAddFileCalls:f,config:i}=c;Ua<i.maxWorkers?Ua++:await new Promise(n=>oh.push(n));let d;try{if(e=e.trim(),c.filenames.has(e))throw new Error(ah);return c.filenames.add(e),d=dy(c,e,r,s),f.add(d),await d}catch(n){throw c.filenames.delete(e),n}finally{f.delete(d);let n=oh.shift();n?n():Ua--}}async close(e=new Uint8Array,r={}){let s=this,{pendingAddFileCalls:c,writer:f}=this,{writable:i}=f;for(;c.size;)await Promise.allSettled(Array.from(c));return await wy(this,e,r),Pe(s,r,"preventClose")||await i.getWriter().close(),f.getData?f.getData():i}};async function dy(t,e,r,s){e=e.trim();let c=Pe(t,s,ba),f=Pe(t,s,Sa,c?20:768),i=Pe(t,s,_a);if(f>65535)throw new Error(za);let d=Pe(t,s,ya,0);d===0&&(d=Pe(t,s,va,0)),!s.directory&&e.endsWith(hr)&&(s.directory=!0),Pe(t,s,Ca)?(e.endsWith(hr)||(e+=hr),d===0&&(c?d=16:d=16384<<16)):!c&&d===0&&(i?d=493<<16:d=420<<16);let o=Pe(t,s,"encodeText",_r),a=o(e);if(a===Oe&&(a=_r(e)),He(a)>65535)throw new Error(uh);let l=s.comment||"",u=o(l);if(u===Oe&&(u=_r(l)),He(u)>65535)throw new Error(ch);let h=Pe(t,s,xa,20);if(h>65535)throw new Error(za);let p=Pe(t,s,Lr,new Date),g=Pe(t,s,ci),m=Pe(t,s,ui),y=Pe(t,s,ma,0);y===0&&(y=Pe(t,s,ga,0));let b=Pe(t,s,"passThrough"),C,E;b||(C=Pe(t,s,"password"),E=Pe(t,s,"rawPassword"));let w=Pe(t,s,"encryptionStrength",3),k=Pe(t,s,Ea),I=Pe(t,s,"extendedTimestamp",!0),L=Pe(t,s,"keepOrder",!0),F=Pe(t,s,"level"),R=Pe(t,s,"useWebWorkers"),M=Pe(t,s,"bufferedWrite"),A=Pe(t,s,"dataDescriptorSignature",!1),_=Pe(t,s,"signal"),O=Pe(t,s,"useUnicodeFileNames",!0),D=Pe(t,s,"useCompressionStream"),B=Pe(t,s,"compressionMethod"),P=Pe(t,s,"dataDescriptor",!0),H=Pe(t,s,bo);if(!k&&(C!==Oe||E!==Oe)&&!(w>=1&&w<=3))throw new Error(dh);let W=new Uint8Array,{extraField:K}=s;if(K){let Me=0,Ue=0;K.forEach(Ve=>
1401Me+=4+He(Ve)),W=new Uint8Array(Me),K.forEach((Ve,Ne)=>{if(Ne>65535)throw new Error(hh);if(He(Ve)>65535)throw new Error(fh);vt(W,new Uint16Array([Ne]),Ue),vt(W,new Uint16Array([He(Ve)]),Ue+2),vt(W,Ve,Ue+4),Ue+=4+He(Ve)})}let G=0,X=0,Z=0;if(b&&({uncompressedSize:Z}=s,Z===Oe))throw new Error(ph);let q=H===!0;r&&(r=go(r),await bn(r),b?G=sh(Z):r.size===Oe?(P=!0,(H||H===Oe)&&(H=!0,Z=G=4294967296)):(Z=r.size,G=sh(Z)));let{diskOffset:Q,diskNumber:ie,maxSize:ae}=t.writer,oe=q||Z>4294967295,fe=q||G>4294967295,he=q||t.offset+t.pendingEntriesSize-Q>4294967295,ke=Pe(t,s,"supportZip64SplitFile",!0)&&q||ie+Math.ceil(t.pendingEntriesSize/ae)>65535;if(he||oe||fe||ke){if(H===!1||!L)throw new Error(Io);H=!0}H=H||!1;let Re=Pe(t,s,wa),{signature:Ce}=s;s=Object.assign({},s,{rawFilename:a,rawComment:u,version:h,versionMadeBy:f,lastModDate:p,lastAccessDate:g,creationDate:m,rawExtraField:W,zip64:H,zip64UncompressedSize:oe,zip64CompressedSize:fe,zip64Offset:he,zip64DiskNumberStart:ke,password:C,rawPassword:E,level:!D&&t.config.CompressionStream===Oe&&t.config.CompressionStreamNative===Oe?0:F,useWebWorkers:R,encryptionStrength:w,extendedTimestamp:I,zipCrypto:k,bufferedWrite:M,keepOrder:L,useUnicodeFileNames:O,dataDescriptor:P,dataDescriptorSignature:A,signal:_,msDosCompatible:c,internalFileAttribute:y,internalFileAttributes:y,externalFileAttribute:d,externalFileAttributes:d,useCompressionStream:D,passThrough:b,encrypted:!!(C&&He(C)||E&&He(E))||b&&Re,signature:Ce,compressionMethod:B});let Ae=py(s),ue=my(s),ut=He(Ae.localHeaderArray,ue.dataDescriptorArray);X=ut+G,t.options.usdz&&(X+=X+64),t.pendingEntriesSize+=X;let Je;try{Je=await hy(t,e,r,{headerInfo:Ae,dataDescriptorInfo:ue,metadataSize:ut},s)}finally{t.pendingEntriesSize-=X}return Object.assign(Je,{name:e,comment:l,extraField:K}),new Fn(Je)}async function hy(t,e,r,s,c){let{files:f,writer:i}=t,{keepOrder:d,dataDescriptor:n,signal:o}=c,{headerInfo:a}=s,{usdz:l}=t.options,u=Array.from(f.values()).pop(),h={},p,g,m,y,b,C,E;f.set(e,h);try{let L;d&&(L=u&&u.lock,w()),(c.bufferedWrite||t.writerLocked||t.bufferedWrites&&d||!n)&&
1401!l?(C=new TransformStream,E=new Response(C.readable).blob(),C.writable.size=0,p=!0,t.bufferedWrites++,await bn(i)):(C=i,await k()),await bn(C);let{writable:F}=i,{diskOffset:R}=i;if(t.addSplitZipSignature){delete t.addSplitZipSignature;let A=new Uint8Array(4),_=Nt(A);Be(_,0,134695760),await In(F,A),t.offset+=4}l&&gy(s,t.offset-R),p||(await L,await I(F));let{diskNumber:M}=i;if(b=!0,h.diskNumberStart=M,h=await fy(r,C,h,s,t.config,c),b=!1,f.set(e,h),h.filename=e,p){await C.writable.getWriter().close();let A=await E;await L,await k(),y=!0,n||(A=await yy(h,A,F,c)),await I(F),h.diskNumberStart=i.diskNumber,R=i.diskOffset,await A.stream().pipeTo(F,{preventClose:!0,preventAbort:!0,signal:o}),F.size+=A.size,y=!1}if(h.offset=t.offset-R,h.zip64)by(h,c);else if(h.offset>4294967295)throw new Error(Io);return t.offset+=h.size,h}catch(L){if(p&&y||!p&&b){if(t.hasCorruptedEntries=!0,L)try{L.corruptedEntry=!0}catch{}p?t.offset+=C.writable.size:t.offset=C.writable.size}throw f.delete(e),L}finally{p&&t.bufferedWrites--,m&&m(),g&&g()}function w(){h.lock=new Promise(L=>m=L)}async function k(){t.writerLocked=!0;let{lockWriter:L}=t;t.lockWriter=new Promise(F=>g=()=>{t.writerLocked=!1,F()}),await L}async function I(L){He(a.localHeaderArray)>i.availableSize&&(i.availableSize=0,await In(L,new Uint8Array))}}async function fy(t,e,{diskNumberStart:r,lock:s},c,f,i){let{headerInfo:d,dataDescriptorInfo:n,metadataSize:o}=c,{localHeaderArray:a,headerArray:l,lastModDate:u,rawLastModDate:h,encrypted:p,compressed:g,version:m,compressionMethod:y,rawExtraFieldExtendedTimestamp:b,extraFieldExtendedTimestampFlag:C,rawExtraFieldNTFS:E,rawExtraFieldAES:w}=d,{dataDescriptorArray:k}=n,{rawFilename:I,lastAccessDate:L,creationDate:F,password:R,rawPassword:M,level:A,zip64:_,zip64UncompressedSize:O,zip64CompressedSize:D,zip64Offset:B,zip64DiskNumberStart:P,zipCrypto:H,dataDescriptor:W,directory:K,executable:G,versionMadeBy:X,rawComment:Z,rawExtraField:q,useWebWorkers:Q,onstart:ie,onprogress:ae,onend:oe,signal:fe,encryptionStrength:he,extendedTimestamp:xe,msDosCompatible:ke,internalFileAttributes:Re,externalFileAttributes:Ce,useCompressionStream:Ae,passThrough:ue}=i,ut={lock:s,versionMadeBy:X,zip64:_,directory:!!K,executable:!!G,filenameUTF8:!0,rawFilename:I,commentUTF8:!0,rawComment:Z,rawExtraFieldExtendedTimestamp:b,rawExtraFieldNTFS:E,rawExtraFieldAES:w,rawExtraField:q,extendedTimestamp:xe,msDosCompatible:ke,internalFileAttributes:Re,externalFileAttributes:Ce,diskNumberStart:r},{signature:Je,uncompressedSize:Me}=i,Ue=0;ue||(Me=0);let{writable:Ve}=e;if(t){t.chunkSize=Ji(f),await In(Ve,a);let Pt=t.readable,se=Pt.size=t.size,ye={options:{codecType:co,level:A,rawPassword:M,password:R,encryptionStrength:he,zipCrypto:p&&H,passwordVerification:p&&H&&h>>8&255,signed:!ue,compressed:g&&!ue,encrypted:p&&!ue,useWebWorkers:Q,useCompressionStream:Ae,transferStreams:!1},config:f,streamOptions:{signal:fe,size:se,onstart:ie,onprogress:ae,onend:oe}},Ee=await fo({readable:Pt,writable:Ve},ye);Ue=Ee.outputSize,ue||(Me=Ee.inputSize,Je=Ee.signature),Ve.size+=Me}else await In(Ve,a);let Ne;if(_){let Pt=4;O&&(Pt+=8),D&&(Pt+=8),B&&(Pt+=8),P&&(Pt+=4),Ne=new Uint8Array(Pt)}else Ne=new Uint8Array;return vy({signature:Je,rawExtraFieldZip64:Ne,compressedSize:Ue,uncompressedSize:Me,headerInfo:d,dataDescriptorInfo:n},i),W&&await In(Ve,k),Object.assign(ut,{uncompressedSize:Me,compressedSize:Ue,lastModDate:u,rawLastModDate:h,creationDate:F,lastAccessDate:L,encrypted:p,zipCrypto:H,size:o+Ue,compressionMethod:y,version:m,headerArray:l,signature:Je,rawExtraFieldZip64:Ne,extraFieldExtendedTimestampFlag:C,zip64UncompressedSize:O,zip64CompressedSize:D,zip64Offset:B,zip64DiskNumberStart:P}),ut}function py(t){let{rawFilename:e,lastModDate:r,lastAccessDate:s,creationDate:c,level:f,zip64:i,zipCrypto:d,useUnicodeFileNames:n,dataDescriptor:o,directory:a,rawExtraField:l,encryptionStrength:u,extendedTimestamp:h,encrypted:p}=t,{version:g,compressionMethod:m}=t,y=!a&&(f>0||f===Oe&&m!==0),b;if(p&&!d){b=new Uint8Array(He(ih)+2);let B=Nt(b);Ge(B,0,39169),vt(b,ih,2),ja(B,8,u)}else b=new Uint8Array;let C,E,w;if(h){E=new Uint8Array(9+(s?4:0)+(c?4:0));let B=Nt(E);
1401Ge(B,0,21589),Ge(B,2,He(E)-4),w=1+(s?2:0)+(c?4:0),ja(B,4,w);let P=5;Be(B,P,Math.floor(r.getTime()/1e3)),P+=4,s&&(Be(B,P,Math.floor(s.getTime()/1e3)),P+=4),c&&Be(B,P,Math.floor(c.getTime()/1e3));try{C=new Uint8Array(36);let H=Nt(C),W=Wa(r);Ge(H,0,10),Ge(H,2,32),Ge(H,8,1),Ge(H,10,24),Yt(H,12,W),Yt(H,20,Wa(s)||W),Yt(H,28,Wa(c)||W)}catch{C=new Uint8Array}}else C=E=new Uint8Array;let k=0;n&&(k=k|2048),o&&(k=k|8),m===Oe&&(m=y?8:0),m==8&&(f>=1&&f<3&&(k=k|6),f>=3&&f<5&&(k=k|1),f===9&&(k=k|2)),i&&(g=g>45?g:45),p&&(k=k|1,d||(g=g>51?g:51,b[9]=m,m=99));let I=new Uint8Array(26),L=Nt(I);Ge(L,0,g),Ge(L,2,k),Ge(L,4,m);let F=new Uint32Array(1),R=Nt(F),M;r<Xs?M=Xs:r>Zs?M=Zs:M=r,Ge(R,0,(M.getHours()<<6|M.getMinutes())<<5|M.getSeconds()/2),Ge(R,2,(M.getFullYear()-1980<<4|M.getMonth()+1)<<5|M.getDate());let A=F[0];Be(L,6,A),Ge(L,22,He(e));let _=He(b,E,C,l);Ge(L,24,_);let O=new Uint8Array(30+He(e)+_),D=Nt(O);return Be(D,0,67324752),vt(O,I,4),vt(O,e,30),vt(O,b,30+He(e)),vt(O,E,30+He(e,b)),vt(O,C,30+He(e,b,E)),vt(O,l,30+He(e,b,E,C)),{localHeaderArray:O,headerArray:I,headerView:L,lastModDate:r,rawLastModDate:A,encrypted:p,compressed:y,version:g,compressionMethod:m,extraFieldExtendedTimestampFlag:w,rawExtraFieldExtendedTimestamp:E,rawExtraFieldNTFS:C,rawExtraFieldAES:b,extraFieldLength:_}}function gy(t,e){let{headerInfo:r}=t,{localHeaderArray:s,extraFieldLength:c}=r,f=Nt(s),i=64-(e+He(s))%64;i<4&&(i+=64);let d=new Uint8Array(i),n=Nt(d);Ge(n,0,6534),Ge(n,2,i-2);let o=s;r.localHeaderArray=s=new Uint8Array(He(o)+i),vt(s,o),vt(s,d,He(o)),f=Nt(s),Ge(f,28,c+i),t.metadataSize+=i}function my(t){let{zip64:e,dataDescriptor:r,dataDescriptorSignature:s}=t,c=new Uint8Array,f,i=0;return r&&(c=new Uint8Array(e?s?24:20:s?16:12),f=Nt(c),s&&(i=4,Be(f,0,134695760))),{dataDescriptorArray:c,dataDescriptorView:f,dataDescriptorOffset:i}}function vy(t,e){let{signature:r,rawExtraFieldZip64:s,compressedSize:c,uncompressedSize:f,headerInfo:i,dataDescriptorInfo:d}=t,{headerView:n,encrypted:o}=i,{dataDescriptorView:a,dataDescriptorOffset:l}=d,{zip64:u,zip64UncompressedSize:h,zip64CompressedSize:p,zipCrypto:g,dataDescriptor:m}=e;if((!o||g)&&r!==Oe&&(Be(n,10,r),m&&Be(a,l,r)),u){let y=Nt(s);Ge(y,0,1),Ge(y,2,He(s)-4);let b=4;h&&(Be(n,18,4294967295),Yt(y,b,BigInt(f)),b+=8),p&&(Be(n,14,4294967295),Yt(y,b,BigInt(c))),m&&(Yt(a,l+4,BigInt(c)),Yt(a,l+12,BigInt(f)))}else Be(n,14,c),Be(n,18,f),m&&(Be(a,l+4,c),Be(a,l+8,f))}async function yy(t,e,r,{zipCrypto:s}){let c;c=await e.slice(0,26).arrayBuffer(),c.byteLength!=26&&(c=c.slice(0,26));let f=new DataView(c);return(!t.encrypted||s)&&Be(f,14,t.signature),t.zip64?(Be(f,18,4294967295),Be(f,22,4294967295)):(Be(f,18,t.compressedSize),Be(f,22,t.uncompressedSize)),await In(r,new Uint8Array(c)),e.slice(c.byteLength)}function by(t,e){let{rawExtraFieldZip64:r,offset:s,diskNumberStart:c}=t,{zip64UncompressedSize:f,zip64CompressedSize:i,zip64Offset:d,zip64DiskNumberStart:n}=e,o=Nt(r),a=4;f&&(a+=8),i&&(a+=8),d&&(Yt(o,a,BigInt(s)),a+=8),n&&Be(o,a,c)}async function wy(t,e,r){let{files:s,writer:c}=t,{diskOffset:f,writable:i}=c,{diskNumber:d}=c,n=0,o=0,a=t.offset-f,l=s.size;for(let[,w]of s){let{rawFilename:k,rawExtraFieldZip64:I,rawExtraFieldAES:L,rawComment:F,rawExtraFieldNTFS:R,rawExtraField:M,extendedTimestamp:A,extraFieldExtendedTimestampFlag:_,lastModDate:O}=w,D;if(A){D=new Uint8Array(9);let B=Nt(D);Ge(B,0,21589),Ge(B,2,5),ja(B,4,_),Be(B,5,Math.floor(O.getTime()/1e3))}else D=new Uint8Array;
1401w.rawExtraFieldCDExtendedTimestamp=D,o+=46+He(k,F,I,L,R,D,M)}let u=new Uint8Array(o),h=Nt(u);await bn(c);let p=0;for(let[w,k]of Array.from(s.values()).entries()){let{offset:I,rawFilename:L,rawExtraFieldZip64:F,rawExtraFieldAES:R,rawExtraFieldCDExtendedTimestamp:M,rawExtraFieldNTFS:A,rawExtraField:_,rawComment:O,versionMadeBy:D,headerArray:B,zip64:P,zip64UncompressedSize:H,zip64CompressedSize:W,zip64DiskNumberStart:K,zip64Offset:G,internalFileAttributes:X,externalFileAttributes:Z,diskNumberStart:q,uncompressedSize:Q,compressedSize:ie}=k,ae=He(F,R,M,A,_);Be(h,n,33639248),Ge(h,n+4,D);let oe=Nt(B);H||Be(oe,18,Q),W||Be(oe,14,ie),vt(u,B,n+6),Ge(h,n+30,ae),Ge(h,n+32,He(O)),Ge(h,n+34,P&&K?65535:q),Ge(h,n+36,X),Z&&Be(h,n+38,Z),Be(h,n+42,P&&G?4294967295:I),vt(u,L,n+46),vt(u,F,n+46+He(L)),vt(u,R,n+46+He(L,F)),vt(u,M,n+46+He(L,F,R)),vt(u,A,n+46+He(L,F,R,M)),vt(u,_,n+46+He(L,F,R,M,A)),vt(u,O,n+46+He(L)+ae);let fe=46+He(L,O)+ae;if(n-p>c.availableSize&&(c.availableSize=0,await In(i,u.slice(p,n)),p=n),n+=fe,r.onprogress)try{await r.onprogress(w+1,s.size,new Fn(k))}catch{}}await In(i,p?u.slice(p):u);let g=c.diskNumber,{availableSize:m}=c;m<22&&g++;let y=Pe(t,r,bo);if(a>4294967295||o>4294967295||l>65535||g>65535){if(y===!1)throw new Error(Io);y=!0}let b=new Uint8Array(y?98:22),C=Nt(b);n=0,y&&(Be(C,0,101075792),Yt(C,4,BigInt(44)),Ge(C,12,45),Ge(C,14,45),Be(C,16,g),Be(C,20,d),Yt(C,24,BigInt(l)),Yt(C,32,BigInt(l)),Yt(C,40,BigInt(o)),Yt(C,48,BigInt(a)),Be(C,56,117853008),Yt(C,64,BigInt(a)+BigInt(o)),Be(C,72,g+1),Pe(t,r,"supportZip64SplitFile",!0)&&(g=65535,d=65535),l=65535,a=4294967295,o=4294967295,n+=76),Be(C,n,101010256),Ge(C,n+4,g),Ge(C,n+6,d),Ge(C,n+8,l),Ge(C,n+10,l),Be(C,n+12,o),Be(C,n+16,a);let E=He(e);if(E)if(E<=65535)Ge(C,n+20,E);else throw new Error(lh);await In(i,b),E&&await In(i,e)}async function In(t,e){let r=t.getWriter();try{await r.ready,t.size+=He(e),await r.write(e)}finally{r.releaseLock()}}function Wa(t){if(t)return(BigInt(t.getTime())+BigInt(116444736e5))*BigInt(1e4)}function Pe(t,e,r,s){let c=e[r]===Oe?t.options[r]:e[r];return c===Oe?s:c}function sh(t){return t+5*(Math.floor(t/16383)+1)}function ja(t,e,r){t.setUint8(e,r)}function Ge(t,e,r){t.setUint16(e,r,!0)}function Be(t,e,r){t.setUint32(e,r,!0)}function Yt(t,e,r){t.setBigUint64(e,r,!0)}function vt(t,e,r){t.set(e,r)}function Nt(t){return new DataView(t.buffer)}function He(...t){let e=0;return t.forEach(r=>r&&(e+=r.length)),e}var ky={},gh;try{gh=ky.url}catch{}Cr({baseURL:gh});Dd(Cr);Cr({Deflate:Du,Inflate:id});var Va="#000000",My=/^#[0-9a-fA-F]{6}$/;var Ly=t=>My.test(t),tr=t=>typeof t=="string"&&Ly(t)?t.toLowerCase():Va,fi=t=>{let e=tr(t);return{r:Number.parseInt(e.slice(1,3),16),g:Number.parseInt(e.slice(3,5),16),b:Number.parseInt(e.slice(5),16)}};var mh=()=>{let t=window.__LUMA_CHAT_CONFIG__;if(!t?.clientBasePath||!t.lumaAssetBasePath)throw new Error("Client asset paths are not configured.");return t},vh=(t,e)=>new URL(t,new URL(e,window.location.origin)).href,yh=t=>vh(t,mh().clientBasePath),pi=t=>vh(t,mh().lumaAssetBasePath);var Ya=30,Do=7056e5,bh=1920,wh=1080,Ry={locateFile:pi,mainScriptUrlOrBlob:pi("luma.js")},ct,qe,st,Sh="",xh="-- BEGIN LUMA WORKFUNC INJECTED: DO NOT CHANGE OR REMOVE",Iy="-- END LUMA WORKFUNC INJECTED",$o="-- BEGIN LUMA ENERG/BRAND INJECTED: DO NOT CHANGE OR REMOVE",Ka="-- END LUMA ENERGY/BRAND INJECTED: DO NOT CHANGE OR REMOVE",Eh=pi("933a1566-890f-4464-a0c8-97922e70ac88.bin"),Ch=pi("18d4590a-a66d-4b3c-afeb-0322eb08a220.bin"),Oo=[0,13,50,255],$y=t=>{let e=Math.floor(t/Do),r=Math.floor(e/60),s=e%60;return`${r}:${s.toString().padStart(2,"0")}`},_h=()=>{let t=document.getElementById("video-duration");if(t&&qe){let e=Number(qe.getDuration());t.textContent=$y(e)}},Oy=t=>{let e=Number(t)/Number(qe.getDuration()),r=document.getElementById("playhead-slider"),s=parseFloat(r.max)*e;r.value=s.toString()},Ah=()=>{let t=document.querySelector("#play-pause-button");t.innerHTML=st.isPlaying()?'<i class="fas fa-pause"></i>':'<i class="fas fa-play"></i>'},Ny=()=>{Ah()};document.getElementById("play-pause-button").onclick=()=>{st.isPlaying()?st.pause():st.play(),Ah()};document.getElementById("playhead-slider").oninput=()=>{let t=Number(document.getElementById("playhead-slider").max),r=Number(document.getElementById("playhead-slider").value)/t,s=Number(qe.getDuration())*r,c=Math.round(s);st.seekTo(BigInt(c))};document.getElementById("seek-to-beginning-button").onclick=()=>{st.seekTo(BigInt(0))};var Dy=()=>{let t=qe.getEditRate();return BigInt(Math.round(t/Ya))},Th=t=>{let r=st.currentTime(ct.CurrentTimePrecision.VIDEO_FRAME_BOUNDARY)+BigInt(t)*Dy();st.seekTo(r<BigInt(0)?BigInt(0):r)};document.getElementById("step-to-prev-frame-button").onclick=()=>{Th(-1)};document.getElementById("step-to-next-frame-button").onclick=()=>{Th(1)};var Fy=t=>{let e=t;return e.startsWith("./")&&(e=e.substring(2)),e.startsWith("/opfs/")&&(e=e.substring(6)),(e.startsWith("/")||e.startsWith("\\"))&&(e=e.substring(1)),e=e.replace(/\\/g,"/"),e};document.getElementById("download-button").onclick=async()=>{let t=qe.sourceFiles(),e=new Ft("application/zip"),r=new er(e);for(let i=0;i<t.size();i++){let d=t.get(i);if(d){let n=d.valueOf(),o=Fy(n),a=await we?.readFile(o,{encoding:"binary"});await r.add(o,new Mr(a))}}let s=qe.toJSON("","10.0");await r.add("CamtasiaAI Project.tscproj",new yn(s));let c=await r.close(),f=document.createElement("a");f.setAttribute("href",URL.createObjectURL(c)),f.setAttribute("download","CamtasiaAI.tscprojzip"),f.style.display="none",document.body.appendChild(f),f.click(),document.body.removeChild(f)};document.getElementById("export-button").onclick=()=>{try{document.getElementById("export-button").disabled=!0,document.getElementById("download-mp4-button")?.classList.remove("export-complete");let t=new ct.MP4ExporterSettings;t.setOutputWidth(qe.getCanvasWidth()),t.setOutputHeight(qe.getCanvasHeight());let e=new ct.RenderOptions,r=new ct.ClientResourcePaths;
1401r.setBackgroundRemovalModelPath(Eh),r.setBackgroundRemovalModelWeightsPath(Ch),e.setClientResourcePaths(r);let s=new ct.MP4Exporter(qe,"/opfs/export.mp4",t,e);s.start();let c=performance.now();s.setProgressHandler(f=>{let i=document.getElementById("export-button");if(i.innerHTML=`<i class="fas fa-file-export"></i> Exporting... ${Math.round(f)}%`,f>=100){console.log("Export finished!");let d=performance.now();console.log(`Export took ${d-c} milliseconds`),document.getElementById("export-button").disabled=!1;let n=document.getElementById("download-mp4-button");n?(n.classList.add("export-complete"),console.log("Download MP4 button shown - export-complete class added")):console.error("Download MP4 button not found"),i.innerHTML='<i class="fas fa-file-export"></i> Export to MP4',document.body.classList.remove("exporting"),s.delete()}})}catch(t){console.error("Error in export process:",t),document.getElementById("export-button").disabled=!1}};document.getElementById("download-mp4-button").onclick=async()=>{try{if(console.log("Download MP4 button clicked"),!we){console.error("wasmStore is not available");return}console.log("Reading export.mp4 file...");let t=await we.readFile("export.mp4",{encoding:"binary"});if(console.log("File data length:",t.length),!t||t.length===0){console.error("No MP4 data found or file is empty");return}let e=new Blob([t],{type:"video/mp4"});console.log("Blob size:",e.size);let r=URL.createObjectURL(e),s=document.createElement("a");s.setAttribute("href",r),s.setAttribute("download","export.mp4"),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(r),1e3),console.log("Download initiated successfully")}catch(t){console.error("Error downloading MP4:",t)}};var kh="lua-energy-level",Py=.15,Mh="lua-brand-color",No=()=>{let t=Number.parseFloat(localStorage.getItem(kh)??"");return Number.isFinite(t)?Math.min(1,Math.max(0,t)):Py},Lh=t=>{let e=Math.min(1,Math.max(0,t));localStorage.setItem(kh,String(e))},Fo=()=>tr(localStorage.getItem(Mh)),Rh=t=>{localStorage.setItem(Mh,tr(t))},Ih=t=>{let e=new ct.SimpleLuaScriptRunner,r=fi(Fo()),s=t;if(t.includes(xh)||(s=`${xh}
1402${Sh}
1403${Iy}
1404
1405`),s.includes($o)){let f=new RegExp(`${$o}[\\s\\S]*?${Ka}`,"g");s=s.replace(f,`${$o}
1406EnergyLevel = ${No()}
1407BrandColorR = ${r.r}
1408BrandColorG = ${r.g}
1409BrandColorB = ${r.b}
1410${Ka}`)}else s+=`${$o}
1411`,s+=`EnergyLevel = ${No()}
1412`,s+=`BrandColorR = ${r.r}
1413`,s+=`BrandColorG = ${r.g}
1414`,s+=`BrandColorB = ${r.b}
1415`,s+=`${Ka}
1416
1417`,s+=t;let c=e.runScript(qe,s);return _h(),{finalLuaScript:s,luaScriptOutput:c.output,hadError:c.hadError}},$h=()=>{if(!st)return;let t=st.currentTime(ct.CurrentTimePrecision.VIDEO_FRAME_BOUNDARY);st.seekTo(t)};var Oh=async()=>{Sh=await(await fetch("/static/workfunc.lua",{cache:"no-store"})).text(),ct=await window.CreateLuma(Ry),await ct.initOPFS(),console.log("Created Luma version",ct.Version.fullVersionString()),await Ac(),document.getElementById("download-mp4-button")?.classList.remove("export-complete"),window.project=new ct.ProjectWithInitialization(Do),qe=window.project,console.log(`Initial project dimensions: ${qe.getCanvasWidth()}x${qe.getCanvasHeight()}`),qe.setCanvasWidth(bh),qe.setCanvasHeight(wh),qe.setCanvasColor(Oo[0],Oo[1],Oo[2],Oo[3]),qe.createNewTrack();let t=new ct.SimpleCanvasThreadContext(!1);await t.init("demoCanvas",Eh,Ch,"",""),st=new ct.AVPreview(t),await st.initForProject(qe);let e=qe.getCanvasWidth(),r=qe.getCanvasHeight(),s=bh,c=wh;if(e!==s||r!==c){let f=s/e,i=c/r,d=Math.min(f,i);console.log(`Project dimensions (${e}x${r}) differ from preview (${s}x${c}). Applying scale: ${d}`),st.setScale(d)}_h(),st.setPlayheadChangedCallback(Oy),st.setPlayStateChangedCallback(Ny),document.querySelectorAll(".menu-dropdown .dropdown-panel button").forEach(f=>{f.addEventListener("click",()=>{document.querySelector(".menu-dropdown")?.classList.remove("active")})})};function Nh(t){for(var e=/\\([a-z]{1,32})(-?\d{1,10})?[ ]?|\\'([0-9a-f]{2})|\\([^a-z])|([{}])|[\r\n]+|(.)|[\u2022]/gi,r=new Set(["aftncn","aftnsep","aftnsepc","annotation","atnauthor","atndate","atnicn","atnid","atnparent","atnref","atntime","atrfend","atrfstart","author","background","bkmkend","bkmkstart","blipuid","buptim","category","colorschememapping","colortbl","comment","company","creatim","datafield","datastore","defchp","defpap","do","doccomm","docvar","dptxbxtext","ebcend","ebcstart","factoidname","falt","fchars","ffdeftext","ffentrymcr","ffexitmcr","ffformat","ffhelptext","ffl","ffname","ffstattext","field","file","filetbl","fldinst","fldrslt","fldtype","fname","fontemb","fontfile","fonttbl","footer","footerf","footerl","footerr","footnote","formfield","ftncn","ftnsep","ftnsepc","g","generator","gridtbl","header","headerf","headerl","headerr","hl","hlfr","hlinkbase","hlloc","hlsrc","hsv","htmltag","info","keycode","keywords","latentstyles","lchars","levelnumbers","leveltext","lfolevel","linkval","list","listlevel","listname","listoverride","listoverridetable","listpicture","liststylename","listtable","listtext","lsdlockedexcept","macc","maccPr","mailmerge","maln","malnScr","manager","margPr","mbar","mbarPr","mbaseJc","mbegChr","mborderBox","mborderBoxPr","mbox","mboxPr","mchr","mcount","mctrlPr","md","mdeg","mdegHide","mden","mdiff","mdPr","me","mendChr","meqArr","meqArrPr","mf","mfName","mfPr","mfunc","mfuncPr","mgroupChr","mgroupChrPr","mgrow","mhideBot","mhideLeft","mhideRight","mhideTop","mhtmltag","mlim","mlimloc","mlimlow","mlimlowPr","mlimupp","mlimuppPr","mm","mmaddfieldname","mmath","mmathPict","mmathPr","mmaxdist","mmc","mmcJc","mmconnectstr","mmconnectstrdata","mmcPr","mmcs","mmdatasource","mmheadersource","mmmailsubject","mmodso","mmodsofilter","mmodsofldmpdata","mmodsomappedname","mmodsoname","mmodsorecipdata","mmodsosort","mmodsosrc","mmodsotable","mmodsoudl","mmodsoudldata","mmodsouniquetag","mmPr","mmquery","mmr","mnary","mnaryPr","mnoBreak","mnum","mobjDist","moMath","moMathPara","moMathParaPr","mopEmu","mphant","mphantPr","mplcHide","mpos","mr","mrad","mradPr","mrPr","msepChr","mshow","mshp","msPre","msPrePr","msSub","msSubPr","msSubSup","msSubSupPr","msSup","msSupPr","mstrikeBLTR","mstrikeH","mstrikeTLBR","mstrikeV","msub","msubHide","msup","msupHide","mtransp","mtype","mvertJc","mvfmf","mvfml","mvtof","mvtol","mzeroAsc","mzeroDesc","mzeroWid","nesttableprops","nextfile","nonesttables","objalias","objclass","objdata","object","objname","objsect","objtime","oldcprops","oldpprops","oldsprops","oldtprops","oleclsid","operator","panose","password","passwordhash","pgp","pgptbl","picprop","pict","pn","pnseclvl","pntext","pntxta","pntxtb","printim","private","propname","protend","protstart","protusertbl","pxe","result","revtbl","revtim","rsidtbl","rxe","shp","shpgrp","shpinst","shppict","shprslt","shptxt","sn","
1417sp","staticval","stylesheet","subject","sv","svb","tc","template","themedata","title","txe","ud","upr","userprops","wgrffmtfilter","windowcaption","writereservation","writereservhash","xe","xform","xmlattrname","xmlattrvalue","xmlclose","xmlname","xmlnstbl","xmlopen"]),s={par:`
1418`,sect:`
1419
1420`,page:`
1421
1422`,line:`
1423`,tab:"	",emdash:"\u2014",endash:"\u2013",emspace:"\u2003",enspace:"\u2002",qmspace:"\u2005",bullet:"\u2022",lquote:"\u2018",rquote:"\u2019",ldblquote:"\u201C",rdblquote:"\u201D"},c=[],f=!1,i=1,d=0,n=[],o,a,l,u,h,p,g;o=e.exec(t);)if([a,l,u,h,p,g]=o.slice(1),p)d=0,p==="{"?c.push([i,f]):p==="}"&&([i,f]=c.pop());else if(h)d=0,h==="~"&&!f?n.push("\xA0"):"{}\\".indexOf(h)!==-1&&!f?n.push(h):h==="*"&&(f=!0);else if(a){if(d=0,r.has(a))f=!0;else if(!f){if(a in s)n.push(s[a]);else if(a==="uc")i=parseInt(l);else if(a==="u"){var m=parseInt(l);m<0&&(m+=65536),m>127,n.push(String.fromCharCode(m)),d=i}}}else if(u){if(d>0)d-=1;else if(!f){var m=parseInt(u,16);m>127,n.push(String.fromCharCode(m))}}else g&&(d>0?d-=1:f||n.push(g));return n.join("")}var Pn=class t extends Error{constructor(r,s){super(r);this.cause=s;this.name="SnagxError"}static pngNotFound(r="No PNG files found in SNAGX archive"){let s=new t(r);return s.name="SnagxPngNotFoundError",s}static invalidFormat(r="SNAGX file is not a valid ZIP archive or PNG file"){let s=new t(r);return s.name="SnagxInvalidFormatError",s}},By=t=>{let e=new Uint8Array(t.slice(0,8));return e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71},Ja=async t=>{let e=new Blob([t]),r=new Ir(new cn(e));try{let s=await r.getEntries(),c,f=s.find(d=>d.filename.toLowerCase()==="metadata.json");if(f?.getData){let n=await(await f.getData(new Ft("application/json"))).text();c=JSON.parse(n)}let i=s.find(d=>d.filename.toLowerCase()==="index.json");if(i?.getData){let n=await(await i.getData(new Ft("application/json"))).text();return{pageFilePath:JSON.parse(n)?.Pages?.[0],entries:s,zipReader:r,metadata:c}}return{entries:s,zipReader:r,metadata:c}}catch(s){throw await r.close(),s}},Dh=8,Za=4,Xa=4,Hy=4,Uy=new Set(["gAMA","cHRM","iCCP"]),Qa=async t=>{try{let e=new Uint8Array(await t.arrayBuffer()),r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(!(r.getUint32(0)===2303741511&&r.getUint32(Za)===218765834))return t;let c=new TextDecoder("latin1"),f=[e.subarray(0,Dh)],i=Dh,d=!1;for(;i+Za+Xa<=e.length;){let n=r.getUint32(i),o=i+Za,a=c.decode(e.subarray(o,o+Xa)),l=o+Xa+n+Hy;if(Uy.has(a)?d=!0:f.push(e.subarray(i,l)),i=l,a==="IEND")break}return d?new Blob(f,{type:"image/png"}):t}catch(e){return console.warn("Failed to strip PNG colour-management chunks; using original image:",e),t}},Ph=async(t,e)=>{try{let r=t instanceof Blob?await t.arrayBuffer():t;try{let{pageFilePath:s,entries:c,zipReader:f}=await Ja(r),i=s?.replace(/\.json$/i,".png");try{let d=e==="thumbnail-first"?[n=>n.filename==="thumbnail.png",n=>n.filename===i,n=>n.filename.toLowerCase().endsWith(".png")&&n.filename!=="thumbnail.png"]:[n=>n.filename===i,n=>n.filename.toLowerCase().endsWith(".png")&&n.filename!=="thumbnail.png",n=>n.filename==="thumbnail.png"];for(let n of d){let o=c.find(n);if(o?.getData){let a=await o.getData(new Ft("image/png"));return await Qa(a)}}throw Pn.pngNotFound("No PNG entry found in SNAGX file")}finally{await f.close()}}catch(s){if(s instanceof Pn)throw s;console.warn("Failed to process as ZIP, trying direct conversion:",s)}try{if(By(r))return new Blob([r],{type:"image/png"})}catch(s){console.warn("Failed to process as direct PNG:",s)}throw Pn.invalidFormat("Could not extract PNG data from SNAGX file")}catch(r){if(console.warn("Failed to process SNAGX file:",r),r instanceof Pn)throw r;let s=e==="thumbnail-first"?"thumbnail":"PNG";throw new Pn(`Failed to extract ${s} from SNAGX: ${r instanceof Error?r.message:"Unknown error"}`,r)}},Fh=t=>Nh(t),el=t=>{if(!t||!("RTFEncodedText"in t))return"";let e=atob(t.RTFEncodedText),r=Fh(e);if(r===""){let s=atob(t.PlaceholderText);return Fh(s)}return r},Wy=async(t,e)=>{if(!e)return null;let r=t.find(s=>s.filename.toLowerCase()===e.toLowerCase());if(r?.getData){let c=await(await r.getData(new Ft("application/json"))).text();return JSON.parse(c)}return null},Bh=t=>!!t?.TemplateFilename?.startsWith("Step_Capture"),zy=async(t,e)=>{if(!e)return!1;let r=await Wy(t,e);return Bh(r)},Hh=async t=>{try{let{pageFilePath:e,entries:r,zipReader:s}=await Ja(t);try{return await zy(r,e)}finally{await s.close()}}catch(e){throw console.warn("Failed to process SNAGX file:",e),e instanceof Error?e:new Pn("Failed to process SNAGX file: Unknown error",e)}},Uh=async t=>Ph(t,"thumbnail-first"),Or=async t=>Ph(t,"primary-first"),jy=(t,e)=>{let r=t.find(c=>c.SectionType==="SectionTypeHeader");if(!r)return"";let s=e.CaptureObjects.find(c=>c.ToolMode==="Text"&&c.SectionID?.includes(r.SectionID));return el(s)},$r=t=>{let e=t.split(",");if(e.length===2){let r=parseFloat(e[0]),s=parseFloat(e[1]);if(!isNaN(r)&&!isNaN(s))return{x:r,y:s}}return null},Gy=async t=>{try{let r=await t.slice(0,24).arrayBuffer(),s=new DataView(r);if(!(s.getUint32(0)===2303741511&&s.getUint32(4)===218765834))return console.warn("Not a valid PNG file"),{width:0,height:0};let f=16,i=20,d=s.getUint32(f),n=s.getUint32(i);return{width:d,height:n}}catch(e){return console.warn("Failed to parse PNG dimensions:",e),{width:0,height:0}}},qa=async t=>typeof Image<"u"?new Promise((e,r)=>{let s=URL.createObjectURL(t),c=new Image;c.onload=()=>
1423{e({width:c.naturalWidth,height:c.naturalHeight}),URL.revokeObjectURL(s)},c.onerror=f=>{URL.revokeObjectURL(s),r(f)},c.src=s}):Gy(t),Vy=t=>"ExportedFromPlatform"in t&&t.ExportedFromPlatform==="mac",Ky=async(t,e,r)=>{let s={title:"",image:null,cursorCoords:null,imagePosition:null,imageSize:null},c=r.CaptureObjects.find(i=>i.ToolMode==="Text"&&i.SectionID?.includes(t.SectionID));s.title=el(c);let f=r.CaptureObjects.find(i=>i.ToolMode==="DropZone"&&i.SectionID?.includes(t.SectionID));if(f&&"Image"in f&&f.Image){let i=atob(f.Image),d=new Uint8Array(i.length);for(let n=0;n<i.length;n++)d[n]=i.charCodeAt(n);s.image=await Qa(new Blob([d],{type:"image/png"})),f.CursorPosition&&(s.cursorCoords=$r(f.CursorPosition)),f.ImagePosition&&(s.imagePosition=$r(f.ImagePosition)),f.ImageSize&&(s.imageSize=$r(f.ImageSize)),s.originalImageSize=await qa(s.image),Vy(r)&&s.cursorCoords&&s.originalImageSize&&(s.cursorCoords.y=-s.cursorCoords.y+s.originalImageSize.height),!e.image&&e.title!==""&&(s.title=`${e.title}. ${s.title}`)}else e.title=e.title!==""?`${e.title}. ${s.title}`:s.title;return s},Yy=t=>{let e=t.match(/^(.+)\.json$/i);return e?.[1]?e[1]:(console.error("Failed to extract GUID from page file path:",t),"")},Zy=async(t,e)=>{try{let r=`${e}/index.json`,s=t.find(d=>d.filename===r);if(!s?.getData)return console.error("Media index not found:",r),[];let f=await(await s.getData(new Ft("application/json"))).text();return JSON.parse(f).Media||[]}catch(r){return console.error("Failed to read media index from",e,r),[]}},Xy=async(t,e,r)=>{try{let s=`${e}/${r}`,c=t.find(i=>i.filename===s);return c?.getData?await c.getData(new Ft("image/png")):null}catch(s){return console.error("Failed to load PNG file:",r,"from",e,s),null}},qy=t=>t.match(/^\{(.+)\}\.png$/i)?.[1]||"",Jy=(t,e)=>t.find(s=>s.ToolMode==="DropZone"&&"ImageGUID"in s&&s.ImageGUID?.toUpperCase()===e.toUpperCase())||null,Qy=(t,e,r)=>t.find(c=>c.ToolMode==="Text"&&"SectionID"in c&&c.SectionID===e&&"DropZoneGroupId"in c&&c.DropZoneGroupId===r)||null,eb=async(t,e,r,s)=>{let c={title:"",image:null,cursorCoords:null,imagePosition:null,imageSize:null},f=r?await Qa(r):null,i=Jy(t.CaptureObjects,e);if(!i)return c.title=`Step ${s}`,c.image=f,f&&(c.originalImageSize=await qa(f)),c;let d=i.SectionID??"",n=i.DropZoneGroupId??0,o=Qy(t.CaptureObjects,d,n);return o?c.title=el(o):c.title=`Step ${s}`,c.image=f,i.CursorPosition&&(c.cursorCoords=$r(i.CursorPosition)),i.ImagePosition&&(c.imagePosition=$r(i.ImagePosition)),i.ImageSize&&(c.imageSize=$r(i.ImageSize)),c.image&&(c.originalImageSize=await qa(c.image)),c},tb=async(t,e,r)=>{if(!e)return{title:"",steps:[]};let s={title:"",steps:[]},c=t.find(f=>f.filename.toLowerCase()===e.toLowerCase());if(c?.getData){let i=await(await c.getData(new Ft("application/json"))).text(),d=JSON.parse(i);if(!Bh(d))return null;let n=d?.Sections?.sort((o,a)=>o.SectionStartY-a.SectionStartY)||[];if(s.title=jy(n,d),r){let o=Yy(e),a=await Zy(t,o),l=1;for(let u of a){let h=qy(u),p=await Xy(t,o,u),g=await eb(d,h,p,l);g.image&&s.steps.push(g),l++}}else{let o=n.filter(l=>l.SectionType==="SectionTypeBody"),a={title:"",image:null,cursorCoords:null,imagePosition:null,imageSize:null};for(let l of o){let u=await Ky(l,a,d);u.image&&(s.steps.push(u),a=u)}}}return s},Wh=async t=>{try{let{pageFilePath:e,entries:r,metadata:s,zipReader:c}=await Ja(t);try{let f=s?.IsMediaCollection===!0;return await tb(r,e,f)}finally{await c.close()}}catch(e){throw console.warn("Failed to process SNAGX file:",e),e instanceof Error?e:new Pn("Failed to process SNAGX file: Unknown error",e)}};var nb=["jpg","jpeg","png"],rb=[...nb,"snagx"],ib=["txt"],ob=["trec","mp4","mov"],gr=[...ob,...rb,...ib],sb=[...gr,"mp3","wav","mp4","mov","tscshadervid","json","trec"],ab=["trec","wav","mp4","mp3"],lb="snagx",un=10,tl=t=>t===0,Po=(t,e)=>{let r=t.toLowerCase();return e.some(s=>r.endsWith(`.${s}`))},gi=t=>Po(t.name,gr),zh=t=>{let e=t.type.toLowerCase(),r=Po(t.name,sb),c=["video/","audio/","text/plain"].some(f=>e.startsWith(f));return r||c},St=t=>{if(!t.includes("."))return!1;let e=t.split(".").pop()?.toLowerCase();return e?gr.includes(e):!1},jh=t=>{let e=[];for(let r of Array.from(t)){if(r?.kind!=="file"||!r.type.startsWith("image/"))continue;let s=r.getAsFile();s&&e.push(s)}return e},Gh=t=>{let e={stepCaptureCandidates:[],trecCandidates:[],uploadable:[],unsupported:[]};for(let r of t)Po(r.name,[lb])&&e.stepCaptureCandidates.push(r),Po(r.name,ab)&&e.trecCandidates.push(r),gi(r)?e.uploadable.push(r):e.unsupported.push(r);return e},Vh=(t,e,r=un)=>{let s=Math.max(0,r-t),c=e.slice(0,s),f=e.length-c.length,i=f>0;return{filesToLoad:c,skippedCount:f,warn:i}};var be=[],Bn=0,dn=[],mi=0,cb=8,ub=36,Zh=()=>gr.filter(t=>St(`file.${t}`)).map(t=>`.${t}`).join(","),db=t=>{let e=new Set(be.map(d=>d.file.name));if(!e.has(t.name))return t;let r=t.name.lastIndexOf("."),s=r>0?t.name.slice(0,r):t.name,c=r>0?t.name.slice(r):"",f=0,i=t.name;for(;e.has(i);){f++;let d=Math.random().toString(ub).slice(2,2+cb);
1423i=`${s}-replacement-${Date.now()}-${f}-${d}${c}`}return new File([t],i,{type:t.type,lastModified:t.lastModified})},Xh=async(t,e={})=>{if(!gi(t)||!St(t.name))throw new Error(`Unsupported image file type: ${t.name}`);if(be.length>=un&&e.allowTransientMediaOverflow!==!0)throw new Error(`Maximum media limit reached (${un}). Remove an image before replacing.`);let r=new Set(be.map(f=>f.file.name)),s=db(t);await Hn(s);let c=be.find(f=>!r.has(f.file.name));if(c)return c.file.name;throw new Error(`Failed to add uploaded image: ${t.name}`)},vi=async t=>{if(t<0||t>=be.length)return;let e=document.getElementById("image-preview-modal"),r=e.querySelector("img"),s=e.querySelector(".image-preview-container"),c=e.querySelector(".image-preview-filename"),i=e.querySelector(".prev-button"),n=e.querySelector(".next-button");Bn=t;let o=be[t];if(!o)return;let a=e.querySelector(".text-preview");if(a&&s.removeChild(a),o.isTextFile){r.style.display="none";let l=document.createElement("textarea");l.className="text-preview",l.readOnly=!0;let u=document.createElement("div");u.className="text-preview-stats";try{let h="";if(Ie){await Ie.init();let m=await Ie.getImage(o.file.name);m&&(h=await m.text())}h||(h=await o.file.text()),l.value=h;let p=h.length,g=h.split(`
1424`).length;u.innerHTML=`${p.toLocaleString()} characters | ${g} lines`,l.addEventListener("scroll",()=>{let m=Math.round(l.scrollTop/(l.scrollHeight-l.clientHeight)*100);isNaN(m)||(u.innerHTML=`${p.toLocaleString()} characters | ${g} lines | Scroll: ${m}%`)})}catch(h){console.error("Error loading text file content:",h),l.value="Error loading text content. Please try again."}s.insertBefore(l,c),s.insertBefore(u,c)}else r.style.display="block",r.src=o.thumbnail,r.alt=o.file.name;c.textContent=o.file.name,i.style.display=t>0?"flex":"none",n.style.display=t<be.length-1?"flex":"none",e.style.display="block"},qh=()=>{let t=[];for(let e of be){let r={path:e.file.name,type:e.file.type};t.push(r)}return JSON.stringify(t)},hb=()=>{let t=new Map,e=localStorage.getItem("timelineScenes");if(!e)return t;try{let r=JSON.parse(e);if(!Array.isArray(r))return t;r.forEach((s,c)=>{if(typeof s.screenshot!="string"||s.screenshot.trim()==="")return;let f=typeof s.sceneNumber=="number"&&Number.isFinite(s.sceneNumber)?s.sceneNumber:c+1,i=t.get(s.screenshot)??[];i.push(f),t.set(s.screenshot,i)})}catch{return t}return t},hn=(t={})=>{let e=t.persistMediaList!==!1,r=hb(),s=document.querySelector(".media-thumbnails");if(s.innerHTML="",be.forEach((i,d)=>{let n=document.createElement("div");n.className="media-thumbnail",n.setAttribute("data-index",d.toString()),n.draggable=!0,n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",`Preview ${i.file.name}, image ${d+1} of ${be.length}`);let o=document.createElement("div");if(o.className="image-wrapper",i.isTextFile){let g=document.createElement("div");g.className="document-icon",g.innerHTML='<i class="fas fa-file-alt fa-2x"></i>',o.appendChild(g)}else{let g=document.createElement("img");g.src=i.thumbnail,g.alt=i.file.name,o.appendChild(g)}let a=async g=>{g.preventDefault(),g.stopPropagation(),await vi(d)};n.addEventListener("click",async g=>{g.target.closest(".remove-button")||await a(g)}),n.addEventListener("keydown",async g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),await a(g))});let l=document.createElement("div");l.className="filename",l.textContent=i.file.name;let u=document.createElement("button"),h=r.get(i.file.name)??[],p=h.length>0;if(u.className="remove-button",u.innerHTML='<i class="fas fa-times"></i>',u.setAttribute("tabindex","0"),p){let g=h.join(", "),m=`Cannot remove ${i.file.name}; it is used by scene ${g}.`;u.disabled=!0,u.title=m,u.setAttribute("aria-label",m)}else{u.setAttribute("aria-label",`Remove ${i.file.name}`);let g=m=>{m.stopPropagation(),!i.isTextFile&&i.thumbnail.startsWith("blob:")&&URL.revokeObjectURL(i.thumbnail),be.splice(d,1),hn()};u.onclick=g,u.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),g(m))})}n.ondragstart=g=>{n.classList.add("dragging"),g.dataTransfer?.setData("text/plain",d.toString())},n.ondragend=()=>{n.classList.remove("dragging"),document.querySelectorAll(".drag-over, .drag-target").forEach(g=>{g.classList.remove("drag-over","drag-target")})},n.ondragover=g=>{g.preventDefault(),g.stopPropagation();let m=document.querySelector(".dragging");if(!m||m===n)return;parseInt(m.getAttribute("data-index")??"0",10)<d?n.classList.add("drag-over"):n.classList.add("drag-target")},n.ondrop=g=>{g.preventDefault(),g.stopPropagation();let m=g.dataTransfer?.getData("text/plain");if(!m)return;let y=parseInt(m,10);if(y===d)return;let b=be[y];b&&(be.splice(y,1),be.splice(d,0,b),hn())},n.appendChild(o),n.appendChild(l),n.appendChild(u),s.appendChild(n)}),e){let i=be.map(d=>({path:d.file.name,type:d.file.type}));localStorage.setItem("screenshot-bin-loadedMedia",JSON.stringify(i))}mr();let c=document.querySelector(".upload-image-button");c&&(c.disabled=be.length>=un);let f=document.querySelector(".snagit-library-button");f&&(f.disabled=be.length>=un)},Jh=async(t,e)=>{try{await Ie.init(),await Ie.storeImage(t,e),console.log(`Stored ${t} in IndexedDB.`)}catch(r){console.error(`Error storing ${t} in IndexedDB`,r)}},fb=async(t,e)=>{try{if(await Ie.init(),await Ie.getImage(t))return;await Jh(t,e)}catch(r){console.error(`Error checking IndexedDB for ${t}`,r)}},rl=async(t,e,r=!1,s={})=>{let c=be.findIndex(f=>f.file.name===t.name);
1424if(c===-1){console.log(`ensureThumbnailIsVisible: Adding new item: ${t.name}`);let f=r?"text-file-placeholder":URL.createObjectURL(e),i={file:t,thumbnail:f,isTextFile:r,sequence:be.length+1};be.push(i),hn();let d=be.map(n=>({path:n.file.name,type:n.file.type}));localStorage.setItem("screenshot-bin-loadedMedia",JSON.stringify(d)),s.persistToIndexedDb!==!1&&await Jh(t.name,e)}else{console.log(`ensureThumbnailIsVisible: Skipped adding duplicate filename: ${t.name}`);let f=be[c];s.persistToIndexedDb!==!1&&await fb(t.name,f?.file??e)}},Qh=t=>{if(!t)return;let e=be.findIndex(c=>c.file.name===t);if(e===-1)return;let r=be[e];if(!r)return;if(!r.isTextFile&&r.thumbnail.startsWith("blob:"))try{URL.revokeObjectURL(r.thumbnail)}catch(c){console.warn(`Failed to revoke thumbnail URL for ${t}:`,c)}let s=r.cachedUrl;if(s)try{URL.revokeObjectURL(s)}catch(c){console.warn(`Failed to revoke cached URL for ${t}:`,c)}be.splice(e,1),hn()},Bo=()=>{let t=document.getElementById("screenshot-modal");t.style.display="none"},pb=(t,e)=>t.replace(/\.snagx$/i,`-step${e}.png`),il=async t=>{if(!t.name.toLowerCase().endsWith(".snagx"))return!1;let e=await t.arrayBuffer();if(!await Hh(e))return!1;let r=await Wh(e);if(!r)return!1;let s=1;for(let c of r.steps){if(!c.image)continue;let f=pb(t.name,s),i=new File([c.image],f,{type:"image/png"});c.imageFileName=f,await Hn(i),s++}return nf(r),!0},gb=async()=>{try{if(be.length+dn.length>un){let r=un-be.length;alert(`Cannot attach ${dn.length} images. You can only attach ${r} more image${r!==1?"s":""}. The maximum is ${un} total images.`);return}Bo();let e=[...dn].sort((r,s)=>r.sequence-s.sequence);await Rt({title:e.length===1?"Adding your screenshot":`Adding ${e.length} screenshots`,status:"Loading the selected captures and reading on-screen text\u2026",placement:"media"});for(let r of e)try{let s=await ft.getFile(r.file.name),c;if(r.file.type==="snagx"){if(!await il(s)){c=await Or(s);let i=r.file.name.replace(".snagx",".png"),d=new File([c],i,{type:"image/png"});await Hn(d)}}else{c=s;let f=r.file.name,i=new File([c],f,{type:s.type});await Hn(i),console.log(`Successfully processed ${f}`)}}catch(s){console.error(`Error processing file ${r.file.name}:`,s)}dn=[]}catch(t){console.error("Error attaching screenshots:",t),alert("Failed to attach some screenshots. Please try again.")}finally{await Et()}},mb=()=>{dn.sort((t,e)=>t.sequence-e.sequence),dn.forEach((t,e)=>{let r=t.element.querySelector(".sequence-number");r&&(r.textContent=(e+1).toString())})},Kh=(t,e)=>{let r=dn.findIndex(c=>c.element===t);if(r!==-1)t.classList.remove("selected"),dn.splice(r,1);else{if(be.length+dn.length+1>un){let f=un-be.length;alert(`You can only select ${f} more image${f!==1?"s":""}. The maximum is ${un} total images.`);return}t.classList.add("selected"),dn.push({element:t,file:e,sequence:dn.length+1,filePath:e.fullPath})}mb();let s=document.getElementById("attach-selected-button");s.disabled=dn.length===0},vb=async()=>{try{let t=document.querySelector(".screenshot-grid");t.innerHTML="";let e=document.querySelector("#screenshot-modal .modal-actions"),r=document.getElementById("change-folder-button-in-modal");r||(r=document.createElement("button"),r.id="change-folder-button-in-modal",r.className="change-folder-button",r.innerHTML=`
1425            <i class="fas fa-folder-open"></i>
1426            Change Folder
1427         `,r.onclick=()=>document.getElementById("open-media-library-button").click(),e.insertBefore(r,e.firstChild));let s=document.createElement("div");s.className="images-grid",t.appendChild(s);let c=0,f=await ft.getSortedFileList();for(let i of f)try{let d=document.createElement("div");d.className="screenshot-item loading";let n=document.createElement("div");n.className="sequence-number",d.appendChild(n),d.innerHTML+=`
1428                            <div class="loading-indicator">
1429                                <i class="fas fa-spinner fa-spin"></i>
1430                            </div>
1431                        `,s.appendChild(d);let o;if(i.name.toLowerCase().endsWith(".snagx")){let p=await i.arrayBuffer();o=await Uh(p)}else o=i;let a=URL.createObjectURL(o),l=document.createElement("img");l.src=a,l.alt=i.name,l.loading="lazy",l.onload=()=>{URL.revokeObjectURL(a),d.classList.remove("loading")};let u={name:i.name,fullPath:i.name,size:i.size,modified:i.lastModified,type:i.name.toLowerCase().endsWith(".snagx")?"snagx":"image"};d.innerHTML="",d.appendChild(n),d.appendChild(l);let h=document.createElement("div");h.className="filename",h.textContent=i.name,d.appendChild(h),d.tabIndex=0,d.setAttribute("role","button"),d.setAttribute("aria-label",`Select image ${i.name}`),d.onclick=p=>{p.preventDefault(),Kh(d,u)},d.onkeydown=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),Kh(d,u))},c++}catch(d){console.error(`Error processing file ${i.name}:`,d)}c===0&&(t.innerHTML=`
1432                <div class="no-screenshots">
1433                    <i class="fas fa-image"></i>
1434                    <p>No images found in the selected folder</p>
1435                </div>`)}catch(t){console.error("Error loading screenshots:",t);let e=document.querySelector(".screenshot-grid");e.innerHTML=`
1436            <div class="screenshot-error">
1437                <i class="fas fa-exclamation-circle"></i>
1438                <p>Failed to load images. Please check folder permissions.</p>
1439            </div>`}},ol=async()=>{let t=document.querySelector(".snagit-library-button");if(!t)return;let e=t;e.innerHTML=`
1440        <i class="fas fa-images"></i>
1441        <span>${await ft.isStoreConfigured()?"Choose Screenshot from Library":"Select Library"}</span>
1442    `,e.onclick=async()=>{if(!await ft.isStoreConfigured())document.getElementById("open-media-library-button").click();else{let r=document.getElementById("screenshot-modal");r.style.display="block",await vb()}}},nl=t=>{document.querySelectorAll("#chat-message, .loaded-media-preview").forEach(r=>{t?r.classList.add("drag-over"):r.classList.remove("drag-over")})},yb=document.querySelectorAll("#chat-message, .loaded-media-preview");yb.forEach(t=>{t.addEventListener("dragenter",e=>{e.preventDefault(),mi++,nl(!0)}),t.addEventListener("dragleave",e=>{e.preventDefault(),mi--,mi<=0&&(mi=0,nl(!1))}),t.addEventListener("dragover",e=>{e.preventDefault()}),t.addEventListener("drop",async e=>{e.preventDefault(),e.stopPropagation(),nl(!1),mi=0;let r=e;if(!r.dataTransfer?.files.length)return;let s=r.dataTransfer.files.length;await Rt({title:s===1?"Adding your media":`Adding ${s} files`,status:"Inspecting your files and preparing them for the project\u2026",placement:"media"});try{await Ho(r.dataTransfer.files)}catch(c){console.error("Error processing dropped files:",c),alert("Failed to process some files. Please try again.")}finally{await Et()}})});var bb=()=>{let t=document.querySelector(".media-thumbnails");if(t===null)return;let e=t;e.addEventListener("dragstart",r=>{let s=r.target;s.classList.contains("media-thumbnail")&&(s.classList.add("dragging"),r.dataTransfer?.setData("text/plain",s.dataset.index??""))}),e.addEventListener("dragend",r=>{let s=r.target;s.classList.contains("media-thumbnail")&&(s.classList.remove("dragging"),document.querySelectorAll(".drag-over, .drag-target").forEach(c=>{c.classList.remove("drag-over","drag-target")}))}),e.addEventListener("dragover",r=>{r.preventDefault();let c=r.target.closest(".media-thumbnail");if(!c)return;let f=c,i=e.querySelector(".dragging");if(!i||i===f)return;let n=parseInt(i.dataset.index??"0",10),o=parseInt(f.dataset.index??"0",10);n<o?f.classList.add("drag-over"):f.classList.add("drag-target")}),e.addEventListener("drop",r=>{r.preventDefault();let c=r.target.closest(".media-thumbnail");if(!c)return;let f=c,i=parseInt(r.dataTransfer?.getData("text/plain")??"0",10),d=parseInt(f.dataset.index??"0",10);if(i===d)return;let[n]=be.splice(i,1);n&&be.splice(d,0,n),hn()})},Yh=()=>{let t=document.getElementById("image-preview-modal");t.style.display="none"},ef=async()=>{let t=document.querySelector(".close-modal"),e=document.getElementById("screenshot-modal"),r=document.getElementById("attach-selected-button");t?.addEventListener("click",Bo),r?.addEventListener("click",gb),e?.addEventListener("click",n=>{n.target===e&&Bo()}),await ol(),bb(),document.querySelector("#image-preview-modal .prev-button").addEventListener("click",async()=>{Bn>0&&await vi(Bn-1)}),document.querySelector("#image-preview-modal .next-button").addEventListener("click",async()=>{Bn<be.length-1&&await vi(Bn+1)}),document.querySelector("#image-preview-modal .close-modal")?.addEventListener("click",()=>{let n=document.getElementById("image-preview-modal");n&&(n.style.display="none")});let f=document.getElementById("image-preview-modal");f&&f.addEventListener("click",n=>{n.target===f&&(f.style.display="none")});let i=n=>{let o=document.getElementById("screenshot-modal");n.target===o&&Bo();let a=document.getElementById("image-preview-modal");n.target===a&&Yh()};window.addEventListener("click",i),window.addEventListener("keydown",async n=>{document.getElementById("image-preview-modal").style.display==="block"&&(n.key==="Escape"?Yh():n.key==="ArrowLeft"?Bn>0&&await vi(Bn-1):n.key==="ArrowRight"&&Bn<be.length-1&&await vi(Bn+1))}),document.querySelectorAll(".close-modal").forEach(n=>{n.addEventListener("click",()=>{let o=n.closest(".modal");o&&(o.style.display="none")})})},tf=async t=>{be.length=0,console.log("Cleared loadedMediaItems for restoration.");let e=[];try{let r=!0;try{await Ie.init()}catch(c){r=!1,console.error("IndexedDB unavailable during media restore:",c)}let s=await ft.isStoreConfigured();console.log(`Attempting to restore ${t.length} media items`);for(let c of t)try{let f=null,i=c.type==="text/plain",d="";if(r&&(f=await Ie.getImage(c.path),f&&(d="IndexedDB",console.log(`Retrieved ${c.path} from IndexedDB`))),!f&&s&&await ft.doesFileExist(c.path)){let n=await ft.getFile(c.path);if(i=n.type==="text/plain",c.path.toLowerCase().endsWith(".snagx")){let o=await n.arrayBuffer();f=await Or(o),i=!1}else f=n;d="FileSystem",console.log(`Retrieved ${c.path} from File System`)}if(!f&&we&&await we.doesFileExist(c.path)&&(f=await we.getFile(c.path),d="OPFS",console.log(`Retrieved ${c.path} from OPFS`)),f){let n=c.path.toLowerCase().endsWith(".snagx")?"image/png":f.type||c.type,o=new File([f],c.path,{type:n}),a=i?"text-file-placeholder":URL.createObjectURL(f);if(be.some(l=>l.file.name===o.name))console.log(`Skipped duplicate media item: ${o.name}`);else{let l={file:o,thumbnail:a,isTextFile:i,sequence:be.length+1};
1442if(i||(l.cachedUrl=a),be.push(l),St(o.name)&&(d==="FileSystem"||d==="OPFS")&&r)try{await Ie.storeImage(o.name,f),console.log(`Stored ${o.name} from FileSystem to IndexedDB for future use`)}catch(u){console.error(`Failed to store restored media item ${o.name} in IndexedDB:`,u)}if(St(o.name)){let u=await f.arrayBuffer();await Vn(u,o.name)}console.log(`Restored media item: ${o.name} (${d})`)}}else e.push(c.path),console.warn(`Could not restore blob for ${c.path} - not found in IndexedDB or filesystem`)}catch(f){e.push(c.path),console.error(`Error restoring media item ${c.path}:`,f)}e.length>0&&console.warn(`Skipped ${e.length} media item(s) during restore: ${e.join(", ")}`),console.log(`In-memory restoration complete. ${be.length} media items in loadedMediaItems array.`)}catch(r){console.error("Error restoring media items:",r)}};var Uo="use-experimental-model",Wo="experimental-reasoning-effort",sl=["none","low","medium","high","xhigh","max"],wb="none",yi=()=>localStorage.getItem(Uo)==="true",zo=()=>{let t=localStorage.getItem(Wo);return sl.includes(t)?t:wb};var al={OK:200,BadRequest:400,Unauthorized:401,RateLimitExceeded:429},rf=3,xb=1,Sb=2e3,of=3e4,af=1e3,Eb=1024,sf=async t=>new Promise(e=>{setTimeout(e,t)}),Cb=t=>{if(!t)return null;let e=Number(t);if(!Number.isNaN(e))return Math.max(0,e*af);let r=Date.parse(t);return Number.isNaN(r)?null:Math.max(0,r-Date.now())},_b=(t,e)=>{let r=Cb(e);if(r!==null)return Math.min(r,of);let s=Sb*2**(t-1);return Math.min(s,of)},Ab=(t,e)=>{let r=0,s=0,c=0;for(let i of t){if(!Array.isArray(i.content)){c+=i.content.length;continue}for(let d of i.content)d.type==="image_url"?(r++,s+=d.image_url?.url.length??0):d.type==="text"&&(c+=d.text?.length??0)}let f=i=>`${Math.round(i/Eb)}KB`;console.log(`Payload breakdown: total ${f(e)} | ${r} image(s) ~${f(s)} | text/OCR ~${f(c)}`)},Tb=async t=>{let e={Accept:"text/plain","Content-Type":"application/json"},r=await _n();return r&&(e.Authorization=`Bearer ${r}`),{method:"POST",body:t,headers:e}},nr=async(t,e,r,s)=>{let c=JSON.stringify({top_p:t,temperature:e,use_experimental_model:yi(),reasoning_effort:zo(),messages:r});console.log("Sending request to server with length:",c.length),Ab(r,c.length);for(let f=1;;f++){let i=await fetch("/api/v1/camtasia/chat",await Tb(c));if(console.log("Received response status:",i.status,i.statusText),i.status===al.RateLimitExceeded){if(await i.text().catch(()=>null),f>rf)throw new Error("The AI service is busy and remained rate limited after several retries. Please wait a little while and try again.");let d=_b(f,i.headers.get("Retry-After"));if(f<=xb){await sf(d);continue}if(!(s?await s({attempt:f,maxAttempts:rf,delayMs:d,delaySeconds:Math.ceil(d/af)}):!0))throw new Error("Request cancelled while the AI service was rate limited.");await sf(d);continue}if(i.body===null)throw new Error("Response body is null");if(i.status===al.Unauthorized)throw new Error("Authentication required. Please log in.");if(i.status===al.BadRequest)throw(await i.text()).includes("ResponsibleAIPolicyViolation")&&alert("The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt or images and retry."),new Error(`ChatGPT error: ${i.status} - ${i.statusText}`);return i.body.getReader()}};var kb=t=>{let e=t.match(/\((\d+),(\d+)\)/);return e?{x:parseInt(e[1],10),y:parseInt(e[2],10)}:{x:960,y:540}},lf=t=>{let e=t.match(/(\d+)x(\d+)/);return e?{width:parseInt(e[1],10),height:parseInt(e[2],10)}:{width:200,height:50}},Mb=t=>{if(!t.endingPosition?.dimensions)return!1;let{width:e}=lf(t.endingPosition.dimensions),r=e<200,s=`${t.callout} ${t.title}`.toLowerCase(),f=["button","click","select","menu","dropdown","link","tab","option"].some(i=>s.includes(i));return r||f},Lb=t=>{if(console.log("\u{1F527} Starting template-based fallback generation..."),!t?.scenes||!Array.isArray(t.scenes))throw new Error("Invalid payload: scenes array is required");if(t.scenes.length===0)throw new Error("No scenes provided in payload");console.log(`\u{1F4CA} Processing ${t.scenes.length} scenes`),t.scenes.forEach((o,a)=>{console.log(`\u{1F50D} Scene ${o.sceneNumber} (index ${a}):`,{screenshot:o.screenshot,audioFile:o.voiceover.audioFile,callout:o.callout,title:o.title})});let e=t.scenes;e.forEach((o,a)=>
1442{if(!o.voiceover?.audioFile)throw new Error(`Scene ${a+1} missing voiceover audio file`);if(o.callout||(console.warn(`Scene ${a+1} missing callout text, using default`),o.callout=`Scene ${a+1}`),!o.screenshot)throw new Error(`Scene ${a+1} missing screenshot file`)});let r=[],s=[],c=new Set;e.forEach((o,a)=>{r.push(`  voiceover${a+1} = GetFilePath("${o.voiceover.audioFile}")`),s.push(`EmphasizeVoiceover(media.voiceover${a+1})`),o.screenshot&&c.add(o.screenshot)}),c.forEach(o=>{let a=o.replace(/\.(png|jpg|jpeg)$/i,"").replace(/[^a-zA-Z0-9]/g,"_");r.push(`  screenshot_${a} = GetFilePath("${o}")`),console.log(`\u{1F4F7} Created screenshot mapping: screenshot_${a} = "./${o}"`)}),r.push('  music = GetFilePath("music.wav")'),r.push('  motionBackground = GetFilePath("motionBackground.tscshadervid")');let f=[],i=[];e.forEach((o,a)=>{let l=o.endingPosition?kb(o.endingPosition.coordinates):{x:960,y:540},u=o.endingPosition?lf(o.endingPosition.dimensions):{width:200,height:50},h=Mb(o),p={x:l.x+u.width/2,y:l.y+u.height/2},g=o.cursorCoords?.x??l.x,m=o.cursorCoords?.y??l.y;i.push({sceneNumber:o.sceneNumber,rawX:g,rawY:m,targetX:g-960,targetY:m-540}),console.log(`\u{1F4CD} Scene ${o.sceneNumber} coordinate analysis:`),console.log(`   Cursor coords: (${g.toFixed(2)}, ${m.toFixed(2)})`),console.log(`   Callout position: (${l.x}, ${l.y})`),console.log(`   Callout dimensions: ${u.width}x${u.height}`),console.log(`   Callout center: (${p.x}, ${p.y})`),console.log(`   Canvas coords: (${(g-960).toFixed(2)}, ${(m-540).toFixed(2)})`);let y=o.screenshot.replace(/\.(png|jpg|jpeg)$/i,"").replace(/[^a-zA-Z0-9]/g,"_");f.push(`  {
1443    coords={x=${l.x},y=${l.y},width=${u.width},height=${u.height}}, 
1444    txt="${o.callout}", 
1445    ss=mediaFiles.screenshot_${y}, 
1446    voice=media.voiceover${a+1}
1446,
1447    needsClick = ${h} -- ${h?"Interactive element":"Informational content"}
1448  }`)});let d=e[0].screenshot.replace(/\.(png|jpg|jpeg)$/i,"").replace(/[^a-zA-Z0-9]/g,"_");return`
1449ClearTimeline()
1450
1451local p = Camtasia.currentProject
1452p.canvasWidth, p.canvasHeight = 1920, 1080
1453
1454local fps = p.editFPS or 30
1455local maxScale = 1.3
1456
1457-- Track structure
1458local tracks = {
1459  music            = p.tracks[1],
1460  voiceover        = p:createNewTrack(),
1461  motionBackground = p:createNewTrack(),
1462  screenshot       = p:createNewTrack(),
1463  callout          = p:createNewTrack()
1464}
1465
1466-- Media setup with voiceover emphasis (CRITICAL: Separate paths from objects)
1467local mediaFiles = {
1468${r.join(`,
1469`)}
1470}
1471-- IMPORTANT: Create media objects separately
1472local media = {}
1473for k,v in pairs(mediaFiles) do media[k] = p:createMedia(v) end
1474
1475${s.join(`
1476`)}
1477
1478tracks.music:addMediaAtTime(0, media.music)
1479tracks.motionBackground:addMediaAtTime(0, media.motionBackground)
1480-- Tint the motion background with the user-selected brand color.
1481ApplyBrandTint(p, media.motionBackground)
1482
1483-- Scene definitions with cursor click flags (CRITICAL: ss uses mediaFiles, voice uses media)
1484local scenes = {
1485${f.join(`,
1486`)}
1487}
1488
1489-- No separate cursor click effects needed - handled inline
1490
1491-- Helper functions
1492local function rectCenter(r) return {x=r.x+r.width/2, y=r.y+r.height/2} end
1493local function solveScale(rect)
1494  return math.min(p.canvasWidth/rect.width, p.canvasHeight/rect.height, maxScale)
1495end
1496local function solveCanvasPos(clip, rect, scale)
1497  return {
1498    x = (clip.width/2 - (rect.x+rect.width/2))*scale,
1499    y = (-clip.height/2 + (rect.y+rect.height/2))*scale
1500  }
1501end
1502
1503-- Cursor state
1504local lastCursorPos = nil
1505local firstScene = true
1506
1507local function setDirectCursorPosition(cursorParam, startPos)
1508  cursorParam:setValueAtTime(0, startPos)
1509end
1510
1511local function applyCalloutVisualEffects(callout, text)
1512  local dropShadow = p:createEffect("DropShadow")
1513  dropShadow:parameterWithName("angle"):setValueAtTime(0, 270)
1514  dropShadow:parameterWithName("offset"):setValueAtTime(0, 30)
1515  dropShadow:parameterWithName("blur"):setValueAtTime(0, 60)
1516  dropShadow:parameterWithName("opacity"):setValueAtTime(0, 0.45)
1517  callout:addEffect(dropShadow)
1518  
1519  local cornerEffect = p:createEffect("RoundCorners")
1520  cornerEffect:parameterWithName("radius"):setValueAtTime(0, 40)
1521  callout:addEffect(cornerEffect)
1522end
1523
1524-- Scene builder with all professional effects and cursor clicks
1525local function handleScene(ssPath, startT, dur, rect, prevCanvasPos, prevScale, text, isLastScene, needsClick)
1526  local clip = p:createMedia(ssPath)
1527  local scale = solveScale(rect)
1528  local pos = solveCanvasPos(clip, rect, scale)
1529  local targetCenter = rectCenter(rect)
1530
1531  AddScene(p, clip, startT, dur, {prevScale, scale}, {prevCanvasPos, pos}, text, 0, 72, "Arial", tracks)
1532
1533  -- Apply visual effects to callouts. Callout entrance/exit transitions are
1534  -- handled by AddScene via energy-scaled gradient wipes, so do not add callout
1535  -- Fade transitions here (they would overwrite the wipes).
1536  local calloutTrack = tracks.callout
1537  if #calloutTrack.medias > 0 then
1538    local currentCallout = calloutTrack.medias[#calloutTrack.medias]
1539    applyCalloutVisualEffects(currentCallout, text)
1540  end
1541
1542  -- Handle last scene fading (screenshot only; the callout keeps its wipe)
1543  if isLastScene then
1544    local fadeTransition = p:createTransition("Fade", fps * 2)
1545    clip:addRightTransition(fadeTransition)
1546  end
1547
1548  -- Professional cursor setup
1549  local fx = p:createEffect("CursorPath"); clip:addEffect(fx)
1550  local prm = fx:pointParameterWithName("cursorLocation")
1551  local physFx = p:createEffect("CursorPhysics"); clip:addEffect(physFx)
1552  local blurFx = p:createEffect("CursorMotionBlur"); clip:addEffect(blurFx)
1553
1554  -- Add LeftClickScaling for visual click feedback
1555  if needsClick then
1556    local clickScalingFx = p:createEffect("LeftClickScaling")
1557    clip:addEffect(clickScalingFx)
1558  end
1559
1560  local startPos
1561  if firstScene then
1562    startPos = Camtasia.Point(0, 0)
1563    firstScene = false
1564  else
1565    startPos = lastCursorPos
1566  end
1567
1568  local cursorScale = fx:parameterWithName("cursorScale")
1569  if cursorScale then
1570    cursorScale:setValueAtTime(0, 5.0)
1571    cursorScale:setValueAtTime(dur, 5.0)
1572  end
1573
1574  local endPos = Camtasia.Point(targetCenter.x, targetCenter.y)
1575  
1576 -- WORKING Bezier cursor movement
1577  SetDirectCursorPosition(prm, startPos)
1578  
1579  local visibleStart = ToInteger(1 * fps)
1580  local fEnd = ToInteger(math.min(3, dur) * fps)
1581  
1582  local c1_ratio = 0.2  -- Customize curve feel
1583  local c2_ratio = 0.8
1584  
1585  AddPathPointCustom(prm, visibleStart, startPos, c1_ratio, c2_ratio)
1586  AddPathPointCustom(prm, fEnd, endPos, c1_ratio, c2_ratio)
1587
1588-- Add cursor click action inline - clicks occur closer to end of clip
1589  if needsClick then
1590    local cursorActionParam = fx:intParameterWithName("cursorAction")
1591    if cursorActionParam then
1592      local clickTime = ToInteger(dur * 0.95)  -- 95% of duration in seconds
1593      cursorActionParam:addKeyFrameAtTimeWithValue(clickTime, 1)
1594    end
1595  end
1596
1597  lastCursorPos = endPos
1598  return pos, scale
1599end
1600
1601-- Timeline generation
1602local time = 0
1603-- Get first scene's screenshot for initial scale calculation
1604local firstClip = media.screenshot_${d}
1605local prevScale = solveScale{width=firstClip.width, height=firstClip.height, x=0, y=0}
1606local prevPos = {x=0, y=0}
1607
1608for i, sc in ipairs(scenes) do
1609  local dur = sc.voice.duration
1610  local isLastScene = (i == #scenes)
1611  
1612  tracks.voiceover:addMediaAtTime(time, sc.voice)
1613  prevPos, prevScale = handleScene(sc.ss, time, dur, sc.coords, prevPos, prevScale, sc.txt, isLastScene, sc.needsClick)
1614  time = time + dur
1615end
1616
1617-- Professional finishing (following Default.lumachat exactly)
1618ExtendLastSceneDuration(tracks, 5)
1619time = time + 5
1620
1621SetMusicDurationAndFadeOut(tracks.music, media.music, time)
1622media.motionBackground.duration = time
1623
1624local fadeTransition2secs = p:createTransition("Fade", fps * 2)
1625media.motionBackground:addRightTransition(fadeTransition2secs)
1626
1627-- ============================================================================
1628-- DIAGNOSTIC: Draw grid overlay and cursor position markers
1629-- ============================================================================
1630local sceneMarkers = {
1631${i.map(o=>`  {sceneNumber=${o.sceneNumber}, rawX=${o.rawX}, rawY=${o.rawY}, targetX=${o.targetX.toFixed(2)}, targetY=${o.targetY.toFixed(2)}}`).join(`,
1632`)}
1633}
1634
1635-- print("\\n=== DIAGNOSTIC MODE ENABLED ===")
1636-- print("Drawing visual grid overlay with cursor markers...")
1637-- print("Legend:")
1638-- print("  - RED crosshair = Canvas center (0,0)")
1639-- print("  - GREEN circles = Calculated target positions")
1640-- print("  - RED squares = Raw TREC cursor coordinates")
1641-- print("  - Grid lines = 200px spacing")
1642-- DrawDiagnosticGrid(p, time, sceneMarkers)
1643-- print("=== DIAGNOSTIC COMPLETE ===\\n")
1644
1645-- Cursor clicks are handled inline during scene creation`},cf=t=>`\`\`\`lua
1646${Lb(t)}
1647\`\`\``;var vr=t=>t.replace(/^\.?\//,""),Rb=t=>{let e=new Set;for(let r of t.scenes)e.add(vr(r.screenshot)),e.add(vr(r.voiceover.audioFile));for(let r of t.additionalMedia)e.add(vr(r));return e},Ib=t=>{let e=new Set,r=/GetFilePath\(\s*["']([^"']+)["']\s*\)/g,s=/\/opfs\/([^"'\s)]+)/g;for(let c of t.matchAll(r))c[1]&&e.add(vr(c[1]));for(let c of t.matchAll(s))c[1]&&e.add(vr(c[1]));return[...e]},uf=(t,e)=>{let r=Rb(e),s=Ib(t).filter(c=>!r.has(c));if(s.length>0)throw new Error(`Lua script referenced media not in the current storyboard payload: ${s.join(", ")}`)},ll=(t,e)=>{let r=new Set([...e].map(c=>vr(c))),s=t.scenes.map((c,f)=>({sceneNumber:c.sceneNumber??f+1,screenshot:vr(c.screenshot)})).filter(c=>!r.has(c.screenshot));if(s.length>0){let c=s.map(f=>`scene ${f.sceneNumber}: ${f.screenshot}`).join(", ");throw new Error(`Storyboard references image files that are not available in the media bin (${c}). Replace the image or regenerate the storyboard before generating video.`)}};var cl=(t,e)=>JSON.stringify({sourceFileName:e?.trim()??"",scenes:t.map(r=>({imageFileName:r.imageFileName,sceneTitle:r.sceneTitle,voiceover:r.voiceover,callout:r.callout,endingPosition:r.endingPosition,transcript:r.transcript,cursorCoords:r.cursorCoords}))}),df=null,hf=null,ul=(t,e)=>{df=t,hf=e},ff=t=>df===t?hf:null;var $b="scene-",Ob="step-",Nb=t=>`${$b}${t}`,pf=t=>`${Ob}${String(t).padStart(2,"0")}`,Db=(t,e)=>{let r=t.findIndex(f=>!f.isUiControl&&f.text.includes(e));if(r<0)return t;let s=t[r],c=s.text.indexOf(e);return[...t.slice(0,r),{text:s.text.slice(0,c),isUiControl:!1},{text:e,isUiControl:!0},{text:s.text.slice(c+e.length),isUiControl:!1},...t.slice(r+1)]};var Fb=/(^|[\s([{])["\u201C]([^"\u201C\u201D\n]+?)["\u201D](?=$|[\s)\]}.,;:!?])/g,Pb=/(^|[\s([{])['\u2018]([^'\u2018\u2019\n]+?)['\u2019](?=$|[\s)\]}.,;:!?])/g,Bb=/^\s*(?:type|enter|paste|input)\b/i,Hb=t=>{if(Bb.test(t))return{cmd:t,labels:[]};let e=[],r=t;for(let s of[Fb,Pb])r=r.replace(s,(c,f,i)=>{let d=i.trim();return!d||d.split(/\s+/).length>8?c:(e.push(d),`${f}${d}`)});return{cmd:r,labels:e}},dl=t=>{let e=(t.uiControls??t.menuPath??[]).filter(i=>i.trim().length>0),{cmd:r,labels:s}=Hb(t.cmd),c=[...e,...s],f=[{text:r,isUiControl:!1}];for(let i of c)f=Db(f,i);return f.filter(i=>i.text.length>0)},jo=(t,e,r)=>{let s=[],c=new Map((e?.scenes??[]).filter(d=>!!d.imageFileName?.trim()).map(d=>
1647[d.imageFileName.trim(),d]));t.forEach((d,n)=>{let o=d.screenshot.trim();if(!o)return;let a=c.get(o);s.push({sceneId:Nb(n+1),sceneIndex:n,imageFileName:o,sceneTitle:d.sceneTitle.trim(),voiceover:d.voiceover.trim(),callout:d.callout.trim(),endingPosition:d.endingPosition?{...d.endingPosition}:null,transcript:(a?.transcript??"").trim(),cursorCoords:a?.cursorCoords??null,image:a?.image??null})});let f={sceneCount:t.length,evidenceCount:s.length},i=r?.trim();return i&&(f.sourceFileName=i),{evidence:s,metadata:f}},Go=t=>t.length>0&&t.some(e=>e.voiceover.length>0),gf=(t,e,r,s)=>{if(!t.trim())throw new Error("Guide title is required.");if(!e.trim())throw new Error("Guide shortdesc is required.");if(r.length===0)throw new Error("Guide requires at least one step.");let c={title:t.trim(),shortdesc:e.trim(),steps:r},f=s?.prereq?.trim();f&&(c.prereq=f);let i=s?.context?.trim();i&&(c.context=i);let d=s?.result?.trim();return d&&(c.result=d),s?.sourceFileName&&(c.sourceFileName=s.sourceFileName),c};var Ub=(t,e,r,s,c)=>{let l=t/Math.max(1,e),u=r/Math.max(1,s),h,p,g,m;u>l?(h=t,p=h/u,g=0,m=(e-p)/2):(p=e,h=p*u,g=(t-h)/2,m=0);let y=h/Math.max(1,r),b=p/Math.max(1,s),C=c.x*y+g,E=c.y*b+m,w=Math.max(4,c.width*y),k=Math.max(4,c.height*b),I=c.x+c.width/2,L=c.y+c.height/2,F=I/Math.max(1,r)*100,R=L/Math.max(1,s)*100,M=Math.max(c.width/Math.max(1,r),c.height/Math.max(1,s)),A=1/Math.max(1e-4,M*2),_=Math.min(2.5,Math.max(1.2,A)),O=C+w/2,D=E+k/2,B=t/2-O,P=e/2-D;return{zoomLevel:_,translateX:B,translateY:P,transformOriginXPercent:F,transformOriginYPercent:R}},mf=()=>`(function(){
1648  var computeFocusPreviewTransform = ${Ub.toString()};
1649  function readFocusRect(frame){
1650    return {
1651      x: parseFloat(frame.dataset.focusX || '0'),
1652      y: parseFloat(frame.dataset.focusY || '0'),
1653      width: parseFloat(frame.dataset.focusWidth || '0'),
1654      height: parseFloat(frame.dataset.focusHeight || '0')
1655    };
1656  }
1657  function apply(frame){
1658    var img = frame.querySelector('img');
1659    var btn = frame.parentElement && frame.parentElement.querySelector('[data-focus-toggle]');
1660    if(!img || !btn) return;
1661    var focus = readFocusRect(frame);
1662    if(!focus.width || !focus.height || !img.naturalWidth) return;
1663    var focused = frame.classList.contains('preview-active');
1664    var rect = frame.getBoundingClientRect();
1665    var t = computeFocusPreviewTransform(rect.width, rect.height, img.naturalWidth, img.naturalHeight, focus);
1666    img.style.transformOrigin = t.transformOriginXPercent + '% ' + t.transformOriginYPercent + '%';
1667    img.style.transform = focused
1668      ? 'scale(' + t.zoomLevel + ') translate(' + (t.translateX / t.zoomLevel) + 'px,' + (t.translateY / t.zoomLevel) + 'px)'
1669      : '';
1670    btn.textContent = focused ? 'View full image' : 'Show focus area';
1671    btn.setAttribute('aria-pressed', focused ? 'true' : 'false');
1672  }
1673  function wire(frame){
1674    var btn = frame.parentElement && frame.parentElement.querySelector('[data-focus-toggle]');
1675    var img = frame.querySelector('img');
1676    if(!btn || !img) return;
1677    btn.addEventListener('click', function(){
1678      frame.classList.toggle('preview-active');
1679      apply(frame);
1680    });
1681    window.addEventListener('resize', function(){ apply(frame); });
1682    if(img.complete) apply(frame);
1683    else img.addEventListener('load', function(){ apply(frame); }, {once:true});
1684  }
1685  document.querySelectorAll('.step-image-frame[data-focus-x]').forEach(wire);
1686})();`;var Vo=class{modal;imgContainer;imgElement;focalPointContainer;focalPointElement=null;currentFocalPoint=null;sceneIndex;updateCallback;resizeHandler=null;dragState={isDragging:!1,isResizing:!1,dragOffset:{x:0,y:0},resizeHandle:null,initialRect:{x:0,y:0,width:0,height:0},currentMousePos:{x:0,y:0}};animationState={animationFrame:null,lastUpdateTime:0,isAnimating:!1};cachedImageDimensions=null;focusableElements=[];firstFocusableElement=null;previouslyFocusedElement=null;constructor(e,r,s,c,f,i){this.modal=e,this.sceneIndex=c,this.currentFocalPoint=f,this.updateCallback=i,this.setupImageContainer(),this.setupImageElement(r,s),this.setupFocalPointContainer(),this.setupAccessibleHeader(),this.initialize()}dispose(){this.stopAnimation(),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.removeEventListeners(),this.cleanupFocusTrap()}boundHandleMouseMove=e=>this.handleMouseMove(e);
1686boundHandleMouseUp=()=>this.handleMouseUp();boundHandleGlobalKeyDown=e=>this.handleGlobalKeyDown(e);boundHandleModalKeyDown=e=>this.handleModalKeyDown(e);boundHandleFocusIn=e=>this.handleFocusIn(e);calculateResizedRect(e,r,s,c,f,i){let{x:d,y:n,width:o,height:a}=r;return e.includes("e")?o+=s:e.includes("w")&&(o-=s,d+=s),e.includes("s")?a+=c:e.includes("n")&&(a-=c,n+=c),o<0&&(d+=o,o=-o),a<0&&(n+=a,a=-a),o=Math.max(f,o),a=Math.max(f,a),d=Math.max(i.offsetX,Math.min(d,i.maxX-o)),n=Math.max(i.offsetY,Math.min(n,i.maxY-a)),o=Math.min(o,i.maxX-d),a=Math.min(a,i.maxY-n),{x:d,y:n,width:o,height:a}}setupImageContainer(){if(this.imgContainer=this.modal.querySelector(".image-preview-container"),!this.imgContainer){this.imgContainer=document.createElement("div"),this.imgContainer.className="image-preview-container";let e=this.modal.querySelector(".modal-content");e?e.appendChild(this.imgContainer):this.modal.appendChild(this.imgContainer)}}setupImageElement(e,r){this.imgElement=this.imgContainer.querySelector("img"),this.imgElement||(this.imgElement=document.createElement("img"),this.imgContainer.appendChild(this.imgElement)),this.imgElement.src=e,this.imgElement.alt=r}setupFocalPointContainer(){this.focalPointContainer=this.imgContainer.querySelector(".focal-point-editor-container"),this.focalPointContainer||(this.focalPointContainer=document.createElement("div"),this.focalPointContainer.className="focal-point-editor-container",this.imgContainer.appendChild(this.focalPointContainer)),this.focalPointContainer.innerHTML=""}setupAccessibleHeader(){let e=this.modal.querySelector(".modal-header");if(!e)return;e.setAttribute("role","banner"),e.setAttribute("aria-label","Focal Point Editor Modal Header"),e.setAttribute("tabindex","0"),e.addEventListener("keydown",s=>{let c=s;if(c.key==="Enter"||c.key===" "){c.preventDefault();let f=e.querySelector("button");f&&f.focus()}}),e.addEventListener("focus",()=>{e.style.outline="2px solid #ffd000",e.style.outlineOffset="2px"}),e.addEventListener("blur",()=>{e.style.outline="none",e.style.outlineOffset="0"});let r=e.querySelector("h2, h3, .modal-title");r&&(r.setAttribute("id","focal-point-modal-title"),this.modal.setAttribute("aria-labelledby","focal-point-modal-title"))}initialize(){this.createFocalPointElement(),this.addUpdateButton(),this.setupEventListeners(),this.setupImageLoad(),this.setupFocusTrap()}createFocalPointElement(){this.focalPointElement=document.createElement("div"),this.focalPointElement.className="focal-point-editor",this.focalPointElement.setAttribute("role","img"),this.focalPointElement.setAttribute("aria-label","Focal point selector - use arrow keys to move, tab to resize handles"),this.focalPointElement.setAttribute("tabindex","0"),this.focalPointElement.setAttribute("aria-describedby","focal-point-instructions"),this.focalPointElement.style.cssText=`
1687         position: absolute;
1688         border: 2px solid #ffd000;
1689         background: rgba(255, 208, 0, 0.1);
1690         cursor: move;
1691         user-select: none;
1692         will-change: transform;
1693         transform: translate3d(0, 0, 0);
1694         backface-visibility: hidden;
1695         box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
1696         outline: none;
1697         z-index: 10;
1698      `,this.focalPointContainer.appendChild(this.focalPointElement),this.addResizeHandles(),this.addKeyboardInstructions(),setTimeout(()=>{this.updateFocusableElements()},50)}addResizeHandles(){[{position:"nw",label:"Resize from top-left corner"},{position:"ne",label:"Resize from top-right corner"},{position:"sw",label:"Resize from bottom-left corner"},{position:"se",label:"Resize from bottom-right corner"},{position:"n",label:"Resize from top edge"},{position:"s",label:"Resize from bottom edge"},{position:"e",label:"Resize from right edge"},{position:"w",label:"Resize from left edge"}].forEach(r=>{let s=document.createElement("div"),{position:c,label:f}=r;s.className=`resize-handle ${c}`,s.dataset.handle=c,s.setAttribute("role","button"),s.setAttribute("aria-label",f),s.setAttribute("tabindex","0"),s.style.cssText=`
1699            position: absolute;
1700            background: #ffd000;
1701            border: 2px solid #000;
1702            width: 12px;
1703            height: 12px;
1704            z-index: 20;
1705            outline: none;
1706            box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
1707         `,this.positionResizeHandle(s,c),this.focalPointElement.appendChild(s)})}positionResizeHandle(e,r){let s={nw:"top: -6px; left: -6px; cursor: nw-resize;",ne:"top: -6px; right: -6px; cursor: ne-resize;",sw:"bottom: -6px; left: -6px; cursor: sw-resize;",se:"bottom: -6px; right: -6px; cursor: se-resize;",n:"top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize;",s:"bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize;",e:"right: -6px; top: 50%; transform: translateY(-50%); cursor: e-resize;",w:"left: -6px; top: 50%; transform: translateY(-50%); cursor: w-resize;"};e.style.cssText+=s[r]||"",e.addEventListener("focus",()=>{e.style.boxShadow="0 0 0 3px rgba(255, 208, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.8)",e.style.transform+=" scale(1.2)"}),e.addEventListener("blur",()=>{e.style.boxShadow="0 0 0 2px rgba(255, 255, 255, 0.8)",e.style.transform=e.style.transform.replace(" scale(1.2)","")})}addKeyboardInstructions(){let e=document.createElement("div");
1707e.id="focal-point-instructions",e.className="sr-only",e.style.cssText=`
1708         position: absolute;
1709         width: 1px;
1710         height: 1px;
1711         padding: 0;
1712         margin: -1px;
1713         overflow: hidden;
1714         clip: rect(0, 0, 0, 0);
1715         white-space: nowrap;
1716         border: 0;
1717      `,e.textContent="Use arrow keys to move focal point by 1 pixel, Shift+arrow keys to move by 10 pixels. Tab to navigate to resize handles. Enter or Space on handles to start keyboard resize mode, then use arrow keys to resize.",this.focalPointContainer.appendChild(e)}addUpdateButton(){let e=this.modal.querySelector(".modal-header");if(!e){console.error("Could not find modal header to add update button");return}e.querySelectorAll(".update-scene-button").forEach(c=>c.remove());let s=document.createElement("button");s.className="update-scene-button primary-button",s.innerHTML='<i class="fas fa-sync-alt"></i> Update Scene',s.title="Update the scene with this focal point and generate new content focused on this area",s.setAttribute("aria-describedby","focal-point-instructions"),s.style.cssText=`
1718         background-color: #ffd000;
1719         color: #000000;
1720         font-weight: bold;
1721         padding: 8px 16px;
1722         border-radius: 6px;
1723         cursor: pointer;
1724         display: inline-flex;
1725         align-items: center;
1726         gap: 8px;
1727         border: none;
1728         box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1729         margin: 0 16px;
1730         transition: all 0.2s ease;
1731      `,s.addEventListener("mouseenter",()=>{s.style.backgroundColor="#ffdc3e",s.style.transform="translateY(-1px)",s.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.15)"}),s.addEventListener("mouseleave",()=>{s.style.backgroundColor="#ffd000",s.style.transform="translateY(0)",s.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.1)"}),s.addEventListener("keydown",c=>{let f=c;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s.click())}),s.addEventListener("click",this.handleUpdateClick.bind(this)),e.appendChild(s),setTimeout(()=>{this.updateFocusableElements()},50)}showConfirmation(e){return window.confirm(e)}handleUpdateClick(e){if(e.preventDefault(),e.stopPropagation(),!this.focalPointElement||!this.cachedImageDimensions){console.error("Focal point element or cached dimensions not found during update click!");return}let r=window.getComputedStyle(this.focalPointElement).transform,s=new DOMMatrix(r),c=this.focalPointElement.getBoundingClientRect(),f=s.m41,i=s.m42,d=c.width,n=c.height,{offsetX:o,offsetY:a,scaleFactorX:l,scaleFactorY:u,naturalWidth:h,naturalHeight:p}=this.cachedImageDimensions,g=Math.round((f-o)/l),m=Math.round((i-a)/u),y=Math.round(d/l),b=Math.round(n/u),C=this.validateFocalPoint(g,m,y,b,h,p),E=`This will update Scene ${this.sceneIndex+1} with the new focal point:
1732Coordinates: (${C.x}, ${C.y})
1733Dimensions: ${C.width}x${C.height}
1734
1735Only this scene will be reprocessed. Continue?`;this.showConfirmation(E)&&(this.updateCallback(this.sceneIndex,C.x,C.y,C.width,C.height),this.closeModal())}setupEventListeners(){if(!this.focalPointElement)return;this.focalPointElement.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.focalPointElement.addEventListener("keydown",this.handleKeyDown.bind(this)),this.focalPointElement.querySelectorAll(".resize-handle").forEach(r=>{r.addEventListener("mousedown",s=>this.handleResizeStart(s)),r.addEventListener("keydown",s=>this.handleResizeKeyDown(s))}),document.addEventListener("mousemove",this.boundHandleMouseMove,{passive:!0}),document.addEventListener("mouseup",this.boundHandleMouseUp),document.addEventListener("keydown",this.boundHandleGlobalKeyDown),this.focalPointElement.addEventListener("contextmenu",r=>r.preventDefault()),this.resizeHandler=this.debounce(()=>{this.invalidateCache(),this.positionFocalPoint()},150),window.addEventListener("resize",this.resizeHandler),this.setupModalCloseHandler()}removeEventListeners(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),document.removeEventListener("keydown",this.boundHandleGlobalKeyDown)}setupModalCloseHandler(){let e=this.modal.querySelector(".close-modal");if(!e)return;let r=e.cloneNode(!0);e.parentNode?.replaceChild(r,e),r.addEventListener("click",()=>{this.closeModal()})}setupImageLoad(){let e=()=>
1735{if(!this.imgElement.complete||this.imgElement.naturalWidth===0||this.imgElement.naturalHeight===0){setTimeout(e,50);return}this.positionFocalPoint(),setTimeout(()=>this.positionFocalPoint(),100),setTimeout(()=>this.positionFocalPoint(),300)};this.imgElement.complete?e():this.imgElement.addEventListener("load",e,{once:!0})}positionFocalPoint(){if(!this.focalPointElement||(this.updateCachedDimensions(),!this.cachedImageDimensions))return;let{displayedWidth:e,displayedHeight:r,offsetX:s,offsetY:c,scaleFactorX:f,scaleFactorY:i}=this.cachedImageDimensions,d,n,o,a;if(this.currentFocalPoint?.isValid){let l=this.validateFocalPoint(this.currentFocalPoint.x,this.currentFocalPoint.y,this.currentFocalPoint.width,this.currentFocalPoint.height,this.cachedImageDimensions.naturalWidth,this.cachedImageDimensions.naturalHeight);d=Math.round(l.x*f+s),n=Math.round(l.y*i+c),o=Math.max(10,Math.round(l.width*f)),a=Math.max(10,Math.round(l.height*i))}else o=Math.max(50,Math.round(e*.3)),a=Math.max(50,Math.round(r*.3)),d=s+(e-o)/2,n=c+(r-a)/2;this.focalPointElement.style.width=`${o}px`,this.focalPointElement.style.height=`${a}px`,this.focalPointElement.style.transform=`translate3d(${d}px, ${n}px, 0)`}updateCachedDimensions(){let e=this.imgContainer.getBoundingClientRect(),r=e.width,s=e.height,c=this.imgElement.naturalWidth,f=this.imgElement.naturalHeight;if(r===0||s===0||c===0||f===0){this.cachedImageDimensions=null;return}let i=r/s,d=c/f,n,o,a,l;d>i?(n=r,o=n/d,a=0,l=(s-o)/2):(o=s,n=o*d,a=(r-n)/2,l=0),this.cachedImageDimensions={naturalWidth:c,naturalHeight:f,displayedWidth:n,displayedHeight:o,offsetX:a,offsetY:l,scaleFactorX:n/c,scaleFactorY:o/f}}invalidateCache(){this.cachedImageDimensions=null}handleMouseDown(e){if(e.target.classList.contains("resize-handle")||(e.preventDefault(),e.stopPropagation(),!this.focalPointElement))return;let s=this.focalPointElement.getBoundingClientRect();this.dragState.dragOffset.x=e.clientX-s.left,this.dragState.dragOffset.y=e.clientY-s.top,this.dragState.isDragging=!0,this.dragState.currentMousePos={x:e.clientX,y:e.clientY},this.focalPointElement.style.willChange="transform",this.startAnimation()}handleResizeStart(e){if(e.preventDefault(),e.stopPropagation(),!this.focalPointElement)return;let r=e.target;this.dragState.resizeHandle=r.dataset.handle||null,this.dragState.isResizing=!0;let s=this.focalPointElement.getBoundingClientRect(),c=window.getComputedStyle(this.focalPointElement).transform,f=new DOMMatrix(c),i=this.imgContainer.getBoundingClientRect();this.dragState.initialRect={x:f.m41,y:f.m42,width:s.width,height:s.height,mouseStartX:e.clientX-i.left,mouseStartY:e.clientY-i.top},this.dragState.currentMousePos={x:e.clientX,y:e.clientY},this.focalPointElement.style.willChange="transform",this.startAnimation()}handleMouseMove(e){!this.dragState.isDragging&&!this.dragState.isResizing||(this.dragState.currentMousePos={x:e.clientX,y:e.clientY})}handleKeyDown(e){if(!this.focalPointElement||!this.cachedImageDimensions)return;let r=e.shiftKey?10:1,s=window.getComputedStyle(this.focalPointElement).transform,c=new DOMMatrix(s),f=c.m41,i=c.m42,d=f,n=i;switch(e.key){case"ArrowLeft":d=f-r;break;case"ArrowRight":d=f+r;break;case"ArrowUp":n=i-r;break;case"ArrowDown":n=i+r;break;default:return}e.preventDefault();let{offsetX:o,offsetY:a,displayedWidth:l,displayedHeight:u}=this.cachedImageDimensions,h=o+l-this.focalPointElement.offsetWidth,p=a+u-this.focalPointElement.offsetHeight,g=Math.max(o,Math.min(d,h)),m=
1735Math.max(a,Math.min(n,p));this.focalPointElement.style.transform=`translate3d(${g}px, ${m}px, 0)`,this.announceMovement(g-f,m-i)}handleResizeKeyDown(e){let r=e.target,s=r.dataset.handle;if(!(!s||!this.focalPointElement||!this.cachedImageDimensions)){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.startKeyboardResize(s,r);return}r.classList.contains("keyboard-resize-active")&&this.handleKeyboardResize(e,s)}}handleGlobalKeyDown(e){e.key==="Escape"&&this.exitKeyboardResize()}startKeyboardResize(e,r){this.exitKeyboardResize(),r.classList.add("keyboard-resize-active"),r.style.boxShadow="0 0 0 4px rgba(255, 208, 0, 1), 0 0 0 2px rgba(255, 255, 255, 0.8)",this.dragState.initialRect={x:0,y:0,width:0,height:0},this.dragState.currentMousePos={x:0,y:0};let s=document.createElement("div");s.setAttribute("aria-live","polite"),s.className="sr-only",s.textContent=`Keyboard resize mode active for ${e} handle. Use arrow keys to resize, Escape to exit.`,document.body.appendChild(s),setTimeout(()=>{document.body.removeChild(s)},1e3)}handleKeyboardResize(e,r){if(!this.focalPointElement||!this.cachedImageDimensions)return;e.preventDefault();let s=e.shiftKey?10:1;if(!this.dragState.initialRect.mouseStartX||!this.dragState.initialRect.mouseStartY){let u=this.focalPointElement.getBoundingClientRect(),h=window.getComputedStyle(this.focalPointElement).transform,p=new DOMMatrix(h),g=this.imgContainer.getBoundingClientRect();this.dragState.initialRect={x:p.m41,y:p.m42,width:u.width,height:u.height,mouseStartX:0,mouseStartY:0},r.includes("w")?this.dragState.initialRect.mouseStartX=u.left-g.left:r.includes("e")?this.dragState.initialRect.mouseStartX=u.right-g.left:this.dragState.initialRect.mouseStartX=(u.left+u.right)/2-g.left,r.includes("n")?this.dragState.initialRect.mouseStartY=u.top-g.top:r.includes("s")?this.dragState.initialRect.mouseStartY=u.bottom-g.top:this.dragState.initialRect.mouseStartY=(u.top+u.bottom)/2-g.top,this.dragState.currentMousePos.x===0&&this.dragState.currentMousePos.y===0&&(this.dragState.currentMousePos={x:this.dragState.initialRect.mouseStartX??0,y:this.dragState.initialRect.mouseStartY??0})}e.key==="ArrowLeft"?this.dragState.currentMousePos.x-=s:e.key==="ArrowRight"&&(this.dragState.currentMousePos.x+=s),e.key==="ArrowUp"?this.dragState.currentMousePos.y-=s:e.key==="ArrowDown"&&(this.dragState.currentMousePos.y+=s);let c=this.dragState.currentMousePos.x-this.dragState.initialRect.mouseStartX,f=this.dragState.currentMousePos.y-this.dragState.initialRect.mouseStartY,{offsetX:i,offsetY:d,displayedWidth:n,displayedHeight:o}=this.cachedImageDimensions,a={offsetX:i,offsetY:d,maxX:i+n,maxY:d+o},l=this.calculateResizedRect(r,this.dragState.initialRect,c,f,10,a);this.focalPointElement.style.width=`${l.width}px`,this.focalPointElement.style.height=`${l.height}px`,this.focalPointElement.style.transform=`translate3d(${l.x}px, ${l.y}px, 0)`}exitKeyboardResize(){let e=document.querySelector(".keyboard-resize-active");e&&e instanceof HTMLElement&&(e.classList.remove("keyboard-resize-active"),e.style.boxShadow="0 0 0 2px rgba(255, 255, 255, 0.8)"),this.dragState.initialRect={x:0,y:0,width:0,height:0},this.dragState.currentMousePos={x:0,y:0}}announceMovement(e,r){if(e===0&&r===0)return;let s=document.createElement("div");s.setAttribute("aria-live","polite"),s.className="sr-only";let c=[];r<0&&c.push("up"),r>0&&c.push("down"),e<0&&c.push("left"),e>0&&c.push("right"),s.textContent=`Focal point moved ${Math.abs(e||r)} pixels ${c.join(" ")}.`,document.body.appendChild(s),setTimeout(()=>{document.body.removeChild(s)},1e3)}handleMouseUp(){!this.dragState.isDragging&&!this.dragState.isResizing||(this.dragState.isDragging=!1,this.dragState.isResizing=!1,this.dragState.resizeHandle=null,this.stopAnimation(),this.exitKeyboardResize(),this.focalPointElement&&(this.focalPointElement.style.willChange="auto",setTimeout(()=>{this.focalPointElement&&(this.focalPointElement.style.willChange="transform")},100)))}startAnimation(){this.animationState.isAnimating||(this.animationState.isAnimating=!0,this.animationState.lastUpdateTime=performance.now(),this.updateAnimation())}stopAnimation(){this.animationState.animationFrame&&(cancelAnimationFrame(this.animationState.animationFrame),this.animationState.animationFrame=null),this.animationState.isAnimating=!1}updateAnimation(){if(!this.animationState.isAnimating)return;let e=performance.now();e-this.animationState.lastUpdateTime>=16.67&&(this.dragState.isDragging?this.updateDragPosition():this.dragState.isResizing&&this.updateResizePosition(),this.animationState.lastUpdateTime=e),this.animationState.animationFrame=requestAnimationFrame(()=>this.updateAnimation())}updateDragPosition(){if(!this.focalPointElement||!this.cachedImageDimensions)return;let e=this.imgContainer.getBoundingClientRect(),r=this.dragState.currentMousePos.x-e.left-this.dragState.dragOffset.x,s=this.dragState.currentMousePos.y-e.top-this.dragState.dragOffset.y,{offsetX:c,offsetY:f,displayedWidth:i,displayedHeight:d}=this.cachedImageDimensions,n=c+i-this.focalPointElement.offsetWidth,o=f+d-this.focalPointElement.offsetHeight,a=Math.max(c,Math.min(r,n)),l=Math.max(f,Math.min(s,o));this.focalPointElement.style.transform=`translate3d(${a}px, ${l}px, 0)`}updateResizePosition(){if(!this.focalPointElement||!this.dragState.resizeHandle||!this.cachedImageDimensions)return;let e=this.imgContainer.getBoundingClientRect(),r=this.dragState.currentMousePos.x-e.left,s=this.dragState.currentMousePos.y-e.top,c=this.dragState.initialRect.mouseStartX||r,f=this.dragState.initialRect.mouseStartY||s,i=r-c,d=s-f,{offsetX:n,offsetY:o,displayedWidth:a,displayedHeight:l}=this.cachedImageDimensions,u={offsetX:n,offsetY:o,maxX:n+a,maxY:o+l},h=this.calculateResizedRect(this.dragState.resizeHandle,this.dragState.initialRect,i,d,10,u);this.focalPointElement.style.width=`${h.width}px`,this.focalPointElement.style.height=`${h.height}px`,this.focalPointElement.style.transform=`translate3d(${h.x}px, ${h.y}px, 0)`}
1735validateFocalPoint(e,r,s,c,f,i){return{x:Math.max(0,Math.min(e,f-10)),y:Math.max(0,Math.min(r,i-10)),width:Math.max(10,Math.min(s,f-e)),height:Math.max(10,Math.min(c,i-r))}}setupFocusTrap(){this.previouslyFocusedElement=document.activeElement,this.updateFocusableElements(),this.firstFocusableElement&&setTimeout(()=>{this.firstFocusableElement?.focus()},100),this.modal.addEventListener("keydown",this.boundHandleModalKeyDown),document.addEventListener("focusin",this.boundHandleFocusIn),this.modal.setAttribute("role","dialog"),this.modal.setAttribute("aria-modal","true"),this.modal.setAttribute("tabindex","-1"),this.hideBackgroundFromScreenReaders()}updateFocusableElements(){let e=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");this.focusableElements=Array.from(this.modal.querySelectorAll(e)),this.focusableElements=this.focusableElements.filter(r=>r.offsetWidth>0&&r.offsetHeight>0&&!r.hidden),this.firstFocusableElement=this.focusableElements[0]||null}handleModalKeyDown(e){if(e.key==="Escape"){e.preventDefault(),this.closeModal();return}e.key==="Tab"&&(e.preventDefault(),this.cycleFocus(e.shiftKey))}handleFocusIn(e){let r=e.target;this.modal.contains(r)||(e.preventDefault(),this.firstFocusableElement&&this.firstFocusableElement.focus())}cycleFocus(e){if(!this.focusableElements.length)return;let r=document.activeElement,s=this.focusableElements.indexOf(r),c;e?c=s<=0?this.focusableElements.length-1:s-1:c=s>=this.focusableElements.length-1?0:s+1,this.focusableElements[c]?.focus()}hideBackgroundFromScreenReaders(){Array.from(document.body.children).forEach(r=>{r!==this.modal&&!r.contains(this.modal)&&(r.setAttribute("aria-hidden","true"),r.dataset.wasAriaHidden=r.getAttribute("aria-hidden")||"false")})}
1735restoreBackgroundForScreenReaders(){document.querySelectorAll("[data-was-aria-hidden]").forEach(r=>{let s=r,c=s.dataset.wasAriaHidden;c==="false"?s.removeAttribute("aria-hidden"):c&&s.setAttribute("aria-hidden",c),delete s.dataset.wasAriaHidden})}closeModal(){this.dispose(),this.modal.style.display="none",this.previouslyFocusedElement&&setTimeout(()=>{this.previouslyFocusedElement?.focus()},100)}cleanupFocusTrap(){this.modal.removeEventListener("keydown",this.boundHandleModalKeyDown),document.removeEventListener("focusin",this.boundHandleFocusIn),this.restoreBackgroundForScreenReaders(),this.focusableElements=[],this.firstFocusableElement=null,this.previouslyFocusedElement=null}debounce(e,r){let s;return()=>{let c=()=>{clearTimeout(s),e()};clearTimeout(s),s=setTimeout(c,r)}}},en=t=>{if(!t)return{x:0,y:0,width:0,height:0,isValid:!1};try{let e=t.coordinates||"",r=t.dimensions||"",s=e.match(/\(?\s*(\d+)\s*,\s*(\d+)\s*\)?/);if(!s||s.length<3)return{x:0,y:0,width:0,height:0,isValid:!1};let c=s[1]||"0",f=s[2]||"0",i=parseInt(c,10),d=parseInt(f,10),n=r.match(/(\d+)\s*x\s*(\d+)/);if(!n||n.length<3)return{x:i,y:d,width:0,height:0,isValid:!1};let o=n[1]||"0",a=n[2]||"0",l=parseInt(o,10),u=parseInt(a,10);if(isNaN(i)||isNaN(d)||isNaN(l)||isNaN(u))return{x:0,y:0,width:0,height:0,isValid:!1};let h=Math.max(0,i),p=Math.max(0,d),g=Math.max(10,l),m=Math.max(10,u);return{x:h,y:p,width:g,height:m,isValid:!0}}catch{return{x:0,y:0,width:0,height:0,isValid:!1}}};var Ko=t=>{if(t.endingPosition){let e=en(t.endingPosition);if(e.isValid)return{x:e.x+e.width/2,y:e.y+e.height/2}}return t.cursorCoords};var Wb=16,zb=9,Yo=Wb/zb,jb=.6,Gb=960,Vb=540,Sf="/static/cursor.png",Kb=.5,Yb=.5,Zb=96,Xb=48,qb=24,Jb=4,Qb="#6495ed",ew=.2,vf=8,tw="\x89PNG",nw=.85,rr=(t,e,r)=>Math.min(Math.max(t,e),r),rw=.12,iw=.5,gl=255,ow=16,Ef=.03928,ml=12.92,Cf=.055,_f=1.055,Af=2.4,sw=Ef/ml,aw=.2126,lw=.7152,cw=.0722,Nr=t=>{let e=t/gl;return e<=Ef?e/ml:Math.pow((e+Cf)/_f,Af)},hl=t=>{let e=rr(t,0,1),r=e<=sw?e*ml:_f*Math.pow(e,1/Af)-Cf;return Math.round(rr(r,0,1)*gl)},uw=t=>aw*Nr(t.r)+lw*Nr(t.g)+cw*Nr(t.b),dw=t=>`#${[t.r,t.g,t.b].map(e=>rr(e,0,gl).toString(ow).padStart(2,"0")).join("")}`,hw=t=>{let e=tr(t);if(e===Va)return Qb;let r=fi(e),s=uw(r),c=rr(s,rw,iw);if(c===s||s<=0)return e;let f=c/s;return dw({r:hl(Nr(r.r)*f),g:hl(Nr(r.g)*f),b:hl(Nr(r.b)*f)})},fw=t=>{let{r:e,g:r,b:s}=fi(t);return`rgba(${e}, ${r}, ${s}, ${ew})`},Tf=(t,e,r)=>{let s=Ko(t);return s?{x:rr(s.x,0,Math.max(0,e-1)),y:rr(s.y,0,Math.max(0,r-1))}:null},pw=(t,e,r)=>{if(t<=0||e<=0)throw new Error("Image dimensions must be positive.");let s=Tf(r,t,e);if(!s)return{x:0,y:0,width:t,height:e};let c=Math.round(t*jb),f=Math.round(c/Yo),i=Math.min(Gb,t),d=Math.min(Vb,e);if(c<i||f<d){let u=i/Math.max(1,c),h=d/Math.max(1,f),p=Math.max(u,h);c=Math.round(c*p),f=Math.round(f*p)}c=Math.min(c,t),f=Math.min(f,e),c/f>Yo?c=Math.min(t,Math.round(f*Yo)):f=Math.min(e,Math.round(c/Yo));let n=Math.max(0,t-c),o=Math.max(0,e-f),a=rr(Math.round(s.x-c/2),0,n),l=rr(Math.round(s.y-f/2),0,o);return{x:a,y:l,width:c,height:f}},gw=(t,e,r,s=Kb,c=Yb,f=Zb)=>{let i=f/Math.max(1,r),d=Math.max(1,Math.round(e*i)),n=Math.max(1,Math.round(r*i));return{x:Math.round(t.x-d*s),y:Math.round(t.y-n*c),width:d,height:n}},mw=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),kf=async t=>{if(typeof createImageBitmap=="function")try{return await createImageBitmap(t)}catch{}let e=URL.createObjectURL(t);try{return await new Promise((r,s)=>{let c=new Image;c.onload=()=>{r(c)},c.onerror=()=>{s(new Error("Failed to decode documentation image."))},c.src=e})}finally{URL.revokeObjectURL(e)}},vw=async(t=Sf)=>{try{let e=await fetch(t,{cache:"no-cache"});if(!e.ok)return console.warn(`Documentation cursor: failed to fetch ${t} (${e.status}).`),null;let r=await e.blob(),s=new Uint8Array(await r.slice(0,vf).arrayBuffer());return s.length>=vf&&Array.from(tw).every((f,i)=>s[i]===f.charCodeAt(0))?await kf(r):(console.warn(`Documentation cursor: ${t} did not respond with a PNG.`),null)}catch(e){return console.warn("Documentation cursor: failed to load overlay asset.",e),null}},yf=async(t,e,r)=>{if(t instanceof OffscreenCanvas&&typeof t.convertToBlob=="function")return t.convertToBlob(typeof r>"u"?{type:e}:{type:e,quality:r});let s=t;return new Promise((c,f)=>{s.toBlob(i=>{if(!i){f(new Error(`Failed to encode documentation image as ${e}.`));return}c(i)},e,r)})},yw=(t,e)=>{if(typeof OffscreenCanvas<"u"){let c=new OffscreenCanvas(t,e),f=c.getContext("2d");if(!f)throw new Error("Unable to create OffscreenCanvas 2D context.");return{canvas:c,context:f}}
1735let r=document.createElement("canvas");r.width=t,r.height=e;let s=r.getContext("2d");if(!s)throw new Error("Unable to create canvas 2D context.");return{canvas:r,context:s}},bf=(t,e,r,s,c,f,i)=>{let{canvas:d,context:n}=yw(e.width,e.height);if(n.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height),r&&s){let o=mw(r,e);n.save(),n.beginPath(),n.arc(o.x,o.y,Xb,0,Math.PI*2),n.fillStyle=fw(i),n.shadowColor=i,n.shadowBlur=qb,n.fill(),n.shadowBlur=0,n.lineWidth=Jb,n.strokeStyle=i,n.stroke(),n.restore();let a=gw({x:r.x-e.x,y:r.y-e.y},c,f);n.drawImage(s,a.x,a.y,a.width,a.height)}return d},fl=async(t,e)=>{if(e)try{let s=await yf(t,"image/webp",nw);if(s.size>0)return{blob:s,mimeType:"image/webp"}}catch{}return{blob:await yf(t,"image/png"),mimeType:"image/png"}},wf=t=>t==="image/webp"?"webp":"png",xf=t=>"naturalWidth"in t?{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}:{width:t.width,height:t.height},bw=t=>{t&&"close"in t&&typeof t.close=="function"&&t.close()},bi=null,Zo=null,pl=new Map;var ww=async t=>Zo!==null?Zo:(bi||(bi=vw(t??Sf).then(e=>(Zo=e,e===null&&(bi=null),e)).catch(e=>{throw bi=null,Zo=null,e})),bi),xw=(t,e,r)=>{let s=t.cursorCoords?`${Math.round(t.cursorCoords.x)},${Math.round(t.cursorCoords.y)}`:"none",c=t.endingPosition?`${t.endingPosition.coordinates}|${t.endingPosition.dimensions}`:"none";return`${e}:${t.imageFileName}:${s}:${c}:${t.image?.size??0}:${r}`},Mf=async(t,e,r)=>{if(!t.image)throw new Error(`Missing image bytes for ${t.imageFileName}.`);let s=hw(r?.highlightColor),c=xw(t,e,s),f=pl.get(c);if(f)return f;let i=(async()=>{let d=await kf(t.image);try{let{width:n,height:o}=xf(d),a=await ww(r?.cursorAssetUrl),l=a?xf(a):{width:0,height:0},u=Tf(t,n,o);a?u||console.warn(`Documentation cursor: no click/focus for ${t.imageFileName}; skipping overlay.`):console.warn("Documentation cursor: overlay unavailable; exporting screenshots without cursor.");let h=pw(n,o,t),p=h.width<n||h.height<o,g=bf(d,h,u,a,l.width,l.height,s),m=bf(d,{x:0,y:0,width:n,height:o},u,a,l.width,l.height,s),y=r?.preferWebpForHtml??!0,[b,C,E]=await Promise.all([fl(g,y),fl(m,y),fl(g,!1)]),w=String(e+1).padStart(2,"0");return{cropBlob:b.blob,cropFileName:`step-${w}-crop.${wf(b.mimeType)}`,cropMimeType:b.mimeType,cropWidth:h.width,cropHeight:h.height,fullBlob:C.blob,fullFileName:`step-${w}.${wf(C.mimeType)}`,fullMimeType:C.mimeType,fullWidth:n,fullHeight:o,focusRect:p?{...h}:null,ditaCropBlob:E.blob,ditaCropFileName:`step-${w}.png`,isCropped:p}}finally{bw(d)}})();pl.set(c,i);try{return await i}catch(d){throw pl.delete(c),d}};var If='<?xml version="1.0" encoding="UTF-8"?>',Sw='<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">',Ew='<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">',Cw="dita/topics/guide-task.dita",_w="dita/guide.ditamap",Aw="index.html",Tw="assets/guide.css",vl="topics/guide-task.dita",$f="../../images/",kw=6,Zt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),Ct=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Mw=t=>{let e=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return e?/^[0-9]/.test(e)?`id-${e}`:e:"guide-task"},yl=(t,e)=>{let s=t.imageFileName.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp)$/)?.[1]??"png";return`step-${String(e+1).padStart(2,"0")}.${s}`},Lf=t=>t.stepTitle?.trim()||t.cmd.replace(/\.$/,""),Rf=t=>`<uicontrol>${Zt(t)}</uicontrol>`,Lw=t=>dl(t).map(e=>e.isUiControl?`<span class="uicontrol">${Ct(e.text)}</span>`:Ct(e.text)).join(""),Rw=t=>{let e=t.menuPath??[],r=e.length>1?`<menucascade>${e.map(Rf).join("")}</menucascade>`:"",s=(e[e.length-1]??"").toLowerCase(),c=!1,f=dl(t).map(n=>n.isUiControl?r&&!c&&n.text.toLowerCase()===s?(c=!0,r):Rf(n.text):Zt(n.text)).join("");if(!r||c)return f;let i=f.endsWith(".");return`${i?f.slice(0,-1):f} (${r})${i?".":""}`},Iw=()=>`body {
1736  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
1737  font-size: 1rem;
1738  line-height: 1.5;
1739  margin: 0;
1740  color: #111827;
1741  background: #f8fafc;
1742}
1743main {
1744  max-width: 72rem;
1745  margin: 0 auto;
1746  padding: 2.5rem 2rem 4rem;
1747  background: #ffffff;
1748}
1749h1 {
1750  font-size: 1.875rem;
1751  line-height: 1.25;
1752  margin: 0 0 0.75rem;
1753  max-width: 32ch;
1754}
1755h2.step-title {
1756  font-size: 1.25rem;
1757  line-height: 1.3;
1758  margin: 0 0 0.75rem;
1759  font-weight: 700;
1760}
1761.shortdesc, .context, .prereq, .result {
1762  margin: 0 0 1rem;
1763  max-width: 65ch;
1764}
1765.prereq {
1766  padding: 0.75rem 1rem;
1767  border: 1px solid #d1d5db;
1768  background: #f9fafb;
1769}
1770.on-this-page {
1771  margin: 0 0 1.5rem;
1772  padding: 1rem 1.1rem;
1773  border: 1px solid #e5e7eb;
1774  background: #f9fafb;
1775  max-width: 65rem;
1776}
1777.on-this-page h2 {
1778  font-size: 1rem;
1779  margin: 0 0 0.5rem;
1780}
1781.on-this-page ol {
1782  margin: 0;
1783  padding-left: 1.25rem;
1784  columns: 2;
1785  column-gap: 2.5rem;
1786}
1787.on-this-page li {
1788  break-inside: avoid;
1789  margin-bottom: 0.25rem;
1790}
1791.on-this-page a {
1792  color: #1d4ed8;
1793  text-decoration: underline;
1794}
1795.on-this-page a:focus-visible {
1796  outline: 2px solid #2563eb;
1797  outline-offset: 2px;
1798}
1799ol.steps {
1800  padding-left: 1.25rem;
1801  margin: 0;
1802}
1803li.step {
1804  margin-bottom: 3.5rem;
1805  scroll-margin-top: 1rem;
1806}
1807li.step::marker {
1808  font-weight: 700;
1809}
1810.cmd {
1811  font-weight: 700;
1812  margin: 0 0 0.75rem;
1813  max-width: 65ch;
1814}
1815.info, .stepresult {
1816  margin: 0 0 0.75rem;
1817  max-width: 65ch;
1818}
1819.stepresult {
1820  color: #374151;
1821}
1822.uicontrol {
1823  padding: 0.05rem 0.3rem;
1824  border: 1px solid #cbd5e1;
1825  border-radius: 0.25rem;
1826  background: #f1f5f9;
1827  white-space: nowrap;
1828}
1829.step-image-frame {
1830  position: relative;
1831  width: 100%;
1832  margin-top: 0.75rem;
1833  overflow: hidden;
1834  border: 1px solid #e5e7eb;
1835  background: #596771;
1836}
1837.step-image-frame img {
1838  position: relative;
1839  display: block;
1840  width: 100%;
1841  height: auto;
1842  object-fit: contain;
1843  transition: transform 0.5s ease-in-out;
1844  margin: 0;
1845  padding: 0;
1846}
1847.step-image-alt {
1848  margin: 0.35rem 0 0;
1849  max-width: 65ch;
1850  color: #6b7280;
1851  font-size: 0.875rem;
1852  font-style: italic;
1853}
1854.step-image-toggle {
1855  margin-top: 0.75rem;
1856  border: 0;
1857  background: transparent;
1858  color: #1d4ed8;
1859  text-decoration: underline;
1860  cursor: pointer;
1861  padding: 0;
1862  font: inherit;
1863}
1864.step-image-toggle:hover {
1865  background: #eff6ff;
1866  color: #1e40af;
1867}
1868.result {
1869  padding-top: 1rem;
1870  border-top: 1px solid #e5e7eb;
1871}
1872.step-image-toggle:focus-visible {
1873  outline: 2px solid #2563eb;
1874  outline-offset: 2px;
1875}
1876@media (max-width: 40rem) {
1877  main {
1878    padding: 1.25rem 1rem 2rem;
1879  }
1880  .on-this-page ol {
1881    columns: 1;
1882  }
1883}
1884`,$w=(t,e)=>{let s=t.steps.length>=kw?`<nav class="on-this-page" aria-label="On this page">
1885  <h2>On this page</h2>
1886  <ol>
1887${t.steps.map(n=>`    <li><a href="#${Ct(n.id)}">${Ct(Lf(n))}</a></li>`).join(`
1888`)}
1889  </ol>
1890</nav>`:"",c=t.steps.map((n,o)=>{let a=e[o],l=a?.fullFileName??yl(n,o),u=a?.fullWidth,h=a?.fullHeight,p=o===0?"":' loading="lazy"',g=u&&h?` width="${u}" height="${h}"`:"",m=n.info?`<p class="info">${Ct(n.info)}</p>`:"",y=n.stepresult?`<p class="stepresult"><strong>Step result:</strong> ${Ct(n.stepresult)}</p>`:"",b=a?.isCropped&&a.focusRect?` data-focus-x="${a.focusRect.x}" data-focus-y="${a.focusRect.y}" data-focus-width="${a.focusRect.width}" data-focus-height="${a.focusRect.height}"`:"",C=a?.isCropped&&a.focusRect?"step-image-frame preview-active":"step-image-frame",E=`${n.id}-image`,w=a?.isCropped&&a.focusRect?`<button type="button" class="step-image-toggle" data-focus-toggle aria-controls="${Ct(E)}" aria-pressed="true">View full image</button>`:"",k=n.alt.trim()?`<p class="step-image-alt" aria-hidden="true">${Ct(n.alt)}</p>`:"";return`<li class="step" id="${Ct(n.id)}">
1891  <h2 class="step-title">${Ct(Lf(n))}</h2>
1892  <p class="cmd">${Lw(n)}</p>
1893  ${m}
1894  ${y}
1895  <div class="${C}" id="${Ct(E)}"${b}>
1896    <img src="images/${Ct(l)}" alt="${Ct(n.alt)}"${g}${p} decoding="async" />
1897  </div>
1898  ${k}
1899  ${w}
1900</li>`}).join(`
1901`),f=t.prereq?`<p class="prereq"><strong>Before you begin:</strong> ${Ct(t.prereq)}</p>`:"",i=t.context?`<p class="context">${Ct(t.context)}</p>`:"",d=t.result?`<p class="result"><strong>Result:</strong> ${Ct(t.result)}</p>`:"";return`<!DOCTYPE html>
1902<html lang="en-US">
1903<head>
1904  <meta charset="utf-8" />
1905  <meta name="viewport" content="width=device-width, initial-scale=1" />
1906  <title>${Ct(t.title)}</title>
1907  <link rel="stylesheet" href="assets/guide.css" />
1908</head>
1909<body>
1910  <main>
1911    <h1>${Ct(t.title)}</h1>
1912    <p class="shortdesc">${Ct(t.shortdesc)}</p>
1913    ${f}
1914    ${i}
1915    ${s}
1916    <ol class="steps">
1917${c}
1918    </ol>
1919    ${d}
1920  </main>
1921  <script>
1922${mf()}
1923  <\/script>
1924</body>
1925</html>
1926`},Ow=(t,e)=>{let r=Mw(t.title),s=t.prereq?`    <prereq><p>${Zt(t.prereq)}</p></prereq>
1927`:"",c=t.context?`    <context><p>${Zt(t.context)}</p></context>
1928`:"",f=t.result?`    <result><p>${Zt(t.result)}</p></result>
1929`:"",i=t.steps.map((d,n)=>{let a=e[n]?.ditaCropFileName??yl({...d,imageFileName:d.imageFileName.replace(/\.\w+$/,".png")},n),l=[];d.info&&l.push(`<p>${Zt(d.info)}</p>`),l.push(`<image href="${$f}${Zt(a)}" placement="break"><alt>${Zt(d.alt)}</alt></image>`);let u=d.stepresult?`
1930      <stepresult><p>${Zt(d.stepresult)}</p></stepresult>`:"";
1930return`    <step id="${Zt(d.id)}">
1931      <cmd>${Rw(d)}</cmd>
1932      <info>${l.join("")}</info>${u}
1933    </step>`}).join(`
1934`);return`${If}
1935${Sw}
1936<task id="${Zt(r)}" xml:lang="en-US">
1937  <title>${Zt(t.title)}</title>
1938  <shortdesc>${Zt(t.shortdesc)}</shortdesc>
1939  <taskbody>
1940${s}${c}    <steps>
1941${i}
1942    </steps>
1943${f}  </taskbody>
1944</task>
1945`},Nw=t=>`${If}
1946${Ew}
1947<map xml:lang="en-US">
1948  <title>${Zt(t.title)}</title>
1949  <topicref href="${vl}" type="task"/>
1950</map>
1951`,Dw=(t,e)=>{if(t.steps.length===0)throw new Error("DITA task requires at least one step.");t.steps.forEach((r,s)=>{if(!r.cmd.trim())throw new Error(`Step ${s+1} is missing required cmd.`);if(!r.alt.trim())throw new Error(`Step ${s+1} is missing image alt text.`);let c=e[s],f=c?.ditaCropFileName??c?.fullFileName;if(!f||f.includes(" ")||f.includes("\\"))throw new Error(`Step ${s+1} has an invalid portable image filename.`)})},Fw=(t,e)=>{if(typeof DOMParser>"u"){if(!t.includes("<cmd>")||!t.includes("</steps>"))throw new Error("Task XML failed structural assertions.");if(!e.includes(`href="${vl}"`))throw new Error("Map XML failed topicref assertions.");return}let r=new DOMParser,s=r.parseFromString(t,"application/xml"),c=r.parseFromString(e,"application/xml");if(s.querySelector("parsererror"))throw new Error("Generated DITA task is not well-formed XML.");
1951if(c.querySelector("parsererror"))throw new Error("Generated DITA map is not well-formed XML.");let f=s.documentElement;if(f.nodeName!=="task")throw new Error("DITA root element must be task.");if(!f.getAttribute("id"))throw new Error("DITA task is missing id.");if(f.getAttribute("xml:lang")!=="en-US")throw new Error('DITA task must set xml:lang="en-US".');if(!s.querySelector("title")||!s.querySelector("shortdesc"))throw new Error("DITA task requires title and shortdesc.");let i=s.querySelectorAll("taskbody > steps > step");if(i.length===0)throw new Error("DITA task requires at least one step.");i.forEach((n,o)=>{if(!n.querySelector("cmd")?.textContent?.trim())throw new Error(`DITA step ${o+1} is missing cmd.`);let a=n.querySelector("info image");if(a&&!a.querySelector("alt")?.textContent?.trim())throw new Error(`DITA step ${o+1} image is missing alt.`);let l=a?.getAttribute("href")??"";if(a&&(l.includes("\\")||l.startsWith("/")||!l.startsWith($f)))throw new Error(`DITA step ${o+1} image href must be a relative images URI.`)});let d=c.querySelector("topicref");if(d?.getAttribute("href")!==vl)throw new Error("DITA map topicref must resolve to topics/guide-task.dita.");if(d.getAttribute("type")!=="task")throw new Error('DITA map topicref must set type="task".')},Pw=t=>t.steps.map((e,r)=>{let s=String(r+1).padStart(2,"0");return{fullFileName:yl(e,r),ditaCropFileName:`step-${s}.png`,cropWidth:0,cropHeight:0,fullWidth:0,fullHeight:0,focusRect:null,isCropped:!1}}),Bw=(t,e)=>{let r=e??Pw(t);Dw(t,r);let s=$w(t,r),c=Iw(),f=Ow(t,r),i=Nw(t);return Fw(f,i),{imageMeta:r,html:s,css:c,taskXml:f,mapXml:i}};var Hw=t=>({fullFileName:t.fullFileName,ditaCropFileName:t.ditaCropFileName,cropWidth:t.cropWidth,cropHeight:t.cropHeight,fullWidth:t.fullWidth,fullHeight:t.fullHeight,focusRect:t.focusRect,isCropped:t.isCropped}),Uw=(t,e)=>e.find(r=>r.sceneId===t.sceneId)??e.find(r=>r.imageFileName===t.imageFileName),Ww=async(t,e,r)=>{let s=[];for(let n=0;n<t.steps.length;n++){let o=t.steps[n],a=Uw(o,e);if(!a?.image)throw new Error(`Missing image bytes for ${o.imageFileName}.`);s.push(await Mf(a,n,{highlightColor:r?.highlightColor}))}let c=s.map(Hw),f=Bw(t,c),i=new Ft("application/zip"),d=new er(i);await d.add(Aw,new yn(f.html)),await d.add(Tw,new yn(f.css)),await d.add(_w,new yn(f.mapXml)),await d.add(Cw,new yn(f.taskXml));for(let n of s)await d.add(`images/${n.fullFileName}`,new cn(n.fullBlob)),n.ditaCropFileName!==n.fullFileName&&await d.add(`images/${n.ditaCropFileName}`,new cn(n.ditaCropBlob));return d.close()},Of=async(t,e,r)=>{let s=await Ww(t,e,r),c=URL.createObjectURL(s),f=document.createElement("a");f.href=c,f.download="camtasia-documentation.zip",f.style.display="none",document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(c)};var zw=.3,jw=.9,Pf=40,Gw=3,wl=t=>{let e=Math.max(0,Math.floor(t));return e===0?{minimumSteps:0,maximumSteps:0}:{minimumSteps:Math.max(1,Math.ceil(e/Gw)),maximumSteps:e}},Vw=(t,e)=>{if(e<=1||t.length<=e)return t.slice(0,Math.max(0,e));let r=t.length-1,s=[],c=new Set;for(let f=0;f<e;f+=1){let i=Math.round(f*r/(e-1));c.has(i)||(c.add(i),s.push(t[i]))}return s},bl="/static/documentation-bot.md",Nf=4,Kw=/<[a-z/!?]/i,Yw=/^screenshot\s+(?:for|of)\s+(?:scene|step)[\s-]?\d+/i,wn=(t,e)=>{let r=t.trim();if(!r)throw new Error(`${e} must be non-empty plain text.`);if(Kw.test(r))throw new Error(`${e} must not contain HTML or XML tags.`);return r},Df=(t,e)=>{if(t===null||typeof t>"u")return;if(!Array.isArray(t))throw new Error(`${e} must be an array of plain-text strings.`);let r=t.map((s,c)=>{if(typeof s!="string")throw new Error(`${e}[${c}] must be a string.`);return wn(s,`${e}[${c}]`)});if(r.length!==0)return r},Zw=async t=>{let e=URL.createObjectURL(t);try{let r=await new Promise((f,i)=>{let d=new Image;d.onload=()=>{f(d)},d.onerror=()=>{i(new Error("Failed to decode scene thumbnail."))},d.src=e}),s=document.createElement("canvas"),c=s.getContext("2d");return c?(s.width=Math.max(1,Math.floor(r.width/Nf)),s.height=Math.max(1,Math.floor(r.height/Nf)),c.drawImage(r,0,0,s.width,s.height),s.toDataURL("image/png")):e}finally{URL.revokeObjectURL(e)}},Xw=async()=>{let t=await fetch(bl,{cache:"no-store"});if(!t.ok)throw new Error(`Failed to load documentation prompt from ${bl} (${t.status}).`);let e=(await t.text()).trim();if(!e)throw new Error(`Documentation prompt at ${bl} is empty.`);return e},Bf=t=>{let e=Ko(t);return e&&{x:Math.round(e.x),y:Math.round(e.y)}},qw=t=>{if(t.endingPosition){let e=t.endingPosition.focus||"(unnamed focus)",r=Bf(t);return r?`${e}; cursor lands at (${r.x},${r.y}); region ${t.endingPosition.coordinates} ${t.endingPosition.dimensions}`:e}
1951return t.cursorCoords?`cursor lands at (${t.cursorCoords.x},${t.cursorCoords.y})`:"(no focus area)"},Hf=(t,e)=>{let r=new Map;for(let s of t){if(!s.image)continue;let c=r.get(s.imageFileName);if(c){c.scenes.push(s);continue}r.set(s.imageFileName,{imageFileName:s.imageFileName,image:s.image,scenes:[s]})}return Vw([...r.values()],e)},Jw=(t,e)=>Hf(t,e).reduce((r,s)=>r+s.scenes.length,0),Qw=t=>{let e=t.scenes.map(r=>{let s=Bf(r),c=s?`cursor lands at (${s.x},${s.y})`:"no focus area";return`- ${r.sceneId}: ${c}`});return t.scenes.length===1?`Thumbnail for ${t.scenes[0].sceneId} (${t.imageFileName}):`:[`Thumbnail for ${t.imageFileName}, shared by ${t.scenes.length} scenes that differ only in where the cursor lands:`,...e,"Attribute each step to the sceneId whose cursor point sits on the control that step acts on."].join(`
1952`)},e0=t=>{let e=t.map(d=>{let n=d.transcript||"(no source transcript for this scene)",o=d.callout||"(no callout)",a=qw(d);return[`sceneId: ${d.sceneId}`,`imageFileName: ${d.imageFileName}`,`sceneTitle: ${d.sceneTitle}`,`voiceover: ${d.voiceover}`,`callout: ${o}`,`focusArea: ${a}`,`sourceTranscript: ${n}`].join(`
1953`)}),r=wl(t.length),s=Jw(t,Pf),c=s<t.length?[`Only ${s} of these ${t.length} scenes include a thumbnail. For a scene without one, rely on its voiceover and sourceTranscript, and do not name a UI control you cannot see.`,""]:[],i=t.some(d=>d.transcript.trim().length>0)?[]:["These scenes come from screenshots, not a screen recording, so none of them has a source transcript. Take each scene's voiceover and callout as the authored account of what happens, and keep the step faithful to it.",""];return[`Step budget for these ${t.length} scenes: at least ${r.minimumSteps} and at most ${r.maximumSteps} task-level steps.`,"",...c,...i,"Storyboard scenes with matching source evidence (in order):","",e.join(`
1954
1955`),"","Produce the JSON guide now."].join(`
1956`)},t0=(t,e,r)=>{let s=new Map(e.map(n=>[n.sceneId,n]));if(!Array.isArray(t.steps))throw new Error("Guide steps must be an array.");let c=wl(e.length);if(t.steps.length>c.maximumSteps)throw new Error(`Guide must contain no more than ${c.maximumSteps} task-level steps for ${e.length} scenes.`);let f=t.steps.map((n,o)=>{let a=n;if(typeof a.sceneId!="string")throw new Error(`Step ${o+1} is missing sceneId.`);let l=s.get(a.sceneId);if(!l)throw new Error(`Unknown sceneId "${a.sceneId}".`);if(typeof a.cmd!="string")throw new Error(`Step ${o+1} is missing cmd.`);let u=wn(a.cmd,`steps[${o}].cmd`),h=Df(a.uiControls,`steps[${o}].uiControls`),p=Df(a.menuPath,`steps[${o}].menuPath`),g=typeof a.alt=="string"&&a.alt.trim()?wn(a.alt,`steps[${o}].alt`):"",m=h?.join(" and ")||l.callout||l.sceneTitle||u.replace(/\.$/,""),y={id:pf(o+1),sceneId:a.sceneId,cmd:u,imageFileName:l.imageFileName,alt:g&&!Yw.test(g)?g:`Screen showing ${m}`};return typeof a.stepTitle=="string"&&a.stepTitle.trim()?y.stepTitle=wn(a.stepTitle,`steps[${o}].stepTitle`):l.sceneTitle&&(y.stepTitle=l.sceneTitle),typeof a.info=="string"&&a.info.trim()&&(y.info=wn(a.info,`steps[${o}].info`)),typeof a.stepresult=="string"&&a.stepresult.trim()&&(y.stepresult=wn(a.stepresult,`steps[${o}].stepresult`)),h&&(y.uiControls=h),p&&(y.menuPath=p),y});if(typeof t.title!="string")throw new Error("Guide title is required.");if(typeof t.shortdesc!="string")throw new Error("Guide shortdesc is required.");let i={};typeof t.prereq=="string"&&t.prereq.trim()&&(i.prereq=wn(t.prereq,"prereq")),typeof t.context=="string"&&t.context.trim()&&(i.context=wn(t.context,"context")),typeof t.result=="string"&&t.result.trim()&&(i.result=wn(t.result,"result"));let d=r?.trim();return d&&(i.sourceFileName=d),gf(wn(t.title,"title"),wn(t.shortdesc,"shortdesc"),f,i)},n0=t=>{let e=t.trim(),s=e.match(/```(?:json)?\s*([\s\S]*?)```/i)?.[1]?.trim()??e,c=s.indexOf("{"),f=s.lastIndexOf("}");if(c<0||f<=c)throw new Error("Model response did not contain a JSON object.");return JSON.parse(s.slice(c,f+1))},r0=async(t,e)=>{let r=new TextDecoder,s="";for(;;){let{done:c,value:f}=await t.read();if(c)break;f&&(s+=r.decode(f,{stream:!0}),e?.())}return s+=r.decode(),s},i0=(t,e)=>Array.isArray(t.steps)&&t.steps.length>e.maximumSteps,o0=(t,e)=>[`The draft contains ${Array.isArray(t.steps)?t.steps.length:0} frame-level steps. Consolidate it into at least ${e.minimumSteps} and no more than ${e.maximumSteps} task-level steps.`,"Return ONLY one JSON object with the same schema.","Merge only adjacent actions and preserve their order.","
1956Every draft step must survive somewhere: as its own step, or described in the info or stepresult of the step it was merged into. Dropping an action is not consolidation.","For each merged step, keep the sceneId of the first click the step instructs. Never advance it to a screenshot showing the action already completed; describe that outcome in stepresult.","Keep alternative methods together in info, move optional cleanup into info, and move repetition or final verification into result.","Keep the uiControls and menuPath arrays on every merged step, carrying over the exact labels from the draft steps that were merged.","Do not introduce controls or states that are not already present in the draft.","Replace generic alt text with a description of the visible control or state.","",JSON.stringify(t)].join(`
1957`),Ff=async(t,e)=>{let r=[{role:"system",content:await Xw()},{role:"user",content:t}],s=await nr(jw,zw,r),c=await r0(s,e);return n0(c)},xl=async(t,e,r)=>{if(t.length===0)throw new Error("No storyboard scene evidence available for documentation.");if(!t.some(d=>d.voiceover.length>0))throw new Error("The storyboard has no usable voiceover script for documentation.");let s=[{type:"text",text:e0(t)}],c=Hf(t,Pf);for(let d of c){let n=await Zw(d.image);s.push({type:"text",text:Qw(d)}),s.push({type:"image_url",image_url:{url:n}})}let f=wl(t.length),i=await Ff(s,r);return i0(i,f)&&(i=await Ff(o0(i,f),r)),t0(i,t,e)};var s0=t=>Ie.getImage(t).catch(()=>null),Uf=async(t,e=s0)=>{let r=await Promise.all(t.map(async c=>{if(c.image)return c;let f=await e(c.imageFileName);return f?{...c,image:f}:c})),s=r.filter(c=>!c.image).map(c=>c.imageFileName);if(s.length>0)throw new Error(`Missing image bytes for ${s.length} step(s): ${s.join(", ")}.`);return r},Xo=(t,e)=>{let{evidence:r}=jo(t,e);return Go(r)},Wf=async(t,e,r)=>{let{evidence:s}=jo(t,e,r?.sourceFileName);if(!Go(s))return null;let c=await Uf(s),f=await xl(c,r?.sourceFileName,r?.onProgress);return ul(cl(c,r?.sourceFileName),f),f},zf=async(t,e,r)=>{let{evidence:s}=jo(t,e,r?.sourceFileName);if(!Go(s))throw new Error("Generate a storyboard with narrated scenes before exporting technical documentation.");let c=await Uf(s),f=cl(c,r?.sourceFileName),i=ff(f)??await xl(c,r?.sourceFileName,r?.onProgress);return ul(f,i),await Of(i,c,r),i};var yt="Starting video generation...",a0=t=>{try{console.log(`Fallback method, payload has ${t.scenes.length} scenes and ${t.additionalMedia.length} media items`);let e=cf(t);if(!e?.includes("```lua"))throw new Error("Template-based fallback did not return a valid Lua script");return e}catch(e){throw console.error("Template-based fallback failed:",e),console.error("Error details:",e instanceof Error?e.message:String(e)),e}},jf=(t,e,r)=>{yt=r?`
1958[DEBUG] Generating fallback Lua script...`:`
1959OpenAI failed - Using deterministic fallback...`,e(yt);try{nt.applySceneEditsFromDOM();let c={scenes:nt.getScenes().map(n=>({sceneNumber:n.sceneNumber,title:n.sceneTitle,voiceover:{text:n.voiceover,audioFile:t[n.sceneNumber]||`scene${n.sceneNumber}.mp3`},callout:n.callout,screenshot:n.screenshot,endingPosition:n.endingPosition})),additionalMedia:[...be.filter(n=>!n.file.name.endsWith(".ocr")&&!n.file.name.endsWith(".lua")).map(n=>`./${n.file.name}`),...ir]};ll(c,be.map(n=>n.file.name));let f=a0(c),i={role:"assistant",content:r?`[DEBUG MODE] Generated Lua script using a fallback method for testing.
1960
1961${f}`:`I encountered issues generating the script via AI, so I've created a deterministic Lua script using a fallback method. This ensures your video generation succeeds!
1962
1963${f}`};tt[tn].addMessage(i),localStorage.setItem(`bot${tn}-chat-history`,JSON.stringify(tt[tn].getHistoryForStorage())),yt=r?`
1964[DEBUG] Executing fallback Lua script...`:`
1965Executing fallback Lua script...`,e(yt),xi(f),console.log(r?"DEBUG: Fallback test successful":"Fallback successful using deterministic method")}catch(c){throw console.error("All fallback methods failed:",c),new Error(`Failed to generate Lua script${r?" in debug mode":" after 3 attempts"} and fallback methods failed: ${c}`)}},l0=async(t,e)=>{document.getElementById("loading-indicator").style.display="",nt.applySceneEditsFromDOM();
1965let r={scenes:nt.getScenes().map(a=>({sceneNumber:a.sceneNumber,title:a.sceneTitle,voiceover:{text:a.voiceover,audioFile:t[a.sceneNumber]||`scene${a.sceneNumber}.mp3`},callout:a.callout,screenshot:a.screenshot,endingPosition:a.endingPosition})),additionalMedia:be.filter(a=>!a.file.name.endsWith(".ocr")&&!a.file.name.endsWith(".lua")).map(a=>`./${a.file.name}`)};for(let a of ir)r.additionalMedia.push(a);ll(r,be.map(a=>a.file.name));let s={role:"user",content:`\`\`\`json
1966${JSON.stringify(r,null,2)}
1967\`\`\`
1968
1969Please write the Lua script for this video.`};for(let a of be)await we.addFileIfNeeded(a.file.name,a.file,!0);let c=parseInt(tn,10),f=ar(s,c,"no-history"),i=parseFloat(localStorage.getItem("bot1-temp")??"0.2"),d=parseFloat(localStorage.getItem("bot1-top-p")??"1"),n="";try{let a=await f.getHistoryForChatGPT(),l=await nr(d,i,a),u=new TextDecoder;for(;;){let{done:h,value:p}=await l.read();if(h)break;e("."),n+=u.decode(p,{stream:!0})}}catch(a){alert(a),n=`\`Received an error: ${a.toString()}\`None`}finally{(n.endsWith("None")||n.endsWith(`None
1970`))&&(n=n.trimEnd(),n=n.slice(0,n.length-4))}uf(n,r);let o=ar(s,c,"preserve-current-history");return tt[tn]=o,localStorage.setItem(`bot${tn}-chat-history`,JSON.stringify(o.getHistoryForStorage())),n},c0=async(t,e)=>{try{nt.applySceneEditsFromDOM();let r=nt.getScenes();if(r.length===0)throw new Error("No scenes available for voiceover generation");let s=Si(),c=!1;try{Xo(r,s)&&(yt="Writing documentation...",c=!0,e(yt),await Wf(r,s,{onProgress:()=>e(".")}))}catch(h){console.warn("Skipped documentation for this video:",h)}yt=c?`
1971Starting video generation...`:"Starting video generation...",e(yt);let f={},i=localStorage.getItem(wi);if(i)try{let h=JSON.parse(i);for(let p of h)await we?.deleteFile(p),await Ie.deleteImage(p).catch(()=>{})}catch(h){console.warn("Failed to clean up previous voiceovers before regeneration:",h)}let d=async h=>{let p=1;for(;;){let g=p===1?`scene${h}.mp3`:`scene${h}-${p}.mp3`;if(!await we.doesFileExist(g))return g;p++}};for(let h=0;h<r.length;h++){let p=r[h];if(p)try{if(!p.voiceover||p.voiceover.trim()===""){console.warn(`No voiceover text for scene ${p.sceneNumber}, skipping`);continue}f[p.sceneNumber]||(f[p.sceneNumber]=await d(p.sceneNumber));let g=f[p.sceneNumber],m={Accept:"application/json","Content-Type":"application/json"},y=await _n();y&&(m.Authorization=`Bearer ${y}`);let b=await fetch("/api/v1/camtasia/text-to-speech",{method:"POST",body:JSON.stringify({voiceToUse:t,text:p.voiceover}),headers:m});if(!b.ok)throw new Error(`TTS request failed for scene ${h+1}`);let C=await b.blob();await we?.addFileIfNeeded(g,C,!0);try{await Ie.storeImage(g,C)}catch(E){console.warn(`Failed to back up voiceover ${g} to IndexedDB:`,E)}yt=`
1972Generated voiceover ${h+1}`,e(yt)}catch(g){throw console.error("Error generating voiceover for scene:",p.sceneNumber,g),new Error(`Failed to generate voiceover for scene ${h+1}: ${g}`)}}localStorage.setItem(wi,JSON.stringify(Object.values(f))),yt=`
1973Preparing media files...`,e(yt);for(let h of be)await we.addFileIfNeeded(h.file.name,h.file,!0);for(let h of ir)try{let p=await we?.getFileSize(h)??-1,g=-1;try{let C=await fetch(`/static/${h}`,{method:"HEAD"}),E=C.ok?C.headers.get("content-length"):null;E&&(g=parseInt(E,10))}catch(C){console.warn(`Could not HEAD default media ${h}; falling back to presence check:`,C)}if(!(p<=0||g>0&&p!==g))continue;let y=await fetch(`/static/${h}`);if(!y.ok)throw new Error(`Failed to load ${h}`);let b=await y.blob();await we?.addFileIfNeeded(h,b,!0)}catch(p){throw console.error(`Failed to load default media: ${h}`,p),new Error(`Failed to load required media file: ${h}`)}yt=`
1974Generating Camtasia Video...`,e(yt),qo(tn);let n=document.getElementById("how-to-handle-chat-history");n.value!=="other-bot-last-response-only"&&(n.value="other-bot-last-response-only");let o=localStorage.getItem("force-lua-fallback")==="true",a=Gf();a&&a.steps.length>10&&(o=!0),s&&s.scenes.length>10&&(o=!0),o&&(console.log("\u{1F527} DEBUG MODE: Forcing fallback for testing..."),yt=`
1975[DEBUG] Skipping OpenAI - Testing fallback...`,e(yt));let l=3,u=0;if(o)jf(f,e,!0);else for(;u<l;)try{let h=await l0(f,e);xi(h,!1),tt[tn].addMessage({role:"assistant",content:h}),localStorage.setItem(`bot${tn}-chat-history`,JSON.stringify(tt[tn].getHistoryForStorage())),yt=`
1976Executing Lua script...`,e(yt),xi(h);break}catch(h){if(console.warn("Error generating Lua script:",h),u++,u===l){jf(f,e,!1);break}}yt=`
1977Video generation complete!`,e(yt)}catch(r){throw console.error("Video generation failed:",r),r}finally{qo(bt);let r=document.getElementById("generate-video");r.disabled=!1,r.innerHTML=r.innerHTML.includes("Regenerate")?'<i class="fas fa-film"></i> Regenerate Video':'<i class="fas fa-film"></i> Generate Video',await Et();let s=document.getElementById("progress-overlay");if(s){s.style.display="none";let c=s.querySelector(".progress-text");c&&(c.textContent="")}}};document.getElementById("generate-video").onclick=async()=>{try{let t=document.getElementById("voice-select");if(!t||t.selectedIndex===-1){alert("Please select a voice in the settings before generating video.");return}let e=t.item(t.selectedIndex).value;if(!e){alert("Please select a voice in the settings before generating video.");return}
1977if(nt.getScenes().length===0){alert("No scenes found. Please create some scenes first.");return}let r=document.getElementById("generate-video");r.disabled=!0,r.innerHTML='<i class="fas fa-spinner fa-spin"></i> Generating...',await Rt(),document.getElementById("loading-indicator").classList.add("loading-visual-suppressed");let s=document.getElementById("progress-overlay");s||(s=document.createElement("div"),s.id="progress-overlay",s.innerHTML=`
1978            <div class="progress-content">
1979               <h3>Generating Camtasia Video Preview...</h3>
1980               <div class="video-generation-loader" aria-hidden="true">
1981                  <img class="camtasia-loader" src="/static/camtasia-loader.svg?v=39654440bf23" alt="">
1982               </div>
1983               <div class="progress-text"></div>
1984            </div>
1985         `,document.body.appendChild(s)),s.style.display="flex";let c=s.querySelector(".progress-text");await c0(e,f=>{c&&(c.textContent+=f,c.scrollTop=c.scrollHeight)})}catch(t){console.error("Video generation error:",t),alert(t instanceof Error?t.message:"An error occurred during video generation")}finally{let t=document.getElementById("generate-video");t.disabled=!1,t.innerHTML=t.innerHTML.includes("Regenerate")?'<i class="fas fa-film"></i> Regenerate Video':'<i class="fas fa-film"></i> Generate Video',await Et(),document.getElementById("loading-indicator").classList.remove("loading-visual-suppressed");let e=document.getElementById("progress-overlay");if(e){e.style.display="none";let r=e.querySelector(".progress-text");r&&(r.textContent="")}}};var Jo=class{static buildRefinementPrompt(e,r,s,c){let f=`Please refine and improve the following voiceover text for this scene: "${e}"
1986
1987Keep the user's intended meaning and style, but enhance clarity, flow, and engagement. `;return s?.focus&&s.focus!=="custom"&&(f+=`Focus particularly on this area: ${s.focus}. `),f+=`Scene context:
1988- Title: ${c}`,r.trim()&&(f+=`
1989- Text visible on screen: ${r}`),s?.coordinates&&s?.dimensions&&(f+=`
1990- Focus area coordinates: ${s.coordinates}, dimensions: ${s.dimensions}`),f+=`
1991
1992Please return ONLY the refined voiceover text, maintaining the user's voice while improving clarity and engagement.`,f}};var Sl="[image-cleanup]",Vf=async(t,e,r)=>{let s=typeof t=="string"?t.trim():"",c=typeof e=="string"?e.trim():"";if(!s){r.metrics.orphansSkippedEmptyName+=1;return}if(s===c){r.metrics.orphansSkippedSameName+=1;return}if(r.isStillReferenced(s)){r.metrics.orphansSkippedStillReferenced+=1;return}try{r.removeMediaItem(s)}catch(i){r.metrics.mediaBinRemoveFailures+=1,console.warn(`${Sl} media-bin remove failed: ${s}`,i)}let f=r.getOcrKey(s);try{await r.imageStore.deleteImage(s)}catch(i){r.metrics.idbImageDeleteFailures+=1,console.warn(`${Sl} idb image delete failed: ${s}`,i)}try{await r.imageStore.deleteOcr(f)}catch(i){r.metrics.idbOcrDeleteFailures+=1,console.warn(`${Sl} idb ocr delete failed: ${f}`,i)}r.metrics.orphansReaped+=1};var El={orphansReaped:0,orphansSkippedStillReferenced:0,orphansSkippedSameName:0,orphansSkippedEmptyName:0,mediaBinRemoveFailures:0,idbImageDeleteFailures:0,idbOcrDeleteFailures:0};typeof window<"u"&&(window.__imageCleanupMetrics=El);var Kf=(t,e,r="voiceover-only",s)=>{if(!t||typeof t!="object")return!1;let c=t;if(typeof c.sceneNumber!="number"&&typeof c.sceneNumber!="string"||!c.voiceover||typeof c.voiceover!="string")return!1;let f=typeof c.sceneNumber=="string"?parseInt(c.sceneNumber,10):c.sceneNumber;return!(isNaN(f)||f!==e||(r==="full-scene"||r==="narrative-fields")&&(!c.sceneTitle||typeof c.sceneTitle!="string"||!c.callout||typeof c.callout!="string")||r==="full-scene"&&(!c.screenshot||typeof c.screenshot!="string"||s&&c.screenshot!==s||!c.endingPosition||typeof c.endingPosition.focus!="string"||typeof c.endingPosition.coordinates!="string"||typeof c.endingPosition.dimensions!="string"||c.endingPosition.focus.trim()===""||c.endingPosition.coordinates.trim()===""||c.endingPosition.dimensions.trim()===""||!en({focus:c.endingPosition.focus,coordinates:c.endingPosition.coordinates,dimensions:c.endingPosition.dimensions}).isValid))};var Yf="storyboard-notification";var yr=(t,e="info",r=3e3)=>{let s=document.getElementById(Yf);s||(s=document.createElement("div"),s.id=Yf,s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","true"),document.body.appendChild(s)),s.textContent=t,s.className=`notification ${e} visible`,setTimeout(()=>{s.className=`notification ${e}`},r)};var Qo=4,Zf=8,u0=t=>{let r=t.replace(/\s+/g,"").replace(/,+/g,",").split(",").map(c=>{let f=parseInt(c.trim(),10);return isNaN(f)?0:f});return r.length!==4?null:{width:r[2]||0,height:r[3]||0}},d0=t=>{try{let r=t.replace(/\s+/g,"").replace(/,+/g,",").split(",").map(u=>{let h=parseInt(u.trim(),10);return isNaN(h)?0:h});
1992if(r.length!==4)return console.warn("Invalid OCR coordinate format:",t),{coordinates:"(0,0)",dimensions:"0x0"};let c=r[0]||0,f=r[1]||0,i=r[2]||1,d=r[3]||1,n=Math.max(0,c),o=Math.max(0,f),a=Math.max(1,i),l=Math.max(1,d);return{coordinates:`(${n},${o})`,dimensions:`${a}x${l}`}}catch(e){return console.error("Error converting OCR coordinates:",e),{coordinates:"(0,0)",dimensions:"0x0"}}},Ei=async(t,e="word")=>{let r=await cr(t);if(!r)return"";let c=(e==="paragraph"?r.paragraphs.map(i=>({text:i.paragraph,rectLTWH:i.rectLTWH})):r.words.map(i=>({text:i.word,rectLTWH:i.rectLTWH}))).filter(i=>{let d=u0(i.rectLTWH);return d?d.width>=Zf&&d.height>=Zf:!1}).map(i=>{let{coordinates:d,dimensions:n}=d0(i.rectLTWH);return`"${i.text}" ${d} ${n}`}).join(`
1993`);return`OCR Analysis for ${t}:
1994
1995IMPORTANT FOR STORYBOARD CREATION: When referencing ${e==="paragraph"?"text regions":"text elements"} in your storyboard scenes, use the coordinates and dimensions below. Each line is formatted as: "text" (x,y) widthxheight
1996- For scene.endingPosition.coordinates use the (x,y) value (format: (x,y))
1997- For scene.endingPosition.dimensions use the widthxheight value (format: widthxheight)
1998
1999Text Elements and Locations:
2000${c}`},Ci=class t{static DEFAULT_TEMPERATURE=.7;static DEFAULT_TOP_P=1;scenes=[];focusedSceneIndex=null;timelineArea=null;scrollContainer=null;replaceSceneImageInput=null;pendingReplaceSceneNumber=null;constructor(){this.timelineArea=document.getElementById("timeline-area"),this.initializeScrollContainer(),this.initializeReplaceImageInput(),this.setupAccessibilityFeatures()}applySceneEditsFromDOM(){if(!this.timelineArea)return;this.timelineArea.querySelectorAll(".timeline-card").forEach(r=>{let s=r.getAttribute("data-scene-number");if(!s)return;let c=parseInt(s,10),f=this.scenes.find(n=>n.sceneNumber===c);if(!f)return;let i=r.querySelector(".timeline-title-display");i&&(f.sceneTitle=i.textContent||f.sceneTitle),r.querySelectorAll("[data-field]").forEach(n=>{let o=n.getAttribute("data-field");if(o&&o!=="title"){let a=n.textContent||"";if(o==="voiceover")f.voiceover=a;else if(o==="callout")f.callout=a;else if(o==="endingPosition"){let l=a.match(/^(.*?)\s*\[\(\s*([^)]*?)\s*\),\s*(.+?)\s*\]$/);l&&l.length>=Qo?f.endingPosition={focus:l[1].trim(),coordinates:`(${l[2].trim()})`,dimensions:l[3].trim()}:f.endingPosition={focus:a.trim(),coordinates:"",dimensions:""}}}})}),this.saveScenes(),console.log("Applied scene edits from DOM and saved to localStorage")}render(){if(!this.timelineArea||!this.scrollContainer)return;let e=document.getElementById("main-app")?.classList.contains("player-visible")??!1;e&&(this.focusedSceneIndex=null),this.timelineArea.classList.toggle("narrow",e),this.timelineArea.classList.remove("hidden");let r=new Map;this.scrollContainer.querySelectorAll(".timeline-card").forEach(c=>{let f=c.getAttribute("data-scene-number");f&&r.set(f,c)});let s=[];this.scenes.forEach((c,f)=>{let i=c.sceneNumber.toString(),d;if(r.has(i)?(d=r.get(i),this.updateSceneCard(d,c,f,e)):d=this.createSceneCard(c,f,!0,e),document.getElementById("main-app")?.classList.contains("player-visible")){let n=d.classList.contains("expanded");if(d.classList.add("collapsed"),d.classList.remove("expanded"),n){let b=d.querySelector(".timeline-thumbnail");if(b){b.classList.remove("preview-active"),b.querySelector(".focal-point-overlay")?.remove();let E=b.querySelector("img");E&&(E.style.transform="")}}let o=d.cloneNode(!0);d.parentNode?.replaceChild(o,d),d=o,d.addEventListener("keydown",b=>{let C=document.activeElement;C&&(C.classList.contains("refresh-scene-button")||C.classList.contains("scene-image-overlay-btn")||C.classList.contains("timeline-actions")||C.tagName==="BUTTON"&&C.closest(".timeline-actions")||C.classList.contains("timeline-text-display")||C.isContentEditable||C!==d)||(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),d.click())});let a=d.classList.contains("collapsed");d.setAttribute("aria-expanded",a?"false":"true");let l=o.querySelector(".refresh-scene-button"),u=o.querySelector('button[title="Delete scene"]'),h=o.querySelector(".scene-image-overlay-btn--replace"),p=o.querySelectorAll(".scene-image-overlay-btn--focus, .edit-focal-point-button"),g=o.querySelector(".focal-point-toggle"),m=o.querySelector(".timeline-thumbnail");m?.querySelector("img")&&this.attachSceneImageDropHandlers(m,c),l&&(l.addEventListener("click",async b=>{b.stopPropagation();let C=this.scenes.find(E=>E.sceneNumber===c.sceneNumber);C&&await this.refreshSceneWithAI(C)}),l.addEventListener("keydown",async b=>{let C=b;if(C.key==="Enter"||C.key===" "){b.preventDefault(),b.stopPropagation();let E=this.scenes.find(w=>w.sceneNumber===c.sceneNumber);E&&await this.refreshSceneWithAI(E)}})),u&&(u.addEventListener("click",b=>{b.stopPropagation(),confirm("Are you sure you want to delete this scene?")&&this.deleteScene(c.sceneNumber)}),u.addEventListener("keydown",b=>{let C=b;(C.key==="Enter"||C.key===" ")&&(b.preventDefault(),b.stopPropagation(),confirm("Are you sure you want to delete this scene?")&&this.deleteScene(c.sceneNumber))})),h&&(h.addEventListener("click",b=>{b.stopPropagation(),this.promptSceneImageReplace(c.sceneNumber)}),h.addEventListener("keydown",b=>{let C=b;(C.key==="Enter"||C.key===" ")&&(b.preventDefault(),b.stopPropagation(),this.promptSceneImageReplace(c.sceneNumber))})),p.forEach(b=>{b.addEventListener("click",C=>{C.stopPropagation(),C.preventDefault(),this.openFocusEditorForScene(c,o)}),b.addEventListener("keydown",C=>{let E=C;(E.key==="Enter"||E.key===" ")&&(C.preventDefault(),C.stopPropagation(),this.openFocusEditorForScene(c,o))})}),g&&(g.addEventListener("click",b=>{b.stopPropagation();let C=o.querySelector(".timeline-thumbnail"),E=C.querySelector("img");if(C&&E)if(C.classList.toggle("preview-active"),C.classList.contains("preview-active")){let w=C,k=parseFloat(w.dataset.zoomLevel||"1.8"),I=parseFloat(w.dataset.translateX||"0"),L=parseFloat(w.dataset.translateY||"0");E.style.transform=`scale(${k}) translate(${I/k}px, ${L/k}px)`,g.textContent="Show Focus Area",g.title="Show focus area bounds"}else E.style.transform="",g.textContent="Hide Focus Area",g.title="Toggle focus area view"}),g.addEventListener("keydown",b=>{let C=b;(C.key==="Enter"||C.key===" ")&&(b.preventDefault(),b.stopPropagation(),g.click())})),o.querySelectorAll(".timeline-text-display").forEach(b=>{let C=b.closest(".timeline-field-group");C&&C.addEventListener("click",w=>{w.stopPropagation()}),b.addEventListener("click",w=>{w.stopPropagation();let k=b.contentEditable==="true";document.querySelectorAll('.timeline-text-display[contenteditable="true"]').forEach(I=>{I!==b&&(I.contentEditable="false",I.setAttribute("aria-readonly","true"))}),b.contentEditable="true",b.setAttribute("aria-readonly","false"),k||setTimeout(()=>{b.focus();let I=document.createRange(),L=window.getSelection();L&&b.firstChild&&(I.setStart(b.firstChild,b.textContent?.length||0),I.collapse(!0),L.removeAllRanges(),L.addRange(I))},0)}),b.addEventListener("blur",()=>{b.contentEditable="false",b.setAttribute("aria-readonly","true");let w=b.closest(".timeline-card");if(w){let k=w.getAttribute("data-scene-number");if(k){let I=parseInt(k,10),L=b.getAttribute("data-field")||"",F=b.textContent||"",R=this.scenes.find(M=>M.sceneNumber===I);if(R){if(L==="title")R.sceneTitle=F;else if(L==="voiceover")R.voiceover=F;else if(L==="callout")R.callout=F;else if(L==="endingPosition"){let M=F.match(/^(.*?)\s*\[\(\s*([^)]*?)\s*\),\s*(.+?)\s*\]$/);if(M&&M.length>=Qo){R.endingPosition={focus:M[1]?.trim()||"",coordinates:M[2]?.trim()||"",dimensions:M[3]?.trim()||""};let A=d.querySelector(".timeline-thumbnail"),_=A?.querySelector("img");if(A&&_){let O=en(R.endingPosition);this.applyFocalPointVisualization(A,_,O)}}else R.endingPosition={focus:F.trim(),coordinates:"",dimensions:""}}this.saveScenes()}}}}),b.addEventListener("keydown",w=>{let k=w,I=b;if(k.key==="Enter"&&I.contentEditable!=="true"){w.preventDefault(),w.stopPropagation(),I.click();return}if(k.key==="Enter"&&I.contentEditable==="true"&&!k.shiftKey){w.preventDefault(),I.blur();return}if(k.key==="Escape"&&I.contentEditable==="true"){w.preventDefault(),w.stopPropagation();let L=b.getAttribute("data-field")||"",F=b.closest(".timeline-card");if(F){let R=F.getAttribute("data-scene-number");if(R){let M=parseInt(R,10),A=this.scenes.find(_=>_.sceneNumber===M);if(A){if(L==="voiceover")b.textContent=A.voiceover;else if(L==="callout")b.textContent=A.callout;else if(L==="endingPosition"){let _=A.endingPosition?this.formatEndingPosition(A.endingPosition):"N/A";b.textContent=_}}}}I.contentEditable="false",b.setAttribute("aria-readonly","true"),I.focus();return}w.stopPropagation()}),b.setAttribute("tabindex","0"),b.setAttribute("role","textbox");let E=b.closest(".timeline-field-group")?.querySelector(".timeline-field-label")?.textContent||"field";b.setAttribute("aria-label",`${E} (Click or press Enter to edit)`),b.setAttribute("aria-readonly","true")}),d.addEventListener("click",b=>{let C=b.target;if(d.querySelector('.timeline-text-display[contenteditable="true"]')!==null||C.classList.contains("focal-point-toggle")||C.classList.contains("focal-point-edit")||C.closest(".timeline-actions")||C.isContentEditable||C.classList.contains("timeline-text-display")||C.closest(".timeline-field-group")||C.closest(".focal-point-overlay")||C.closest(".focal-point-editor-container")||C.tagName==="IMG"||C.closest(".resize-handle")||!(C.classList.contains("timeline-card")||C.classList.contains("timeline-scene-number")||C.classList.contains("timeline-title-container")||C.classList.contains("timeline-title-display")&&!C.isContentEditable))return;document.querySelectorAll(".timeline-card").forEach(I=>
2000{if(I!==d){let L=I.classList.contains("expanded");if(I.classList.remove("expanded"),I.classList.add("collapsed"),I.setAttribute("aria-expanded","false"),L){let F=I.querySelector(".timeline-thumbnail");if(F){F.classList.remove("preview-active"),F.querySelector(".focal-point-overlay")?.remove();let M=F.querySelector("img");M&&(M.style.transform="")}}}});let k=d.classList.contains("collapsed");if(d.classList.toggle("expanded"),d.classList.toggle("collapsed"),d.setAttribute("aria-expanded",k?"true":"false"),k){let I=parseInt(d.getAttribute("data-scene-number")||"0",10),L=this.scenes.find(F=>F.sceneNumber===I);if(L?.endingPosition){let F=d.querySelector(".timeline-thumbnail");if(F){let R=F.querySelector("img");if(!R&&L.screenshot){let M=be.find(A=>A.file.name===L.screenshot);if(M){let A=M,_;A.cachedUrl?_=A.cachedUrl:(_=URL.createObjectURL(A.file),A.cachedUrl=_),R=document.createElement("img"),R.src=_,R.alt=`Scene ${L.sceneNumber} thumbnail`,F.appendChild(R)}}if(R&&L.endingPosition){let M=en(L.endingPosition);M.isValid&&this.applyFocalPointVisualization(F,R,M)}}}}})}s.push(d),r.delete(i)}),r.forEach(c=>c.remove()),s.forEach(c=>this.scrollContainer.appendChild(c)),this.saveScenes(),e?this.scrollContainer.style.marginTop="40px":this.scrollContainer.style.marginTop="0"}setScenes(e){this.scenes=e,this.render(),hn()}getScenes(){return this.scenes}toggleVisibility(){this.timelineArea&&this.timelineArea.classList.toggle("hidden")}initializeReplaceImageInput(){let e=document.createElement("input");e.type="file",e.accept=Zh(),e.style.display="none",e.setAttribute("aria-label","Replace scene image and regenerate scene content"),e.addEventListener("change",async()=>{let r=e.files?.[0],s=this.pendingReplaceSceneNumber;if(e.value="",this.pendingReplaceSceneNumber=null,!r||s===null)return;let c=this.scenes.find(f=>f.sceneNumber===s);if(!c){this.showNotification(`Could not find scene ${s} for image replacement.`,"error");return}await this.replaceSceneImageWithAI(c,r)}),document.body.appendChild(e),this.replaceSceneImageInput=e}promptSceneImageReplace(e){if(!this.replaceSceneImageInput){this.showNotification("Replace image control is not available.","error");return}this.pendingReplaceSceneNumber=e,this.replaceSceneImageInput.click()}syncFieldToScene(e,r,s){let c=r.textContent||"";if(s==="voiceover")e.voiceover=c;else if(s==="callout")e.callout=c;else if(s==="endingPosition"){let f=c.match(/^(.*?)\s*\[\(\s*([^)]*?)\s*\),\s*(.+?)\s*\]$/);f&&f.length>=Qo?e.endingPosition={focus:f[1].trim(),coordinates:`(${f[2].trim()})`,dimensions:f[3].trim()}:e.endingPosition={focus:c.trim(),coordinates:"",dimensions:""}}}syncSceneFieldsFromCard(e,r){let s=r.querySelector(".timeline-title-display");s&&(e.sceneTitle=s.textContent||e.sceneTitle),r.querySelectorAll("[data-field]").forEach(f=>{let i=f.getAttribute("data-field");i&&i!=="title"&&this.syncFieldToScene(e,f,i)})}ensureSceneDataIsCurrent(e){if(!this.timelineArea)return;let r=this.scenes.find(c=>c.sceneNumber===e);if(!r)return;let s=this.timelineArea.querySelector(`.timeline-card[data-scene-number="${e}"]`);s&&(this.syncSceneFieldsFromCard(r,s),this.saveScenes())}setupAccessibilityFeatures(){this.timelineArea&&(this.timelineArea.setAttribute("role","region"),this.timelineArea.setAttribute("aria-label","Storyboard timeline"))}initializeScrollContainer(){if(!this.timelineArea)return;this.scrollContainer=this.timelineArea.querySelector(".timeline-scroll-container"),this.scrollContainer||(this.scrollContainer=document.createElement("div"),this.scrollContainer.classList.add("timeline-scroll-container"),this.timelineArea.appendChild(this.scrollContainer)),this.scrollContainer.addEventListener("wheel",d=>{if(document.getElementById("main-app")?.classList.contains("player-visible"))return;let n=d.target;!(n.closest(".timeline-collapsible")||n.closest(".timeline-card.expanded")||n.closest(".timeline-text-display"))&&d.deltaY!==0&&(d.preventDefault(),this.scrollContainer.scrollLeft+=d.deltaY)},{passive:!1});let e=!1,r=0,s=0,c=d=>{if(document.getElementById("main-app")?.classList.contains("player-visible"))return;let n=d.target;n.closest(".timeline-text-display")||n.closest(".timeline-title-display")||n.matches('input[type="text"]')||n.matches("textarea")||n.c
2000ontentEditable==="true"||(e=!0,r=d.pageX-this.scrollContainer.offsetLeft,s=this.scrollContainer.scrollLeft,this.scrollContainer.style.cursor="grabbing",d.preventDefault())},f=d=>{if(!e)return;let o=(d.pageX-this.scrollContainer.offsetLeft-r)*2;this.scrollContainer.scrollLeft=s-o},i=()=>{e=!1,this.scrollContainer.style.cursor="grab"};this.scrollContainer.addEventListener("mousedown",c),this.scrollContainer.addEventListener("mousemove",f),this.scrollContainer.addEventListener("mouseup",i),this.scrollContainer.addEventListener("mouseleave",i)}applyFocalPointVisualization(e,r,s){if(e.querySelectorAll(".focal-point-overlay").forEach(m=>m.remove()),e.querySelectorAll(".focal-point-controls").forEach(m=>m.remove()),!s.isValid)return;if(!r.complete){r.addEventListener("load",()=>{this.applyFocalPointVisualization(e,r,s)},{once:!0});return}let i=document.createElement("div");i.classList.add("focal-point-overlay"),e.appendChild(i);let d=document.createElement("div");d.classList.add("focal-point-indicator"),i.appendChild(d);let o=e.closest(".timeline-card")?.querySelector(".focal-point-toggle"),a=()=>{let m=e.getBoundingClientRect(),y=m.width,b=m.height,C=y/b,E=r.naturalWidth/r.naturalHeight,w,k,I,L;E>C?(w=y,k=w/E,I=0,L=(b-k)/2):(k=b,w=k*E,I=(y-w)/2,L=0);let F=w/r.naturalWidth,R=k/r.naturalHeight,M=4,A=Math.round(s.x*F+I),_=Math.round(s.y*R+L),O=Math.max(M,Math.round(s.width*F)),D=Math.max(M,Math.round(s.height*R));d.style.left=`${A}px`,d.style.top=`${_}px`,d.style.width=`${O}px`,d.style.height=`${D}px`;let B=s.x+s.width/2,P=s.y+s.height/2,H=B/r.naturalWidth*100,W=P/r.naturalHeight*100;r.style.transformOrigin=`${H}% ${W}%`;let K=2.5,G=1.2,X=s.width/r.naturalWidth,Z=s.height/r.naturalHeight,Q=1/(Math.max(X,Z)*2),ie=Math.min(K,Math.max(G,Q));e.dataset.zoomLevel=ie.toString();let ae=A+O/2,oe=_+D/2,fe=y/2,he=b/2,xe=fe-ae,ke=he-oe;e.dataset.translateX=xe.toString(),e.dataset.translateY=ke.toString()};o&&(o.dataset.thumbnailContainer="true"),a(),e.classList.add("preview-active");let l=parseFloat(e.dataset.zoomLevel||"1.8"),u=parseFloat(e.dataset.translateX||"0"),h=parseFloat(e.dataset.translateY||"0");r.style.transform=`scale(${l}) translate(${u/l}px, ${h/l}px)`,o&&(o.textContent="Show Focus Area");let p=()=>{if(a(),e.classList.contains("preview-active")){let m=parseFloat(e.dataset.zoomLevel||"1.8"),y=parseFloat(e.dataset.translateX||"0"),b=parseFloat(e.dataset.translateY||"0");r.style.transform=`scale(${m}) translate(${y/m}px, ${b/m}px)`}};window.addEventListener("resize",p),e.dataset.resizeHandler="true";let g=new MutationObserver(m=>{m.forEach(y=>{y.type==="childList"&&y.removedNodes.length&&y.removedNodes.forEach(b=>{b===e&&e.dataset.resizeHandler&&(window.removeEventListener("resize",p),g.disconnect())})})});g.observe(e.parentElement||document.body,{childList:!0})}formatEndingPosition(e){let r=e.focus.replace(/\n/g," ").trim(),s=e.coordinates.replace(/\n/g," ").trim(),c=e.dimensions.replace(/\n/g," ").trim(),f=s.startsWith("(")&&s.endsWith(")")?s:`(${s})`;return`${r}  [${f}, ${c}]`}createEditableField(e,r,s,c){let f=document.createElement("div");f.classList.add("timeline-field-group");let i=document.createElement("div");i.classList.add("timeline-field-header"),i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let d=document.createElement("div");d.classList.add("timeline-field-label"),d.textContent=e,i.appendChild(d),c&&i.appendChild(c),f.appendChild(i);let n=document.createElement("div");return n.classList.add("timeline-text-display"),n.textContent=r,n.setAttribute("data-field",s),n.setAttribute("tabindex","0"),n.setAttribute("role","textbox"),n.setAttribute("aria-label",`${e} (Click to edit)`),n.setAttribute("aria-readonly","true"),f.appendChild(n),f.addEventListener("click",o=>{o.stopPropagation()}),n.addEventListener("click",o=>{o.stopPropagation();let a=n.contentEditable==="true";document.querySelectorAll('.timeline-text-display[contenteditable="true"]').forEach(l=>{l!==n&&(l.contentEditable="false",l.setAttribute("aria-readonly","true"))}),n.contentEditable="true",n.setAttribute("aria-readonly","false"),a||setTimeout(()=>{n.focus();
2000let l=document.createRange(),u=window.getSelection();u&&n.firstChild&&(l.setStart(n.firstChild,n.textContent?.length||0),l.collapse(!0),u.removeAllRanges(),u.addRange(l))},0)}),n.addEventListener("blur",()=>{n.contentEditable="false",n.setAttribute("aria-readonly","true");let o=n.closest(".timeline-card");if(o){let a=o.getAttribute("data-scene-number");if(a){let l=parseInt(a,10),u=n.getAttribute("data-field")||"",h=n.textContent||"",p=this.scenes.find(g=>g.sceneNumber===l);if(p){if(u==="title")p.sceneTitle=h;else if(u==="voiceover")p.voiceover=h;else if(u==="callout")p.callout=h;else if(u==="endingPosition"){let g=h.match(/^(.*?)\s*\[\(\s*([^)]*?)\s*\),\s*(.+?)\s*\]$/);if(g&&g.length>=Qo){let m=g[1]?g[1].trim():"",y=g[2]?g[2].trim():"",b=g[3]?g[3].trim():"";p.endingPosition={focus:m,coordinates:y,dimensions:b};let E=o.querySelector(".timeline-thumbnail"),w=E.querySelector("img");if(E&&w){let k=en(p.endingPosition);this.applyFocalPointVisualization(E,w,k)}}else p.endingPosition={focus:h.trim(),coordinates:"",dimensions:""}}this.saveScenes()}}}}),n.addEventListener("keydown",o=>{let a=o,l=n;if(a.key==="Enter"&&l.contentEditable!=="true"){o.preventDefault(),o.stopPropagation(),l.click();return}if(a.key==="Enter"&&l.contentEditable==="true"&&!a.shiftKey){o.preventDefault(),l.blur();return}if(a.key==="Escape"&&l.contentEditable==="true"){o.preventDefault(),o.stopPropagation(),l.contentEditable="false",n.setAttribute("aria-readonly","true"),l.focus();return}o.stopPropagation()}),f}createSceneCard(e,r,s,c){let f=document.createElement("div");f.classList.add("timeline-card"),c?f.classList.add("collapsed"):f.classList.add("expanded"),s&&f.classList.add("new-card"),f.setAttribute("data-scene-number",e.sceneNumber.toString()),f.setAttribute("tabindex","0"),f.setAttribute("role","article"),f.setAttribute("aria-label",`Scene ${e.sceneNumber}: ${e.sceneTitle}`),f.setAttribute("aria-expanded",c?"false":"true");let i=document.createElement("span");i.classList.add("sr-only"),i.textContent=c?"Press Enter to expand":"Press Enter to collapse",f.appendChild(i),f.addEventListener("click",w=>{w.target.closest(".timeline-thumbnail")||(c?this.focusedSceneIndex=this.focusedSceneIndex===r?null:r:this.focusedSceneIndex=r,this.render())}),f.addEventListener("keydown",w=>{let k=document.activeElement;k&&(k.classList.contains("refresh-scene-button")||k.classList.contains("scene-image-overlay-btn")||k.classList.contains("timeline-actions")||k.tagName==="BUTTON"&&k.closest(".timeline-actions")||k.classList.contains("timeline-text-display")||k.isContentEditable||k!==f)||(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),f.click())});let d=document.createElement("div");d.classList.add("timeline-scene-number"),d.textContent=e.sceneNumber.toString(),f.appendChild(d);let n=document.createElement("div");n.classList.add("timeline-thumbnail");let o=f.classList.contains("collapsed");if(!o||!c){let w=null;if(e.screenshot){w=document.createElement("img");let k=be.find(I=>I.file.name===e.screenshot);if(k){let I=k,L;I.cachedUrl?L=I.cachedUrl:(L=URL.createObjectURL(I.file),I.cachedUrl=L),w.src=L,w.alt=`Scene ${e.sceneNumber} thumbnail`,n.appendChild(w)}}if(w){let k=document.createElement("div");k.classList.add("scene-image-overlay");let I=document.createElement("button");I.classList.add("scene-image-overlay-btn","scene-image-overlay-btn--replace"),I.innerHTML="<span>Replace image and regenerate scene</span>",I.title="Replace scene image and regenerate the scene title, voiceover, callout, and focus area",I.setAttribute("aria-label",`Replace image and regenerate title, voiceover, callout, and focus for scene ${e.sceneNumber}`),I.addEventListener("click",F=>{F.stopPropagation(),F.preventDefault(),this.promptSceneImageReplace(e.sceneNumber)});let L=document.createElement("div");if(L.classList.add("scene-image-drop-hint"),L.innerHTML='<i class="fas fa-cloud-upload-alt" aria-hidden="true"></i><span>Drop image to replace and regenerate scene</span>',L.setAttribute("role","status"),k.appendChild(I),k.appendChild(L),n.appendChild(k),this.attachSceneImageDropHandlers(n,e),e.endingPosition&&!o){let F=en(e.endingPosition);
2000F.isValid&&(w.onload=()=>{this.applyFocalPointVisualization(n,w,F)},w.complete&&this.applyFocalPointVisualization(n,w,F))}}}f.appendChild(n);let a=document.createElement("div");a.classList.add("timeline-title-container");let l=document.createElement("div");l.classList.add("timeline-title-display"),l.textContent=e.sceneTitle,l.setAttribute("data-field","title"),l.addEventListener("click",w=>{w.stopPropagation();let k=l.contentEditable==="true";document.querySelectorAll('.timeline-text-display[contenteditable="true"], .timeline-title-display[contenteditable="true"]').forEach(I=>{I!==l&&(I.contentEditable="false",I.setAttribute("aria-readonly","true"))}),(!c||f.classList.contains("expanded"))&&(l.contentEditable="true",l.setAttribute("aria-readonly","false"),k||setTimeout(()=>{l.focus();let I=document.createRange(),L=window.getSelection();L&&l.firstChild&&(I.setStart(l.firstChild,l.textContent?.length||0),I.collapse(!0),L.removeAllRanges(),L.addRange(I))},0))}),l.addEventListener("keydown",w=>{let k=w,I=l;if(k.key==="Enter"&&I.contentEditable!=="true"){w.preventDefault(),w.stopPropagation(),I.click();return}if(k.key==="Enter"&&I.contentEditable==="true"){w.preventDefault(),l.blur();return}if(k.key==="Escape"&&I.contentEditable==="true"){w.preventDefault(),w.stopPropagation(),l.textContent=e.sceneTitle,l.contentEditable="false",l.setAttribute("aria-readonly","true"),l.focus();return}w.stopPropagation()}),l.addEventListener("blur",()=>{let w=l.contentEditable==="true";if(l.contentEditable="false",l.setAttribute("aria-readonly","true"),w){let k=l.textContent||e.sceneTitle;k!==e.sceneTitle&&(e.sceneTitle=k,this.saveScenes())}}),l.setAttribute("tabindex","0"),l.setAttribute("role","textbox"),l.setAttribute("aria-label","Scene title (Click or press Enter to edit)"),l.setAttribute("aria-readonly","true"),a.appendChild(l),f.appendChild(a);let u=document.createElement("div");u.classList.add("timeline-collapsible");let h=document.createElement("div");h.classList.add("timeline-card-body");let p=document.createElement("button");p.textContent="AI Rewrite",p.title="Regenerate voiceover script",p.classList.add("refresh-scene-button"),p.addEventListener("click",async w=>{w.stopPropagation();let k=this.scenes.find(I=>I.sceneNumber===e.sceneNumber);k&&await this.refreshSceneWithAI(k)}),p.addEventListener("keydown",async w=>{if(w.key==="Enter"||w.key===" "){w.preventDefault(),w.stopPropagation();let k=this.scenes.find(I=>I.sceneNumber===e.sceneNumber);k&&await this.refreshSceneWithAI(k)}}),h.appendChild(this.createEditableField("Voiceover Script",e.voiceover,"voiceover",p)),h.appendChild(this.createEditableField("Callout Text",e.callout,"callout"));let g=null;e.endingPosition&&(g=document.createElement("button"),g.textContent="Show Focus Area",g.title="Toggle focus area view",g.classList.add("focal-point-toggle"),g.addEventListener("click",w=>{w.stopPropagation();let k=f.querySelector(".timeline-thumbnail"),I=k?.querySelector("img");if(k&&I)if(k.classList.toggle("preview-active"),k.classList.contains("preview-active")){let L=parseFloat(k.dataset.zoomLevel||"1.8"),F=parseFloat(k.dataset.translateX||"0"),R=parseFloat(k.dataset.translateY||"0");I.style.transform=`scale(${L}) translate(${F/L}px, ${R/L}px)`,g.textContent="Show Focus Area",g.title="Show focus area bounds"}else I.style.transform="",g.textContent="Hide Focus Area",g.title="Toggle focus area view"}),g.addEventListener("keydown",w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),g.click())}));let m=e.endingPosition?this.formatEndingPosition(e.endingPosition):"N/A";h.appendChild(g?this.createEditableField("Scene Focus Area",m,"endingPosition",g):this.createEditableField("Scene Focus Area",m,"endingPosition")),u.appendChild(h),f.appendChild(u);let y=document.createElement("div");y.classList.add("timeline-card-footer");let b=document.createElement("div");b.classList.add("timeline-actions-left");let C=document.createElement("button");C.innerHTML='<i class="fas fa-trash"></i>',C.title="Delete scene",C.addEventListener("click",w=>{w.stopPropagation(),confirm("Are you sure you want to delete this scene?")&&this.deleteScene(e.sceneNumber)}),C.addEventListener("keydown",w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),confirm("Are you sure you want to delete this scene?")&&this.deleteScene(e.sceneNumber))}),b.appendChild(C);let E=document.createElement("div");if(E.classList.add("timeline-actions"),e.endingPosition){let w=document.createElement("button");w.innerHTML='<i class="fas fa-bullseye"></i> Edit Focus Area',w.title="Edit Focus Area",w.classList.add("edit-focal-point-button"),w.addEventListener("click",k=>{k.stopPropagation(),k.preventDefault(),this.openFocusEditorForScene(e,f)}),w.addEventListener("keydown",k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),k.stopPropagation(),this.openFocusEditorForScene(e,f))}),E.appendChild(w)}return y.appendChild(b),y.appendChild(E),f.appendChild(y),f}updateSceneCardOnly(e){let r=document.querySelector(`.timeline-card[data-scene-number="${e.sceneNumber}"]`);if(!r)return;let s=document.getElementById("main-app")?.classList.contains("player-visible")??!1,c=this.scenes.findIndex(i=>i.sceneNumber===e.sceneNumber),f=r.classList.contains("expanded");c!==-1&&(s&&f&&(this.focusedSceneIndex=c),this.updateSceneCard(r,e,c,s),s&&f&&(r.classList.remove("collapsed"),r.classList.add("expanded"),r.setAttribute("aria-expanded","true")))}updateSceneCard(e,r,s,c){let f=e.classList.contains("collapsed");c?this.focusedSceneIndex===s?(e.classList.remove("collapsed"),e.classList.add("expanded")):(e.classList.add("collapsed"),e.classList.remove("expanded")):(e.classList.remove("collapsed"),e.classList.add("expanded"));let i=e.classList.contains("collapsed"),d=f!==i,n=e.querySelector(".timeline-scene-number");n&&(n.textContent=r.sceneNumber.toString());let o=e.querySelector(".timeline-title-display");if(o&&!o.isContentEditable&&o.textContent!==r.sceneTitle&&(o.textContent=r.sceneTitle),r.screenshot&&!i){let g=e.querySelector(".timeline-thumbnail");if(g){let m=g.querySelector("img"),y=be.find(b=>b.file.name===r.screenshot);if(y){let b=y,C;if(b.cachedUrl?C=b.cachedUrl:(C=URL.createObjectURL(b.file),b.cachedUrl=C),m||(m=document.createElement("img"),m.alt=`Scene ${r.sceneNumber} thumbnail`,g.appendChild(m)),m.src!==C&&(m.src=C),i&&!f&&(g.classList.remove("preview-active"),m.style.transform="",g.querySelectorAll(".focal-point-overlay").forEach(w=>w.remove())),!i&&r.endingPosition){let E=en(r.endingPosition);(d||m.complete)&&(g.querySelectorAll(".focal-point-overlay").forEach(k=>
2000k.remove()),E.isValid&&(m.complete?this.applyFocalPointVisualization(g,m,E):m.onload=()=>{g.querySelectorAll(".focal-point-overlay").forEach(I=>I.remove()),this.applyFocalPointVisualization(g,m,E)}))}else g.querySelectorAll(".focal-point-overlay").forEach(w=>w.remove()),g.classList.remove("preview-active"),m&&(m.style.transform="")}else console.warn(`Scene ${r.sceneNumber} references unavailable screenshot: ${r.screenshot}`),g.classList.remove("preview-active"),g.querySelectorAll(".focal-point-overlay").forEach(E=>E.remove()),g.querySelector("img")?.remove()}}let a=Array.from(e.querySelectorAll(".timeline-text-display")),l=a.find(g=>g.getAttribute("data-field")==="voiceover"),u=a.find(g=>g.getAttribute("data-field")==="callout"),h=a.find(g=>g.getAttribute("data-field")==="endingPosition");l&&!l.isContentEditable&&l.textContent!==r.voiceover&&(l.textContent=r.voiceover),u&&!u.isContentEditable&&u.textContent!==r.callout&&(u.textContent=r.callout);let p=r.endingPosition?this.formatEndingPosition(r.endingPosition):"N/A";h&&!h.isContentEditable&&h.textContent!==p&&(h.textContent=p)}async refreshSceneWithAI(e){this.ensureSceneDataIsCurrent(e.sceneNumber);let r=e._fromFocalPointEditor===!0;r&&console.log("refreshSceneWithAI called from focal point editor with scene:",e);let s=document.querySelector(`.timeline-card[data-scene-number="${e.sceneNumber}"]`);if(!s)return;s.classList.add("updating");let c=s.querySelector(".refresh-scene-button");c&&(c.disabled=!0,c.textContent="Generating...");try{await Rt();let i=Array.from(s.querySelectorAll(".timeline-text-display")).find(l=>l.getAttribute("data-field")==="voiceover");if(i?.textContent&&i.textContent!==e.voiceover){e.voiceover=i.textContent;let l=this.scenes.findIndex(u=>u.sceneNumber===e.sceneNumber);l!==-1&&(this.scenes[l]=e,this.saveScenes()),this.showNotification(`Refreshing voiceover for scene ${e.sceneNumber} with your latest edits...`,"success")}else this.showNotification(`Refreshing voiceover for scene ${e.sceneNumber}...`,"info");
2000let d=await this.getSceneOcrContext(e),o=`${Jo.buildRefinementPrompt(e.voiceover,d,e.endingPosition,e.sceneTitle)}
2001
2002CRITICAL INSTRUCTIONS:
2003- Respond with ONLY a single valid JSON object containing EXACTLY these two fields: sceneNumber and voiceover
2004- DO NOT include endingPosition, coordinates, dimensions, focus, callout, screenshot, or any other fields
2005- Do not include any markdown formatting, code blocks, or explanatory text
2006
2007Your response must be a single valid JSON object with ONLY these two fields (no other fields allowed):
2008{
2009  "sceneNumber": ${e.sceneNumber},
2010  "voiceover": "Your refined voiceover script here"
2011}
2012
2013IMPORTANT: Do not include endingPosition, focus, coordinates, dimensions, callout, or any other fields in your response. Only sceneNumber and voiceover.`,a=await this.requestSceneFromAI(e,o,"voiceover-only");if(a){a.sceneNumber=e.sceneNumber,a.screenshot=e.screenshot;let l=e.endingPosition;if(!(a.voiceover!==e.voiceover))console.warn("AI returned the same voiceover script"),this.showNotification("The AI did not change the voiceover script. Please try again with more specific instructions.","info");else{e.voiceover=a.voiceover,e.endingPosition=l;let h=this.scenes.findIndex(p=>p.sceneNumber===e.sceneNumber);h!==-1&&(this.scenes[h]=e,this.saveScenes(),this.updateSceneCardOnly(e),r?this.showNotification(`Voiceover for scene ${e.sceneNumber} has been updated with focus on the selected area`,"success"):this.showNotification(`Voiceover for scene ${e.sceneNumber} has been updated`,"success"))}}else throw new Error("Could not parse a valid scene from the AI response")}catch(f){console.error("Error refining scene:",f),this.showNotification(`Error refining scene: ${f instanceof Error?f.message:String(f)}`,"error")}finally{if(await Et(),s){s.classList.remove("updating");let f=s.querySelector(".refresh-scene-button");f&&(f.removeAttribute("disabled"),f.textContent="AI Rewrite")}}}async replaceSceneImageWithAI(e,r){this.ensureSceneDataIsCurrent(e.sceneNumber);let s=document.querySelector(`.timeline-card[data-scene-number="${e.sceneNumber}"]`);if(!s||s.classList.contains("updating"))return;let c=e.screenshot;s.classList.add("updating");let f=s.querySelector(".scene-image-overlay");f&&(f.style.display="none");let i=null;try{await Rt(),this.showNotification(`Replacing image and regenerating title, voiceover, callout, and focus for scene ${e.sceneNumber}...`,"info");let d=c?this.scenes.filter(u=>u.screenshot===c).length:0;i=await Xh(r,{allowTransientMediaOverflow:d===1}),e.screenshot=i,this.updateSceneCardOnly(e);
2013let n=await this.getSceneOcrContext(e),o=this.buildFullSceneRegenerationPrompt(e,n),a=await this.requestSceneFromAI(e,o,"full-scene");if(!a)throw new Error("Could not parse a valid regenerated scene from the AI response");e.sceneTitle=a.sceneTitle,e.voiceover=a.voiceover,e.callout=a.callout,e.endingPosition=a.endingPosition;let l=this.scenes.findIndex(u=>u.sceneNumber===e.sceneNumber);l!==-1&&(this.scenes[l]=e,this.saveScenes(),this.updateSceneCardOnly(e)),await this.reconcileOrphanedImageAfterReplace(c,i),this.showNotification(`Scene ${e.sceneNumber} image replaced; title, voiceover, callout, and focus were regenerated.`,"success")}catch(d){console.error("Error replacing scene image:",d),this.showNotification(`Error replacing image and regenerating scene content: ${d instanceof Error?d.message:String(d)}`,"error"),e.screenshot=c,this.updateSceneCardOnly(e),i&&i!==c&&await this.reconcileOrphanedImageAfterReplace(i,c??"")}finally{await Et(),s.classList.remove("updating"),f&&(f.style.display="")}}async regenerateSceneForFocalPointChange(e){this.ensureSceneDataIsCurrent(e.sceneNumber);let r=document.querySelector(`.timeline-card[data-scene-number="${e.sceneNumber}"]`);if(!r||r.classList.contains("updating"))return;r.classList.add("updating");let s={sceneTitle:e.sceneTitle,voiceover:e.voiceover,callout:e.callout};try{await Rt(),this.showNotification(`Refreshing scene ${e.sceneNumber} for the new focus area...`,"info");
2013let c=await this.getSceneOcrContext(e),f=this.buildFocalPointRegenerationPrompt(e,c),i=await this.requestSceneFromAI(e,f,"narrative-fields");if(!i)throw new Error("Could not parse a valid regenerated scene from the AI response");e.sceneTitle=i.sceneTitle,e.voiceover=i.voiceover,e.callout=i.callout;let d=this.scenes.findIndex(n=>n.sceneNumber===e.sceneNumber);d!==-1&&(this.scenes[d]=e,this.saveScenes(),this.updateSceneCardOnly(e)),this.showNotification(`Scene ${e.sceneNumber} updated for the new focus area.`,"success")}catch(c){console.error("Error regenerating scene after focal point change:",c),this.showNotification(`Error refreshing scene: ${c instanceof Error?c.message:String(c)}`,"error"),e.sceneTitle=s.sceneTitle,e.voiceover=s.voiceover,e.callout=s.callout,this.updateSceneCardOnly(e)}finally{await Et(),r.classList.remove("updating")}}openFocusEditorForScene(e,r){let s=r.querySelector("img")?.src;if(!s)return;let c=this.scenes.findIndex(f=>f.sceneNumber===e.sceneNumber);c!==-1?this.openImagePreview(s,`Scene ${e.sceneNumber} - Edit Focus Area`,c):this.openImagePreview(s,`Scene ${e.sceneNumber} - Edit Focus Area`)}attachSceneImageDropHandlers(e,r){let s="timeline-thumbnail--drop-active",c=0,f=()=>{c=0,e.classList.remove(s)},i=d=>{let n=d.dataTransfer?.types;if(!n)return!1;for(let o of n)if(o==="Files")return!0;return!1};e.addEventListener("dragenter",d=>{i(d)&&(d.preventDefault(),d.stopPropagation(),c++,e.classList.add(s))}),e.addEventListener("dragover",d=>{i(d)&&(d.preventDefault(),d.stopPropagation(),d.dataTransfer&&(d.dataTransfer.dropEffect="copy"),e.classList.add(s))}),e.addEventListener("dragleave",d=>{i(d)&&(d.preventDefault(),d.stopPropagation(),c=Math.max(0,c-1),c===0&&e.classList.remove(s))}),e.addEventListener("drop",async d=>{if(!i(d))return;d.preventDefault(),d.stopPropagation(),f();let n=d.dataTransfer?.files;if(!n||n.length===0)return;let o=n[0];if(o){if(n.length>1&&this.showNotification("Only the first dropped file is used to replace the image and regenerate this scene.","info"),!gi(o)||!St(o.name)){this.showNotification(`Unsupported file type: ${o.name}. Drop an image file to replace and regenerate the scene.`,"error");return}await this.replaceSceneImageWithAI(r,o)}})}reconcileOrphanedImageAfterReplace(e,r){return Vf(e,r,{imageStore:Ie,removeMediaItem:Qh,getOcrKey:Bi,isStillReferenced:s=>this.scenes.some(c=>c.screenshot===s),metrics:El})}async getSceneOcrContext(e){if(!e.screenshot)return"";try{return await Ei(e.screenshot)}catch(r){return console.error(`OCR processing failed for scene ${e.sceneNumber}:`,r),""}}buildStoryboardSystemMessage(e,r){let s=localStorage.getItem(`bot${bt}-system-message`);if((s===null||s==="")&&(s=tt[bt]?.getHistoryForStorage()[0]?.content||""),r==="full-scene"||r==="narrative-fields")return s;let c=e.endingPosition?.coordinates||"",f=e.endingPosition?.dimensions||"";return!c&&!f?s:`${s}
2014
2015IMPORTANT FOCAL POINT INSTRUCTIONS: When a user provides specific focal point coordinates and dimensions, you MUST use those exact values in your response. For the current request, you MUST use coordinates: "${c}" and dimensions: "${f}" in your response.`}async requestSceneFromAI(e,r,s){let c=kt.createCopyFromHistoryArray([{role:"system",content:this.buildStoryboardSystemMessage(e,s)}]);c.addMessage({role:"user",content:s==="full-scene"||s==="narrative-fields"?this.buildUserContentForScene(e,r):r});let f=await c.getHistoryForChatGPT(),i=await this.readStreamedResponse(f),d=this.sanitizeResponseText(i);return this.tryParseSceneFromResponse(d,e.sceneNumber,s,e.screenshot)}buildUserContentForScene(e,r){let s=e.screenshot;return!s||!St(s)?r:[{type:"image_url",image_url:{url:""},filePath:s,fileType:this.resolveSceneImageFileType(s)},{type:"text",text:r}]}resolveSceneImageFileType(e){let r=be.find(c=>c.file.name===e);if(r?.file.type)return r.file.type;let s=e.toLowerCase();return s.endsWith(".png")?"image/png":s.endsWith(".jpg")||s.endsWith(".jpeg")?"image/jpeg":s.endsWith(".gif")?"image/gif":s.endsWith(".webp")?"image/webp":s.endsWith(".bmp")?"image/bmp":"image/png"}async readStreamedResponse(e){let r=document.getElementById(`bot${bt}-temp`),s=document.getElementById(`bot${bt}-top-p`),c=r?parseFloat(r.value):t.DEFAULT_TEMPERATURE,f=s?parseFloat(s.value):t.DEFAULT_TOP_P,i=await nr(f,c,e),d=new TextDecoder,n="";for(;;){let{done:o,value:a}=await i.read();if(o)break;n+=d.decode(a,{stream:!0})}return n}sanitizeResponseText(e){let r=e.trim();return r=r.replace(/^[\uFEFF\u200B\u200C\u200D\uFFFE\u202A-\u202E]/g,""),r.startsWith("```json")?r=r.substring(7):r.startsWith("```")&&(r=r.substring(3)),r.endsWith("```")&&(r=r.substring(0,r.length-3)),r.trim()}tryParseSceneFromResponse(e,r,s,c){try{let i=JSON.parse(e);if(this.isValidScene(i,r,s,c))return i}catch{}let f=this.extractJsonObjects(e);for(let i of f)try{let d=JSON.parse(i);if(this.isValidScene(d,r,s,c))return d}catch{}if(s==="voiceover-only"){let i=this.manuallyExtractScene(e,r);if(i&&this.isValidScene(i,r,"voiceover-only"))return i}return null}buildFullSceneRegenerationPrompt(e,r){let s={sceneNumber:e.sceneNumber,sceneTitle:e.sceneTitle,voiceover:e.voiceover,callout:e.callout,screenshot:e.screenshot};return`A user replaced the screenshot for scene ${e.sceneNumber}.
2016Analyze the new image and regenerate the full scene from that image.
2017The previous scene context is for continuity only. Do not preserve the old sceneTitle, voiceover, callout, or endingPosition unless the new image genuinely shows the same content.
2018Use OCR coordinates for endingPosition when text elements are relevant.
2019
2020Previous scene context:
2021${JSON.stringify(s,null,2)}
2022
2023${r?`OCR context from the new screenshot:
2024${r}`:"No OCR text was detected for this screenshot."}
2025
2026Respond with ONLY one JSON object containing exactly these fields:
2027- sceneNumber (keep as ${e.sceneNumber})
2028- sceneTitle
2029- endingPosition: { focus, coordinates "(x,y)", dimensions "widthxheight" }
2030- voiceover
2031- callout
2032- screenshot (keep as "${e.screenshot}")`}buildFocalPointRegenerationPrompt(e,r){let s={sceneNumber:e.sceneNumber,sceneTitle:e.sceneTitle,voiceover:e.voiceover,callout:e.callout,screenshot:e.screenshot},c=e.endingPosition?.focus??"",f=e.endingPosition?.coordinates??"",i=e.endingPosition?.dimensions??"";return`A user updated the focus area on scene ${e.sceneNumber}.
2033The scene image itself is unchanged; only the focal rectangle moved.
2034Regenerate sceneTitle, voiceover, and callout so they describe what
2035the user is drawing attention to inside the new focal rectangle.
2036
2037New focus area: focus="${c}", coordinates="${f}", dimensions="${i}".
2038
2039Previous scene context:
2040${JSON.stringify(s,null,2)}
2041
2042${r?`OCR context from the screenshot:
2043${r}`:"No OCR text was detected for this screenshot."}
2044
2045Respond with ONLY one JSON object containing exactly these fields:
2046- sceneNumber (keep as ${e.sceneNumber})
2047- sceneTitle
2048- endingPosition: keep EXACTLY { focus: "${c}", coordinates: "${f}", dimensions: "${i}" }
2049- voiceover
2050- callout
2051- screenshot (keep as "${e.screenshot}")`}extractJsonObjects(e){let r=/\{(?:[^{}]|(?:\{(?:[^{}]|(?:\{[^{}]*\}))*\}))*\}/g,s=e.match(r);if(s&&s.length>0)return s;let c=[],f=0,i="",d=!1;for(let n of e)n==="{"?(f++,d?i+="{":(d=!0,i="{")):n==="}"?(f--,i+="}",f===0&&d&&(c.push(i),i="",d=!1)):d&&(i+=n);return c}manuallyExtractScene(e,r){try{let s={sceneNumber:r,sceneTitle:"",voiceover:"",callout:"",screenshot:""},c=e.match(/["']?voiceover["']?\s*:\s*["']([^"']+)["']/);return c?.[1]&&(s.voiceover=c[1]),s.voiceover?s:null}catch(s){return console.error("Error in manual extraction:",s),null}}isValidScene(e,r,s="voiceover-only",c){return Kf(e,r,s,c)}saveScenes(){localStorage.setItem("timelineScenes",JSON.stringify(this.scenes))}openImagePreview(e,r,s){let c=typeof s=="number",f=null,i=null;c&&typeof s=="number"&&this.scenes[s]&&(f=this.scenes[s],f&&(i=en(f.endingPosition))),console.log("Opening image preview for scene:",s,"with current focal point:",i);let d=document.getElementById("screenshot-preview-modal");if(d){let n=d.querySelector("img");n.src=e,n.alt=r;let o=d.querySelector(".modal-header h2");if(o)o.textContent=c?"Edit Focus Area":"Image Preview";else{console.warn("Modal header title not found, creating a new header");let l=d.querySelector(".modal-content");if(l){let u=document.createElement("div");u.className="modal-header";let h=document.createElement("h2");h.textContent=c?"Edit Focus Area":"Image Preview",u.appendChild(h);let p=document.createElement("button");p.className="close-modal",p.textContent="Close",p.addEventListener("click",()=>{d.style.display="none"}),u.appendChild(p),l.insertBefore(u,l.firstChild)}}let a=d.querySelector(".focal-point-editor-container");if(a)a.innerHTML="";else{console.warn("Focal point container not found in modal, creating a new one");let l=d.querySelector(".image-preview-container");if(l){let u=document.createElement("div");u.className="focal-point-editor-container",l.appendChild(u)}}}else{d=document.createElement("div"),d.id="screenshot-preview-modal",d.className="screenshot-modal";let n=document.createElement("div");n.className="modal-content";let o=document.createElement("div");o.className="modal-header";let a=document.createElement("h2");a.textContent=c?"Edit Focus Area":"Image Preview",o.appendChild(a);let l=document.createElement("button");l.className="close-modal",l.textContent="Close",l.addEventListener("click",()=>{d.style.display="none"}),o.appendChild(l),n.appendChild(o);let u=document.createElement("div");u.className="image-preview-container";let h=document.createElement("img");h.src=e,h.alt=r,u.appendChild(h);let p=document.createElement("div");p.className="focal-point-editor-container",u.appendChild(p),n.appendChild(u),d.appendChild(n),document.body.appendChild(d),console.log("Created new screenshot-preview-modal with header and image container")}c&&typeof s=="number"&&(console.log(`Setting up FocalPointEditor for scene ${s}`),new Vo(d,e,r,s,i,async(n,o,a,l,u)=>{console.log("FocalPointEditor callback triggered with:",{sceneIndex:s,x:o,y:a,width:l,height:u}),await this.updateSceneFocalPoint(n,o,a,l,u)})),d.style.display="block"}async updateSceneFocalPoint(e,r,s,c,f){console.log("updateSceneFocalPoint called with:",{sceneIndex:e,x:r,y:s,width:c,height:f});let i=this.scenes[e];if(!i){console.error(`Scene not found for index ${e}`);return}let d={focus:i.endingPosition?.focus||"custom",coordinates:`(${Math.round(r)},${Math.round(s)})`,dimensions:`${Math.round(c)}x${Math.round(f)}`};console.log("Updated scene.endingPosition:",d);let n={...i,endingPosition:d,_fromFocalPointEditor:!0};this.scenes[e]=n;let o=document.querySelector(`.timeline-card[data-scene-number="${i.sceneNumber}"]`);if(o){console.log(`Found scene card for scene number ${i.sceneNumber}`);let a=o.querySelector('[data-field="endingPosition"]');if(a){console.log(`Found endingPosition element, current value: ${a.textContent}`);let l=`${d.focus}  [${d.coordinates}, ${d.dimensions}]`;console.log(`Setting new value: ${l}`),a.textContent=l;let u=o.querySelector(".timeline-thumbnail"),h=u.querySelector("img");if(u&&h){console.log("Updating focal point visualization in thumbnail");let g=en(d),m=u.querySelector(".focal-point-overlay");m&&m.remove();let y=u.querySelector(".focal-point-toggle");y&&y.remove();let b=u.querySelector(".focal-point-edit");b&&b.remove(),h.style.transform="",u.classList.remove("preview-active"),this.applyFocalPointVisualization(u,h,g),setTimeout(()=>{let C=u.querySelector(".focal-point-toggle");C?.textContent==="Show Focus Area"?console.log("Focal point visualization is already in preview mode"):C&&(console.log("Clicking toggle to show preview"),C.click())},100)}let p=new Event("blur",{bubbles:!0});a.dispatchEvent(p),console.log("Dispatched blur event to save changes")}
2051else console.error("Could not find endingPosition element in scene card")}else console.error(`Could not find scene card for scene number ${i.sceneNumber}`);this.saveScenes(),console.log("Saved scenes to localStorage"),this.render(),console.log("Re-rendered timeline"),this.showNotification(`Updating scene ${i.sceneNumber} with new focal point...`,"info"),console.log("Starting AI refresh for scene with updated focal point"),await this.regenerateSceneForFocalPointChange(n)}async refreshSceneWithFocalPointFocus(e){if(console.log("Refreshing scene with focal point focus:",e),!e){console.error("Invalid scene provided to refreshSceneWithFocalPointFocus");return}let r=this.scenes.findIndex(c=>c.sceneNumber===e.sceneNumber);if(r===-1){console.error(`Could not find scene index for scene number ${e.sceneNumber}`);return}let s=document.querySelector(`.scene-card[data-scene-number="${e.sceneNumber}"]`);if(s){s.classList.add("loading");let c=s.querySelector(".refresh-scene-button");c&&(c.disabled=!0,c.textContent="Generating...")}try{let c="";try{c=await Ei(e.screenshot),console.log(`Retrieved OCR data for scene ${e.sceneNumber}`)}catch(a){console.warn(`Could not retrieve OCR data for scene ${e.sceneNumber}:`,a)}let f="";if(e.endingPosition){let{coordinates:a,dimensions:l}=e.endingPosition;f=`
2052Please focus specifically on the region at coordinates ${a} with dimensions ${l}. Generate content that describes what's visible in this specific area of the image.`}let i=`Please refine the following scene for a storyboard. The scene shows a screenshot with the title "${e.sceneTitle}".${f}
2053
2054Please generate a concise voiceover script and a short callout text that highlights the key elements visible in the focal point region. The content should be educational and informative, focusing on what the user should pay attention to in this specific area.
2055
2056Current scene data:
2057${JSON.stringify(e,null,2)}
2058
2059${c?`OCR Text Data:
2060${c}
2061
2062`:""}Please return the updated scene as a valid JSON object with the same structure, but with improved voiceover and callout text that focuses on the specified region.`;console.log("Sending message to AI:",i);let d=await fetch("/api/camtasia/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:i,context:"storyboard-scene-refinement",sceneNumber:e.sceneNumber})});if(!d.ok)throw new Error(`API request failed with status ${d.status}`);let n=await d.text();console.log("Received response from AI:",n);let o=this.extractJsonObjects(n);if(console.log(`Extracted ${o.length} JSON objects from response`),o.length===0){let a=this.manuallyExtractScene(n,e.sceneNumber);if(a){console.log("Manually extracted scene:",a);let l=e.endingPosition;Object.assign(e,a),e.endingPosition=l,s&&this.updateSceneCard(s,e,r,window.innerWidth<768),this.saveScenes(),console.log("Updated scene with manually extracted data")}else throw new Error("Could not extract scene data from AI response")}else try{let a=o[0];if(a){let l=JSON.parse(a);if(console.log("Parsed updated scene:",l),this.isValidScene(l,e.sceneNumber))l.screenshot=e.screenshot,l.endingPosition=e.endingPosition,Object.assign(e,l),s&&this.updateSceneCard(s,e,r,window.innerWidth<768),this.saveScenes(),console.log("Updated scene with AI-generated content");else throw new Error("Invalid scene data returned by AI")}else throw new Error("No valid JSON object found in response")}catch(a){throw console.error("Error parsing JSON:",a),new Error("Could not parse scene data from AI response")}}catch(c){let f=c instanceof Error?c.message:String(c);console.error("Error refreshing scene:",c),this.showNotification(`Error refreshing scene: ${f}`,"error")}finally{if(s){s.classList.remove("loading");let c=s.querySelector(".refresh-scene-button");c&&(c.disabled=!1,c.textContent="AI Rewrite")}}}async findOcrTextAndReprocessScene(e,r){if(!e.screenshot){console.error("No screenshot to process for scene",e.sceneNumber);return}try{let s=await this.getOcrTextForImage(e.screenshot);this.updateSceneWithNewFocalPoint(e,r,s)}catch(s){console.error("Error finding OCR text:",s),this.updateSceneWithNewFocalPoint(e,r)}}async getOcrTextForImage(e){return Promise.resolve("")}updateSceneWithNewFocalPoint(e,r,s=""){let c=document.querySelector(`.timeline-card[data-scene-number="${e.sceneNumber}"]`);if(!c)return;let f=c.querySelector(".timeline-thumbnail"),i=f?.querySelector("img");if(f&&i){let l=f.querySelector(".focal-point-overlay");l&&l.remove();let u=en(e.endingPosition);u.isValid&&this.applyFocalPointVisualization(f,i,u)}c.classList.add("updating"),setTimeout(()=>{c.classList.remove("updating")},1e3);let d=document.createElement("div");d.id="focal-point-notification",d.className="notification success visible";let n=document.createElement("span");n.textContent=`Scene ${e.sceneNumber} updated with new focal point. `,d.appendChild(n);let o=document.createElement("button");o.textContent="Refine with AI",o.className="notification-button",o.addEventListener("click",async()=>{d.remove(),this.showNotification(`Refining Scene ${e.sceneNumber} with AI...`,"info");let l=this.scenes.find(u=>u.sceneNumber===e.sceneNumber);l&&await this.refreshSceneWithAI(l)}),d.appendChild(o);let a=document.createElement("button");a.textContent="\xD7",a.className="notification-close",a.addEventListener("click",()=>{d.remove()}),d.appendChild(a),document.body.appendChild(d),setTimeout(()=>{document.body.contains(d)&&(d.classList.remove("visible"),setTimeout(()=>d.remove(),300))},8e3)}showNotification(e,r="info",s){yr(e,r,s)}deleteScene(e){this.scenes=this.scenes.filter(r=>
2062r.sceneNumber!==e),this.scenes.forEach((r,s)=>{r.sceneNumber=s+1}),this.saveScenes(),this.scrollContainer&&(this.scrollContainer.innerHTML=""),this.render(),hn()}};var Un=sr(qf()),q_=sr(Qf()),J_=sr(tp()),Q_=sr(rp()),eA=sr(op()),tA=sr(ap());var lp=window.__CAPTION_CONFIG__,h0=lp?.baseUrl?.trim(),f0=lp?.transcriptionConfigurationId?.trim(),Cl={captionServiceBaseUrl:h0??"",transcriptionConfigurationId:f0??"",vendorTrainingOptIn:!1},cp=()=>{if(!Cl.captionServiceBaseUrl||!Cl.transcriptionConfigurationId)throw new Error("Caption service configuration is missing. Ensure CaptionApiBaseUrl and TranscriptionConfigurationId are set.")},Dr=Cl;var p0=401,up=async t=>{let e=new Headers(t),r=await _n();return r&&e.set("Authorization",`Bearer ${r}`),e},dp=t=>{throw t.status===p0?new Error("Caption service request was unauthorized. Please log in again."):new Error(`HTTP ${t.status}: ${t.statusText}`)},g0={postFormWithAuthToken:async(t,e,r,s)=>{let c=await fetch(t,{method:"POST",body:e,headers:await up(r),signal:s});return c.ok||dp(c),await c.json()},getWithAuthToken:async(t,e,r)=>{let s=await fetch(t,{method:"GET",headers:await up(e),signal:r});return s.ok||dp(s),await s.json()}},ss=g0;var hp=async(t,e,r,s)=>{let c;for(let f=0;f<=s;f++)try{return await t()}catch(i){if(c=i,f<s&&await e()){r>0&&await new Promise(d=>setTimeout(d,r));continue}throw i}throw c};var as=new Error("User canceled operation");as.name="UserCanceledError";var m0={english:"en",englishUs:"en-US",englishUk:"en-GB",englishAu:"en-AU",spanish:"es",spanishEs:"es-ES",spanishAr:"es-AR",spanishCl:"es-CL",spanishCo:"es-CO",spanishMx:"es-MX",spanishPe:"es-PE",portuguese:"pt",portugueseBr:"pt-BR",dutch:"nl",dutchNl:"nl-NL",french:"fr",frenchFr:"fr-FR",german:"de",germanDe:"de-DE",italian:"it",italianIt:"it-IT"},v0=2e3,y0=1e3,b0=60,w0=10,x0=w0*b0*y0,fp="LumaChatTranscription",S0="application/json+per-word-raw",E0=3,C0=3,_0=t=>{let e=t.fileName.endsWith(".m4a")?t.fileName.replace(/\.m4a$/,".mp4"):t.fileName,r=new FormData;return r.append("AudioFile",t.audioFile,e),r.append("ConfigurationId",t.configurationId),r.append("Label",t.label),r.append("Language",t.language),r.append("VendorTrainingOptIn",String(t.vendorTrainingOptIn)),r},A0=t=>{let e=new Headers,r=`product=${t.product},productVersion=${t.productVersion},platform=${t.platform},platformVersion=${t.platformVersion}`;return e.set("TscProductInfo",r),e},T0=()=>({product:"TEST",productVersion:"0.0.1.1",platform:"OSX",platformVersion:"1.0.0.0",productLocale:"en-US"}),k0=async(t,e,r)=>{let s=`lumachat_${fp}_${crypto.randomUUID()}.m4a`,c={audioFile:t,fileName:s,productInfo:T0(),language:e,label:fp,vendorTrainingOptIn:Dr.vendorTrainingOptIn,configurationId:Dr.transcriptionConfigurationId},f=_0(c),i=A0(c.productInfo),d=await ss.postFormWithAuthToken(`${Dr.captionServiceBaseUrl}/api/v2/captionjob/fileimport`,f,i,r);if(typeof d?.id>"u")throw new Error(`Invalid response from caption service. Response: ${JSON.stringify(d)}`);return console.info(`File submitted to Caption Service for processing. CaptionJobId: ${d.id}`),d},M0=async(t,e)=>await ss.getWithAuthToken(`${Dr.captionServiceBaseUrl}/api/v2/${t}/status`,void 0,e),L0=async(t,e)=>{let r=new Headers;return r.set("accept",S0),await hp(async()=>ss.getWithAuthToken(`${Dr.captionServiceBaseUrl}/api/v2/${t}/file`,r,e),()=>Promise.resolve(!0),0,E0)},R0=(t,e)=>new Promise((r,s)=>{let c=0,f=setInterval(async()=>{try{if(e?.aborted){clearInterval(f),s(as);return}let i=await M0(t,e);if(i.status==="Completed"){clearInterval(f);try{r(await L0(t,e))}catch(d){s(d instanceof Error?d:new Error(String(d)))}return}else if(i.status==="Error"||i.status==="Deleted"){clearInterval(f),s(new Error(`Caption service job ${t} ended with status ${i.status}.`));return}c=0}catch(i){c++,c>=C0&&(clearInterval(f),s(new Error(`Exceeded maximum polling errors for caption service job, reason: ${i instanceof Error?i.message:String(i)}`)))}},v0);e?.addEventListener("abort",()=>{clearInterval(f),s(as)})}),I0=async(t,e,r=x0)=>{let s,c=new Promise((f,i)=>{s=setTimeout(()=>{i(new Error("Timed out while waiting for Caption Service results."))},r)});return await Promise.race([R0(t,e),c]).finally(()=>{clearTimeout(s)})},pp=async(t,e=m0.englishUs,r)=>{cp();let s=await k0(t,e,r);return await I0(s.id,r)};var ls=(t,e)=>{if(!Number.isFinite(t)||t<=0)throw new RangeError(`${e} must be a positive finite number.`)},gp=({cursorLocation:t,recordingRegion:e,mediaDimensions:r})=>{ls(e.width,"recordingRegion.width"),ls(e.height,"recordingRegion.height"),ls(r.width,"mediaDimensions.width"),ls(r.height,"mediaDimensions.height");let s=(t.x-e.x)/e.width,c=(t.y-e.y)/e.height;return{x:s*r.width,y:c*r.height}};var xn=0n,_i=BigInt(Do),O0=_i/BigInt(Ya),mp=0n,N0=6,yp=t=>{if(typeof t=="number")return Number.isFinite(t)?t:0;if(typeof t=="string"){let e=t.trim();if(!e.includes(":")){let c=Number(e);return Number.isFinite(c)?c:0}let r=60;return e.split(":").reduce((c,f)=>{let i=Number(f);return c*r+(Number.isFinite(i)?i:0)},0)}return 0},D0=t=>BigInt(Math.round(yp(t)*Number(_i))),bp=t=>typeof t=="string"?D0(t):BigInt(Math.round(yp(t)*Number(_i))),cs=t=>(Number(t)/Number(_i)).toFixed(N0),us=t=>Number(t)/Number(_i);var F0="trec-include-mouse-up-actions",P0=()=>localStorage.getItem(F0)==="true",B0=t=>t===1||t===4||t===16,H0=t=>
2062t===2||t===8||t===32,U0=t=>{switch(t){case 1:return"left-down";case 2:return"left-up";case 4:return"right-down";case 8:return"right-up";case 16:return"middle-down";case 32:return"middle-up";default:return"unknown"}},wp="test.m4a",W0=`/opfs/${wp}`,z0=async(t,e)=>{let r=W0,s=new ct.M4AExporterSettings,c=new ct.VSTLibrary,f=new ct.M4AExporter(t,r,s,c);try{return await new Promise((i,d)=>{let n=!1,o=a=>{n||(n=!0,a?d(a):i(r))};f.setErrorHandler(a=>{console.error("TREC2ScreencastDemo caught error during M4A export: ",a),o(new Error(a))}),f.setProgressHandler(a=>{try{e?.(a)}catch(l){o(l instanceof Error?l:new Error(String(l)));return}a>=100&&o()});try{f.start()}catch(a){o(a instanceof Error?a:new Error(String(a)))}})}finally{f.delete(),s.delete(),c.delete()}},vp="lastTrecTranscriptionError",ds=(t="")=>{if(t){localStorage.setItem(vp,t),console.error("TREC transcription error:",t);return}localStorage.removeItem(vp)};var j0=async(t,e)=>{await z0(t,e);let r=await we.readFile(wp,{encoding:"binary"});return r.length?(console.info(`TREC mic audio export ready: ${r.length} bytes`),new Blob([r],{type:"audio/mp4"})):(console.warn("Exported mic audio was empty. This TREC may not contain a microphone track."),null)},G0=async t=>{try{let e=await pp(t);return console.info(`TREC caption service returned ${e.words.length} word(s)`),e.words.length===0&&ds("Caption service returned no words. The mic track may be silent or unsupported."),e.words}catch(e){let r=e instanceof Error?e.message:String(e);return ds(r),console.error("Failed to transcribe mic audio via caption service: ",e),[]}},V0=async(t,e)=>{let r={scenes:[]};await we.addFileIfNeeded(t.name,t,!0);let s=e.createMedias(`/opfs/${t.name}`);for(let c=0;c<s.size();c++){let f=s.get(c),i=e.createNewTrack(),d=f.sceneMediaRole();(d===ct.SceneMediaRole.SCREEN||d===ct.SceneMediaRole.MICAUDIO||d===ct.SceneMediaRole.UNDEFINED)&&(i.addMediaAtTime(xn,f),d===ct.SceneMediaRole.SCREEN&&f.cursorOpacity().setValueAtTime(xn,0))}return r},xp=async(t,e,r,s,c)=>{let f=null,i=null,d=new ct.ProjectFrameGrabber,n=t.getCanvasWidth(),o=t.getCanvasHeight();try{t.setCanvasWidth(s),t.setCanvasHeight(c),await d.initWithProject(t,"",""),f=await d.frameAtTime(e,1);let a=f.getWidth(),l=f.getHeight(),u=f.uint8Array(),h=new ImageData(new Uint8ClampedArray(u),a,l);i=await createImageBitmap(h);let p=new OffscreenCanvas(a,l),g=p.getContext("2d");if(!g)throw new Error("Unable to create a 2D canvas context for the extracted TREC frame.");g.drawImage(i,0,0);let m=await p.convertToBlob({type:"image/png"});return new File([m],`scene-${r}.png`,{type:"image/png"})}finally{try{i?.close()}finally{try{f?.delete()}finally{try{d.delete()}finally{t.setCanvasWidth(n),t.setCanvasHeight(o)}}}}},K0=async(t,e,r)=>{let s=0,c=P0(),f=[];for(let n=0;n<t.numberOfTracks();n++){let o=t.trackAtIndex(n),a=null;if(o.hasMediaAtTime(xn)&&(a=o.mediaAtTime(xn).sceneMediaRole()),a===ct.SceneMediaRole.SCREEN){let l=o.mediaAtTime(xn),u=l.pointParam("cursorLocation"),h=l.intParam("cursorAction"),p=h.keyframeTimes(),g={x:0,y:0,width:l.getWidth(),height:l.getHeight()};try{let b=l.rectParam("recordingRegion").valueAtTime(xn),C={x:b.x(),y:b.y(),width:b.width(),height:b.height()};C.width>0&&C.height>0?g=C:console.warn("\u26A0 Recording region has invalid dimensions, using media dimensions instead.")}catch(y){console.warn("\u26A0 Recording region not available, assuming (0,0):",y)}let m=[];m.push(xn);for(let y=0;y<p.size();y++)m.push(p.get(y));for(let y of m){let b=h.valueAtTime(y);if(B0(b)||c&&H0(b)){let E=u.valueAtTime(y),w=gp({cursorLocation:E,recordingRegion:g,mediaDimensions:{width:l.getWidth(),height:l.getHeight()}}),k=await xp(t,y,s,l.getWidth(),l.getHeight());await we.doesFileExist(k.name)&&await we.deleteFile(k.name),await we.writeFile(k.name,await k.arrayBuffer().then(F=>new Uint8Array(F)));let I={imageFileName:k.name,image:k,cursorCoords:{x:w.x,y:w.y},imageSize:{x:l.getWidth(),y:l.getHeight()},frameTime:y,mediaTimeInS:us(y),interactionType:U0(b)};e.scenes.push(I),f.push(y);let L=s;s++,await r?.(I,L)}}}}let i=t.getDuration(),d=f.length-1;
2062return e.scenes.forEach((n,o)=>{n.sceneStartTime=o===0?xn:f[o-1]??xn,n.sceneEndTime=o===d?i:f[o]??i}),f[d]??null},Y0=async(t,e,r,s,c)=>{if(s===null||r.length===0||e.scenes.length===0)return;let f=e.scenes[e.scenes.length-1],i=t.getDuration(),d=i-O0,n=r.reduce((u,h)=>{let p=bp(h.end);return p>u?p:u},xn);if(d<=s){console.log(`===TREC_DIAG=== appendFinal BAILING: finalFrameTime(${d} / ${cs(d)}s) <= lastClickTime(${s} / ${cs(s)}s)`);return}if(n<=s){console.log(`===TREC_DIAG=== appendFinal BAILING: lastWordEndTime(${n} / ${cs(n)}s) <= lastClickTime(${s} / ${cs(s)}s)`);return}let o=e.scenes.length,a=f.imageSize;if(!a){console.warn("===TREC_DIAG=== appendFinal BAILING: previousLastScene.imageSize is null or undefined");return}let l=await xp(t,d,o,a.x,a.y);await we.doesFileExist(l.name)&&await we.deleteFile(l.name),await we.writeFile(l.name,await l.arrayBuffer().then(u=>new Uint8Array(u))),f.sceneEndTime=s,e.scenes.push({imageFileName:l.name,image:l,cursorCoords:null,imageSize:f.imageSize,frameTime:d,mediaTimeInS:us(d),sceneStartTime:s,sceneEndTime:i}),console.log(`Appended final scene ${o} at time ${d} covering [${s}, ${i})`),await c?.(e.scenes[e.scenes.length-1],e.scenes.length-1)},Sp=t=>`${t}.transcript`,Z0=async(t,e)=>{if(!t.imageFileName)return;let r={imageFileName:t.imageFileName,sceneNumber:e,cursorCoords:t.cursorCoords,imageSize:t.imageSize,transcript:t.transcript??"",mediaTimeInS:t.mediaTimeInS,interactionType:t.interactionType??"unknown"},s=new Blob([JSON.stringify(r)],{type:"application/json"});await Ie.storeTranscript(Sp(t.imageFileName),s)},Ep=async t=>{try{await Ie.init()}catch(s){return console.error("restoreTrecMetaData: IndexedDB unavailable, cannot restore transcript:",s),null}let e=[];for(let s of t)try{let c=await Ie.getTranscript(Sp(s));if(!c)continue;let f=JSON.parse(await c.text());e.push(f)}catch(c){console.error(`restoreTrecMetaData: failed to read transcript for ${s}:`,c)}return e.length===0?null:(e.sort((s,c)=>s.sceneNumber-c.sceneNumber),{scenes:e.map(s=>({imageFileName:s.imageFileName,image:null,cursorCoords:s.cursorCoords,imageSize:s.imageSize,transcript:s.transcript,mediaTimeInS:s.mediaTimeInS,interactionType:s.interactionType??"unknown"}))})},X0=async(t,e,r)=>{let s=t.scenes.map(()=>[]);for(let d of e){let n=bp(d.start),o=t.scenes.findIndex(a=>{let l=a.sceneStartTime??xn,u=a.sceneEndTime;return typeof u=="bigint"&&n>=l&&n<u});o!==-1&&(s[o]??[]).push(d.punctuated_text)}t.scenes.forEach((d,n)=>{let o=s[n]??[];d.transcript=o.join(" ").trim()});let c=t.scenes.map((d,n)=>({sceneNumber:n+1,imageFileName:d.imageFileName,sceneEndingCursorCoords:d.cursorCoords,imageSize:d.imageSize,sceneStartTimeSeconds:us(d.sceneStartTime??mp),sceneEndTimeSeconds:us(d.sceneEndTime??mp),mediaTimeInS:d.mediaTimeInS,transcript:d.transcript??"",interactionType:d.interactionType??"unknown"})),f=JSON.stringify(c,null,2),i=crypto.randomUUID();localStorage.setItem(`trec_transcript_${i}`,f),localStorage.setItem("lastTranscriptionGUID",i),localStorage.setItem(`trec_source_filename_${i}`,r);try{await Ie.init();for(let[d,n]of t.scenes.entries())await Z0(n,d+1)}catch(d){console.error("Failed to persist TREC transcript(s) to IndexedDB:",d)}},Cp=async(t,e={})=>{if(t.name.toLowerCase().endsWith("trec")){let{onScene:r,onStatus:s}=e,c=window.project;try{st.setRenderingEnabled(!1),s?.("preparing");let f=await V0(t,c);s?.("extracting-audio"),ds();let i=Promise.resolve([]);try{let o=await j0(c,a=>s?.("extracting-audio",{progress:a}));o&&(i=G0(o))}catch(o){let a=o instanceof Error?o.message:String(o);ds(a),console.error("Failed to export mic audio: ",o)}s?.("extracting-frames");let d=await K0(c,f,r),n=await i;return s?.("finalizing"),await Y0(c,f,n,d,r),f.sourceFileName=t.name,await X0(f,n,t.name),f}finally{st.setRenderingEnabled(!0)}}return Promise.resolve(null)};var q0=t=>t<=15?t:t<=40?15:5,J0=(t,e)=>{let r=new Set;if(t<=0||e<=0)return r;if(e>=t){for(let s=0;s<t;s++)r.add(s);return r}if(e===1)return r.add(0),r;for(let s=0;s<e;s++){let c=Math.round(s*(t-1)/(e-1));r.add(c)}return r},_p=t=>{let e=t.length;if(e===0)return[];let r=q0(e),s=J0(e,r);return t.map((c,f)=>({id:c,send:s.has(f)?"image":"text"}))};var Ap=(t,e,r)=>Math.min(Math.max(t,e),r),_l=(t,e)=>{if(!Number.isFinite(t)||t<=0)throw new RangeError(`${e} must be a positive finite number.`)},Q0=t=>!!t&&Number.isFinite(t.width)&&t.width>0&&Number.isFinite(t.height)&&t.height>0,Tp=(t,e,r,s)=>
2062{_l(s,"focusAreaDimension"),_l(r.width,"fallbackDimensions.width"),_l(r.height,"fallbackDimensions.height");let c=new Map(e.filter(i=>i.imageFileName).map(i=>[i.imageFileName,i])),f=s/2;return t.map(i=>{let d=c.get(i.screenshot);if(!d?.cursorCoords)return i;let n=Q0(d.imageSize)?d.imageSize:r,o=Math.max(0,n.width-s),a=Math.max(0,n.height-s),l=Ap(Math.round(d.cursorCoords.x-f),0,o),u=Ap(Math.round(d.cursorCoords.y-f),0,a);return{...i,endingPosition:{focus:"custom",coordinates:`(${l},${u})`,dimensions:`${s}x${s}`}}})};var kp=(t,e)=>{let r=new Map;for(let s of e.scenes)s.imageFileName&&typeof s.mediaTimeInS=="number"&&r.set(s.imageFileName,s.mediaTimeInS);return t.map(s=>{let c=r.get(s.screenshot);if(typeof c!="number")throw new Error(`No original media timestamp was found for storyboard scene ${s.sceneNumber}.`);return{sceneNumber:s.sceneNumber,sceneTitle:s.sceneTitle,...s.endingPosition?{endingPosition:s.endingPosition}:{},voiceover:s.voiceover,"potential-callout":s.callout,mediaTimeInS:c}})};var Mp=t=>`bot${t}-system-message`,Lp=t=>`bot${t}-chat-history`,Rp=(t,e)=>{t.removeItem(Mp(e)),t.removeItem(Lp(e))},Ip=(t,e,r)=>{let s=Mp(e);return t.getItem(s)===r?!1:(t.setItem(s,r),t.removeItem(Lp(e)),!0)};var fn=0,Ti=null,ex=220,tx=100,Wp={title:"Working on your project",status:"Preparing your content\u2026",placement:"global"},nx={title:"Starting Camtasia.ai",status:"Loading the editor and restoring your workspace\u2026",placement:"startup"},zp=t=>({title:t===1?"Adding your media":`Adding ${t} files`,status:"Inspecting your files and preparing them for the project\u2026",placement:"media"}),hs=(t=0)=>({title:"Building your storyboard",status:t===0?"Reviewing your media and planning the scene sequence\u2026":`${t} scene${t===1?"":"s"} created so far\u2026`,placement:"chat"}),rx=(t,e)=>{switch(t){case"preparing":return{title:"Opening your recording",status:"Reading the TREC project and preparing its media\u2026",placement:"media",step:{current:1,total:5}};case"extracting-audio":return{title:"Processing narration",status:"Extracting audio while the recording is prepared\u2026",placement:"media",step:{current:2,total:5},...typeof e=="number"?{progress:e}:{}};case"extracting-frames":return{title:"Finding key moments",status:"Extracting interaction frames from your recording\u2026",placement:"media",step:{current:3,total:5}};case"finalizing":return{title:"Aligning recording details",status:"Matching the transcript to the captured moments\u2026",placement:"media",step:{current:4,total:5}}}},ix=()=>{let t=document.getElementById("image-required-notification");t&&t.classList.add("hidden")},mr=async t=>{let e=document.getElementById("send-chat-button2");if(!e)return;t=t??await jr();let r=be.length>0,s=!t||fn>0||!r;e.classList.toggle("disabled",s),e.toggleAttribute("aria-disabled",s),r&&ix()},$p=async()=>{try{Rc(),kc(async()=>await mr()),await Lc()}catch(t){console.error("Auth init/check failed, showing sign-in button:",t)}finally{mr()}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",$p):$p();var ox=4e3,Ai=100,Sn=null,nf=t=>{Sn=t},Gf=()=>Sn,$n=null,jp=t=>{$n=t,window.globalTrec=t},Si=()=>$n,sx=()=>{let t=document.getElementById("image-required-notification");t&&(t.classList.remove("hidden"),setTimeout(()=>{t.classList.add("hidden")},ox))},fs=null,Op=0,ax=250,lx=t=>{let e=()=>{t.trim()?localStorage.setItem("cached-prompt",t):localStorage.removeItem("cached-prompt"),Op=Date.now()},r=ax-(Date.now()-Op);r<=0?e():(fs&&clearTimeout(fs),fs=window.setTimeout(()=>{e(),fs=null},r))},br=()=>{let t=document.getElementById("new-drag-drop-zone");t&&(be.length>0?t.classList.add("hidden"):t.classList.remove("hidden"))},nt;var Ll=t=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`},Dt={DEFAULT:"Default",IMAGE:"Image",FOCUS:"ImageFocal",SOCIAL:"Social"},Gt=!1,ir=[],Gp="trec-include-mouse-up-actions",Vp=5,cx=.125,Kp="last-executed-lua",wi="last-executed-lua-voiceovers",Yp=()=>localStorage.getItem(Gp)==="true",Zp=()=>{let t=document.getElementById("toggle-trec-up-actions-button");if(!t)return;let e=Yp();t.innerHTML=`<i class="fas fa-mouse-pointer"></i>TREC Include Mouse Up: ${e?"On":"Off"}`},Xp=()=>{let t=document.getElementById("toggle-experimental-model-button");t&&(t.innerHTML=`<i class="fas fa-flask"></i>Experimental Model: ${yi()?"On":"Off"}`)},ux=()=>{let t=document.getElementById("reasoning-effort-select");t&&(t.value=zo(),t.onchange=()=>{sl.includes(t.value)&&localStorage.setItem(Wo,t.value)})},Fr=()=>{let t=document.getElementById("chat-message");if(t){let e=t.value.trim()===""&&be.length===0;document.getElementById("main-app")?.classList.contains("player-visible")||!1?(t.classList.remove("empty-iue-state"),t.placeholder="Describe revisions to the storyboard (Regenerate to preview changes)"):e?(t.classList.add("empty-iue-state"),t.placeholder="Drop images here and describe your training or demo video..."):(t.classList.remove("empty-iue-state"),t.placeholder="Describe your training or demo video..."),Ll(t)}},Fl=t=>{let e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="sr-only",e.textContent=t,document.body.appendChild(e),setTimeout(()=>{document.body.contains(e)&&document.body.removeChild(e)},1e3)},qp=()=>{let t=document.getElementById("chat-history");t&&(t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","fal
2062se"));let e=document.querySelectorAll(".bot-switch button");e.forEach(s=>{s.addEventListener("click",()=>{e.forEach(c=>c.setAttribute("aria-pressed","false")),s.setAttribute("aria-pressed","true")})});let r=document.getElementById("chat-message");r&&r.addEventListener("focus",()=>{sessionStorage.getItem("keyboard-shortcuts-announced")||(Fl("Chat input focused. Press Ctrl+Enter to send message. Drop images here to include them."),sessionStorage.setItem("keyboard-shortcuts-announced","true"))})},nn=[],dx=()=>be.filter(t=>St(t.file.name)).map(t=>t.file.name),hx=()=>{let t=[];if($n)for(let e of $n.scenes)t.push({imageFileName:e.imageFileName,cursorCoords:e.cursorCoords,...e.imageSize?{imageSize:{width:e.imageSize.x,height:e.imageSize.y}}:{}});if(Sn)for(let e of Sn.steps)t.push({imageFileName:e.imageFileName,cursorCoords:e.cursorCoords,...e.originalImageSize?{imageSize:e.originalImageSize}:{}});return t},Np=t=>{let e=Math.round(t.x-Ai/2),r=Math.round(t.y-Ai/2);return`cordinates: (${e},${r}). dimensions: "${Ai}x${Ai}".`},fx=t=>{let r=t.replace(/\s+/g,"").replace(/,+/g,",").split(",").map(c=>{let f=parseInt(c.trim(),10);return isNaN(f)?0:f});return r.length!==4?null:{left:r[0]||0,top:r[1]||0,width:r[2]||0,height:r[3]||0}},px=t=>`${t.left},${t.top},${t.width},${t.height}`,gx=t=>t?.words?t.words.map(e=>{let r=fx(e.rectLTWH);return r?{word:e.word,...r}:null}).filter(e=>e!==null):[],mx=(t,e,r)=>{if(!e||!r)return[];let c=Math.sqrt(r.x*r.x+r.y*r.y)*cx;return t.filter(f=>{let i=Math.max(f.left,Math.min(e.x,f.left+f.width)),d=Math.max(f.top,Math.min(e.y,f.top+f.height));return(i-e.x)*(i-e.x)+(d-e.y)*(d-e.y)<=c*c})},vx=t=>t.map(e=>[e.word,px(e)]),yx=t=>{let e=new Map;if(t.length===0)return e;let r=_p(t);for(let c of r)e.set(c.id,c);let s=r.filter(c=>c.send==="image").length;return console.log(`Frame sampler: ${s}/${t.length} captures selected to send as images.`),e},Pl=t=>{let e=dx(),r=new Set(e),s=e.length===t.length;return t.map((c,f)=>{if(!c.screenshot||r.has(c.screenshot))return c;let i=s?e[f]:null;return i?(console.warn(`Repairing scene ${c.sceneNumber} screenshot from ${c.screenshot} to ${i}.`),{...c,screenshot:i}):(console.warn(`Scene ${c.sceneNumber} references unavailable screenshot ${c.screenshot}; video generation will fail until the storyboard is repaired.`),c)})},Dp=t=>{let e=Pl(t);return!$n&&!Sn?e:Tp(e,hx(),{width:qe.getCanvasWidth(),height:qe.getCanvasHeight()},Ai)},bx=async(t,e)=>{if(!t.voiceover||t.voiceover.trim()===""){console.log(`No voiceover text provided for scene ${t.sceneNumber}, skipping TTS`);return}let r=`scene${t.sceneNumber}.mp3`;try{if(!we)throw new Error("wasmStore not initialized");if(await we?.doesFileExist(r)){console.log(`Voiceover for scene ${t.sceneNumber} already exists`);return}let s={Accept:"application/json","Content-Type":"application/json"},c=await _n();c&&(s.Authorization=`Bearer ${c}`);let f=await fetch("/api/v1/camtasia/text-to-speech",{method:"POST",body:JSON.stringify({voiceToUse:e,text:t.voiceover}),headers:s});if(!f.ok)throw new Error("TTS request failed.");let i=await f.blob(),d=44;try{await we.addFileIfNeeded(r,i,!0),console.log(`Voiceover for scene ${t.sceneNumber} saved as ${r}`)}catch(n){if(n.errno===d)console.warn(`File ${r} already exists, skipping save`);else throw n}}catch(s){console.error("Error generating voiceover for scene:",t.sceneNumber,s)}};Un.require("ace/ext/language_tools");Un.config.set("workerPath",yh("ace"));var Ke=Un.edit("lua-script");Ke.session.setMode("ace/mode/lua");Ke.setTheme("ace/theme/monokai");Ke.setOptions({readOnly:!1,autoScrollEditorIntoView:!0,customScrollbar:!0,placeholder:"...Enter Lua script here...",showGutter:!0,useSvgGutterIcons:!0,tabSize:3,animatedScroll:!0});Ke.session.on("change",()=>{localStorage.setItem("previous-script",Ke.getValue())});var Xt=Un.edit("chat-history");Xt.session.setMode("ace/mode/markdown");Xt.setTheme("ace/theme/cloud_editor");Xt.setOptions({readOnly:!0,autoScrollEditorIntoView:!0,customScrollbar:!0,placeholder:`Upload screenshots and tell us what to create.
2063
2064Once your storyboard is complete, switch to 'Lua Bot' 
2065and click "Send" to generate your video.`,showGutter:!1,useSvgGutterIcons:!0,tabSize:3,animatedScroll:!0,showPrintMargin:!1,highlightActiveLine:!1,wrap:"free",behavioursEnabled:!1});var vs=Un.edit("bot0-system-message");vs.session.setMode("ace/mode/markdown");vs.setTheme("ace/theme/cloud_editor");vs.setOptions({readOnly:!1,autoScrollEditorIntoView:!0,customScrollbar:!0,placeholder:"...Storyboard bot system message...",showGutter:!1,useSvgGutterIcons:!0,tabSize:3,animatedScroll:!0,showPrintMargin:!1,highlightActiveLine:!1,wrap:"free"});var ys=Un.edit("bot1-system-message");ys.session.setMode("ace/mode/markdown");ys.setTheme("ace/theme/cloud_editor");ys.setOptions({readOnly:!1,autoScrollEditorIntoView:!0,customScrollbar:!0,placeholder:"...Lua bot system message...",showGutter:!1,useSvgGutterIcons:!0,tabSize:3,animatedScroll:!0,showPrintMargin:!1,highlightActiveLine:!1,wrap:"free"});var wr=[vs,ys];window.setActive=(t,e)=>{document.querySelectorAll(".switch-button").forEach(c=>{c.classList.remove("active")}),t.classList.add("active");let r=document.getElementById("bot-select");r.value=e,localStorage.setItem("bot-number",e);let s=document.getElementById("chat-area");s&&s.setAttribute("data-active-bot",e),r.dispatchEvent(new Event("input"))};var Rl=1,Jp=()=>{let t={};for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);r?.startsWith("@@auth0")&&(t[r]=localStorage.getItem(r)||"")}localStorage.clear(),Object.entries(t).forEach(([e,r])=>{localStorage.setItem(e,r)})},bt="0",tn="1",Bl=async t=>{let e=document.getElementById("generate-video");if(!e)return;t=t??await jr();
2065let r=nt?.getScenes().length>0,s=t&&tt[bt].isThereAtLeastOneChatInteraction()&&r,c=fn>0;e.classList.toggle("hidden",!s),e.disabled=c,e.toggleAttribute("aria-disabled",c)},ki=()=>{let t=document.getElementById("download-storyboard-json-button");t&&(t.disabled=!nt?.getScenes().length)},wx=t=>{document.querySelectorAll(".welcome-card").forEach(e=>{e.toggleAttribute("inert",t),e.classList.toggle("loading-disabled",t),t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled")})},Qp=async()=>{let t=await jr(),e=fn>0;document.querySelectorAll("#prompt-sign-in-button, #auth-signin-button, #auth-signout-button, #new-add-button, .media-thumbnail .remove-button").forEach(s=>{s.disabled=e}),wx(e),await Bl(t),ki(),await mr(t)},xx=t=>{let e=document.getElementById("loading-indicator"),r=document.getElementById("main-app"),s=document.getElementById("new-prompt-box"),c=document.getElementById("chat-and-timeline-wrapper");if(!e||!r||!s||!c)return;r.removeAttribute("aria-busy"),r.removeAttribute("aria-describedby"),s.removeAttribute("aria-busy"),s.removeAttribute("aria-describedby"),c.removeAttribute("aria-busy"),c.removeAttribute("aria-describedby"),s.classList.toggle("loading-media",t==="media"),e.classList.remove("loading-context-chat","loading-context-global","loading-context-media","loading-context-startup"),e.classList.add(`loading-context-${t}`);let f=r;t==="media"?(f=s,e.parentElement!==s&&s.prepend(e)):t==="chat"?(f=c,e.parentElement!==c&&c.append(e)):e.parentElement!==document.body&&document.body.insertBefore(e,r),f.setAttribute("aria-busy","true"),f.setAttribute("aria-describedby","loading-status")},Sx=()=>{let t=document.getElementById("loading-indicator"),e=document.getElementById("main-app"),r=document.getElementById("new-prompt-box"),s=document.getElementById("chat-and-timeline-wrapper");!t||!e||!r||!s||(e.removeAttribute("aria-busy"),e.removeAttribute("aria-describedby"),r.removeAttribute("aria-busy"),r.removeAttribute("aria-describedby"),s.removeAttribute("aria-busy"),s.removeAttribute("aria-describedby"),r.classList.remove("loading-media"),t.parentElement!==document.body&&document.body.insertBefore(t,e))},En=t=>{let e=document.getElementById("loading-kicker"),r=document.getElementById("loading-title"),s=document.getElementById("loading-status"),c=document.getElementById("loading-progress-track");if(!e||!r||!s||!c)return;xx(t.placement??"global"),e.textContent=t.step?`Camtasia.ai \xB7 Step ${t.step.current} of ${t.step.total}`:"Camtasia.ai",r.textContent=t.title,s.textContent=t.status;let f=typeof t.progress=="number";if(c.hidden=!f,f){let i=Math.min(tx,Math.max(0,t.progress));c.value=i,c.setAttribute("aria-label",`${t.title} progress`)}else c.removeAttribute("value"),c.setAttribute("aria-label","Import progress")},Et=async()=>{if(fn=Math.max(0,fn-1),fn>0)return;let t=document.getElementById("loading-indicator");t.classList.remove("loading-progress"),t.classList.add("loading-complete"),Ti=window.setTimeout(()=>{fn===0&&(t.style.display="none",Sx()),Ti=null},ex),await Qp()},Rt=async t=>{let e=fn===0;fn++,Ti!==null&&(clearTimeout(Ti),Ti=null);let r=document.getElementById("loading-indicator");t?En(t):e&&En(Wp),r.style.display="",r.classList.remove("loading-complete"),r.classList.add("loading-progress"),await Qp()},Il=async t=>{try{return await Rt(),await t()}finally{await Et()}},Hn=async(t,e={})=>Il(async()=>{if(!zh(t)){console.warn(`Unsupported file type: ${t.name}`),alert(`File type not supported: ${t.name}. This may be a system file issue.`);return}try{let r=t.name,s=t.type,c=t,f=!1;if(s==="text/plain"?f=!0:r.endsWith(".snagx")&&(c=await Or(t),r=r.replace(".snagx",".png"),s=c.type,t=new File([c],r,{type:s})),await rl(t,c,f,{persistToIndexedDb:St(r)||f}),we?await we.addFileIfNeeded(r,t):console.warn("loadFile: wasmStore not available, skipping addFileIfNeeded."),St(r)){let i=await t.arrayBuffer(),d=r.startsWith("pasted_image_");if(d&&console.log(`loadFile: Processing OCR for pasted image ${r}`),e.deferOcr){let n=Vn(i,r).catch(o=>{console.error(`loadFile: deferred OCR failed for ${r}:`,o)});e.ocrPromises?.push(n)}else await Vn(i,r),d&&console.log(`loadFile: OCR completed for pasted image ${r}`)}if(!t.name.endsWith(".lua")&&s!=="text/plain")if(window.project){let i=window.project.createMedias(`/opfs/${r}`);if(i)for(let d=0;d<i.size();d++)i.get(d)||console.warn(`loadFile: Media at index ${d} is null.`)}else console.warn("loadFile: window.project not available, skipping createMedias.")}catch(r){throw console.error(`loadFile: Error processing file ${t.name}:`,r),r}}),Ho=async t=>{let e=Array.from(t),{stepCaptureCandidates:r,trecCandidates:s,uploadable:c,unsupported:f}=Gh(e);for(let o of r)if(En({title:"Opening Step Capture",status:"Extracting screenshots and interaction details\u2026",placement:"media"}),await il(o))return;for(let o of s){console.log("**** Kicking off trec processing: ",o.name),Ru();let a=[],l=await Cp(o,{onStatus:(u,h)=>{En(rx(u,h?.progress))},onScene:async u=>{let h=new File([u.image],u.imageFileName,{type:"image/png"});await Hn(h,{deferOcr:!0,ocrPromises:a})}});if(l){jp(l),En({title:"Reading on-screen text",status:"Finishing OCR across the extracted frames\u2026",placement:"media",step:{current:5,total:5}}),await Promise.allSettled(a);return}}if(f.length>0){let o=f.map(a=>a.name).join(", ");console.warn(`Unsupported file types ignored: ${o}`),alert(`The following files are not supported and were ignored: ${o}`)}let{filesToLoad:i,warn:d}=Vh(be.length,c);d&&console.warn(`Too many files selected. Only ${i.length} will be loaded.`),i.length>0&&En({title:i.length===1?"Adding your image":`Adding ${i.length} images`,status:"Reading on-screen text and preparing your media\u2026",placement:"media"});let n=[];for(let o of i)await Hn(o,{deferOcr:!0,ocrPromises:n});await Promise.allSettled(n)},Ex=()=>{let t=document.querySelectorAll(".welcome-card");t.forEach((r,s)=>{let c=r;c.setAttribute("tabindex","0"),c.setAttribute("role","button");let f=c.querySelector("h3")?.textContent||"",i=c.querySelector("p")?.textContent||"";c.setAttribute("aria-label",`${f}. ${i}`),c.setAttribute("aria-describedby",`welcome-card-help-${s}`);let d=document.createElement("div");d.id=`welcome-card-help-${s}`,d.className="sr-only",d.textContent="Press Enter or Space to select this template and start creating your video",c.appendChild(d),c.addEventListener("keydown",n=>{let o=n;if(o.key==="Enter"||o.key===" "){if(n.preventDefault(),!tl(fn))return;c.click()}})});let e=t[0];e&&setTimeout(()=>{e.focus(),Fl("Welcome to video creation. Use tab to navigate templates, Enter to select.")},100)},eg=async()=>{let t=document.querySelector(".welcome-content");
2065if(!t)return;!tt[bt].isThereAtLeastOneChatInteraction()?(t.classList.add("visible"),Ex()):t.classList.remove("visible"),await Bl()},Cx=()=>{for(let t=0;t<Wt.length;t++){let e=document.getElementById(`bot${t}-system-message`),r=document.getElementById(`toggle-large-bot${t}-system-message-button`);e&&r&&(r.onclick=()=>{e.classList.toggle("large-editor"),wr[t]?.resize()},e.addEventListener("keydown",s=>{s.altKey&&s.code==="KeyZ"&&(s.preventDefault(),r.click())}))}},qo=t=>{let e=document.getElementById("bot-0-btn"),r=document.getElementById("bot-1-btn");t===bt?(e.classList.add("bg-white","text-gray-900","shadow-md"),e.setAttribute("aria-pressed","true"),r.classList.remove("bg-white","text-gray-900","shadow-md"),r.setAttribute("aria-pressed","false")):(r.classList.add("bg-white","text-gray-900","shadow-md"),r.setAttribute("aria-pressed","true"),e.classList.remove("bg-white","text-gray-900","shadow-md"),e.setAttribute("aria-pressed","false"))},Hl=t=>{for(let e=0;e<t.bots.length;e++){let r=t.bots[e];r.temperature&&(localStorage.setItem(`bot${e}-temp`,r.temperature.toString()),localStorage.setItem(`bot${e}-top-p`,r.topP.toString()),localStorage.setItem(`bot${e}-system-message`,r.systemMessage),localStorage.setItem(`bot${e}-chat-history`,JSON.stringify(r.chatHistory)))}localStorage.setItem("previous-script",t.luaScript),localStorage.setItem("loaded-media-items",JSON.stringify(t.loadedMedia)),localStorage.setItem("voice-selection",JSON.stringify(t.voiceSelection)),localStorage.setItem("defaultMediaList",JSON.stringify(t.defaultMediaList))},Br=()=>{let t=parseInt(document.getElementById("bot-select").value,10);Xt.setValue("");let e=(tt[t]?tt[t]:new kt).getHistoryForDisplay().map(r=>`## ${r.role}:
2066
2067${r.content}`).join(`
2068
2069`);Xt.setValue(e)},_x=(t,e)=>{Wt[e]===""&&(Wt[e]=t.bots[e].systemMessage);let r=localStorage.getItem(`bot${e}-system-message`)??"";r===""&&(r=Wt[e]),localStorage.setItem(`bot${e}-system-message`,r),wr[e].setValue(r)},Ax=t=>new Promise(e=>{let r=new FileReader;r.onloadend=()=>{let s=r.result?r.result:"";e(s)},r.readAsDataURL(t)}),ps=async(t,e)=>{if(t.toLowerCase().endsWith(".snagx"))try{let r=await e.arrayBuffer();return await Or(r)}catch(r){return console.error("Failed to extract PNG from SNAGX:",r),null}return e},Tx=t=>{let e=be.find(r=>r.file.name===t);return!e||e.isTextFile?null:e.file},kx=async(t,e)=>{if(!St(t))return null;let r=Tx(t);if(r)return await ps(t,r);try{await Ie.init();let s=await Ie.getImage(t);if(s)return await ps(t,s)}catch(s){console.warn(`Unable to hydrate ${t} from IndexedDB:`,s)}if(await we.doesFileExist(t)){let s=await we.readFile(t,{encoding:"binary"});return await ps(t,new Blob([s],{type:e}))}if(await ft.isStoreConfigured()){let s=await ft.readFile(t,{encoding:"binary"});return await ps(t,new Blob([s],{type:e}))}return null},Mx=async(t,e)=>{if(St(t)){let r=await kx(t,e);if(r!==null)return await Ax(r)}return""},Mi=async t=>{t||(t=localStorage.getItem("current-template")??Dt.DEFAULT);try{let e=`/static/${t}.lumachat`;console.log(`Fetching template: ${e}`);let r=await fetch(`${e}?v=${Date.now()}`);if(!r.ok){let f=`Failed to load template ${t}: ${r.status} ${r.statusText}`;throw console.error(f),new Error(f)}let s=await r.text();if(!s||s.trim()===""){let f=`Empty template content for ${t}`;throw console.error(f),new Error(f)}let c;try{c=JSON.parse(s)}catch(f){console.error(`Error parsing JSON for template ${t}:`,f);let i=f instanceof Error?f.message:"Unknown parsing error";throw new Error(`Invalid JSON in template ${t}: ${i}`)}if(!c)throw new Error(`Template data is null or undefined for ${t}`);if(!c.bots||!Array.isArray(c.bots)||c.bots.length===0)throw new Error(`Invalid template structure for ${t}: Missing or empty bots array`);for(let f=0;f<c.bots.length;f++){let i=c.bots[f];if(!i)throw new Error(`Invalid template structure for ${t}: Bot at index ${f} is null or undefined`);if(typeof i.temperature!="number")throw new Error(`Invalid template structure for ${t}: Bot at index ${f} missing temperature`);if(typeof i.topP!="number")throw new Error(`Invalid template structure for ${t}: Bot at index ${f} missing topP`);if(typeof i.systemMessage!="string")throw new Error(`Invalid template structure for ${t}: Bot at index ${f} missing systemMessage`)}return(!c.defaultMediaList||!Array.isArray(c.defaultMediaList))&&(console.warn(`Template ${t} has no defaultMediaList or it's invalid, initializing as empty array`),c.defaultMediaList=[]),(!c.loadedMedia||!Array.isArray(c.loadedMedia))&&(console.warn(`Template ${t} has no loadedMedia or it's invalid, initializing as empty array`),c.loadedMedia=[]),console.log(`Successfully loaded template: ${t}`),c}catch(e){throw console.error(`Error loading template ${t}:`,e),e instanceof Error?e:new Error(`Unknown error loading template ${t}:
2070${e}`)}},$l=async(t,e)=>{try{if(!t){console.error("fetchAndLoadAllNeededMedia: sessionData is null or undefined");return}(!t.defaultMediaList||!Array.isArray(t.defaultMediaList))&&(console.warn("fetchAndLoadAllNeededMedia: defaultMediaList is not an array, initializing as empty"),t.defaultMediaList=[]),ir=t.defaultMediaList,we||console.warn("fetchAndLoadAllNeededMedia: wasmStore is not available");for(let c of t.defaultMediaList)try{if(!c||typeof c!="string"){console.warn(`fetchAndLoadAllNeededMedia: Invalid defaultFile entry: ${c}`);continue}console.log(`Fetching default file: ${c}`);let f=await fetch(`/static/${c}`);if(!f.ok){console.error(`fetchAndLoadAllNeededMedia: Failed to fetch default file: ${c}, status: ${f.status}`);continue}let i=await f.blob();we?(await we.addFileIfNeeded(c,i),console.log(`fetchAndLoadAllNeededMedia: Added default file: ${c}`)):console.warn(`fetchAndLoadAllNeededMedia: wasmStore not available, couldn't add ${c}`)}catch(f){console.error(`ERROR: Could not load default file: ${c}`,f)}(!t.loadedMedia||!Array.isArray(t.loadedMedia))&&(console.warn("fetchAndLoadAllNeededMedia: loadedMedia is not an array, initializing as empty"),t.loadedMedia=[]);let r=t.loadedMedia.filter(c=>c?.path).map(c=>c.path).filter(c=>!t.defaultMediaList.includes(c));for(let c of r)try{if(!c||typeof c!="string"){console.warn(`fetchAndLoadAllNeededMedia: Invalid media path: ${c}`);continue}console.log(`Fetching media from server: ${c}`);let f=await fetch(`/static/${c}`);if(!f.ok){console.error(`fetchAndLoadAllNeededMedia: Failed to fetch media: ${c}, status: ${f.status}`);continue}let i=await f.blob();we?(await we.addFileIfNeeded(c,i),console.log(`fetchAndLoadAllNeededMedia: Added media: ${c}`)):console.warn(`fetchAndLoadAllNeededMedia: wasmStore not available, couldn't add ${c}`)}catch(f){console.error(`ERROR: Could not load media from server: ${c}`,f)}(!e||e.length<=0)&&(e=t.loadedMedia);let s=await ft.isStoreConfigured().catch(c=>(console.error("Error checking if file system store is configured:",c),!1));if(e.length>0&&s){let f=e.filter(i=>i?.path).filter(i=>!t.defaultMediaList.includes(i.path)).filter(i=>i.path&&!i.path.endsWith(".ocr")&&!i.path.endsWith(".mp3"));for(let i of f)try{if(!i.path){console.warn("fetchAndLoadAllNeededMedia: Item has no path");continue}if(await ft.doesFileExist(i.path).catch(n=>(console.error(`Error checking if file exists: ${i.path}`,n),!1))){let n=await ft.getFile(i.path).catch(o=>(console.error(`Error getting file: ${i.path}`,o),null));n&&await Hn(n).catch(o=>{console.error(`Error loading file: ${i.path}`,o)})}else if(i.path.endsWith(".png")){let n=i.path.replace(".png",".snagx");if(await ft.doesFileExist(n).catch(a=>(console.error(`Error checking if SNAGX file exists: ${n}`,a),!1))){let a=await ft.getFile(n).catch(l=>(console.error(`Error getting SNAGX file: ${n}`,l),null));a&&await Hn(a).catch(l=>{console.error(`Error loading SNAGX file: ${n}`,l)})}}}catch(d){console.error(`ERROR: Could not load media from file system: ${i.path}`,d)}}console.log("fetchAndLoadAllNeededMedia: Completed loading all media")}catch(r){throw console.error("fetchAndLoadAllNeededMedia: Unhandled error:",r),r}},Lx=t=>{if(t.options.length>0)return;for(let s of $c){let c=new Option(s.name,s.voice);t.add(c)}let e=!1,r=localStorage.getItem("voice-selection");if(r){let s=JSON.parse(r).voice;if(s){for(let c of Array.from(t.options))if(c.value===s){c.selected=!0,e=!0;break}}}if(!e&&t.options.length>0){t.selectedIndex=0;let s=t.options[0];if(s){let c={name:s.text,voice:s.value};localStorage.setItem("voice-selection",JSON.stringify(c))}}},Rx=async()=>{let t=localStorage.getItem("reset-all-number");t!==null&&parseInt(t,10)<Rl&&(Jp(),localStorage.setItem("reset-all-number",Rl.toString()),location.reload()),kt.setImageHydrator(Mx),kt.setOcrHydrator(Ei);let e=localStorage.getItem("vim-mode")==="true"||!1;Ke.setKeyboardHandler(e?"ace/keyboard/vim":"");for(let p of wr)p.setKeyboardHandler(e?"ace/keyboard/vim":"");document.getElementById("vim-mode").checked=e;let r=await Mi();if(!Gt){let p=parseInt(bt,10);Ip(localStorage,p,r.bots[p].systemMessage)}_c(r.bots.map(p=>p.systemMessage));let s=localStorage.getItem("previous-script");
2070if(s===null||s===""?Ke.setValue(r.luaScript):Ke.setValue(s),setTimeout(()=>{let p=Ke.session.getLength();Ke.focus(),setTimeout(()=>{Ke.gotoLine(p)},100)},100),Ke.setOption("relativeLineNumbers",e),localStorage.getItem("settings-area-visible")==="true"){let p=document.getElementById("settings-area");p&&(p.classList.remove("hidden"),p.classList.add("settings-area-visible"))}if(localStorage.getItem("lua-area-visible")==="true"){let p=document.getElementById("lua-section");p&&(p.classList.remove("hidden"),p.classList.add("lua-area-visible"))}if(localStorage.getItem("library-area-visible")==="true"){let p=document.getElementById("library-area");p&&(p.classList.remove("hidden"),p.classList.add("library-area-visible"))}for(let p=0;p<Wt.length;p++)_x(r,p);let c=localStorage.getItem("bot-number"),f=parseInt(c??bt,10);document.getElementById("bot-select").value=f.toString();for(let p=0;p<Wt.length;p++){let g=localStorage.getItem(`bot${p}-chat-history`);g!==null&&g!==""&&(tt[p]=kt.createCopyFromJSONString(g))}let i=localStorage.getItem("bot-number")??bt;qo(i),eg();for(let p=0;p<Wt.length;p++){let g=localStorage.getItem(`bot${p}-temp`);document.getElementById(`bot${p}-temp`).value=g??r.bots[p].temperature.toString();let m=localStorage.getItem(`bot${p}-top-p`);document.getElementById(`bot${p}-top-p`).value=m??r.bots[p].topP.toString()}Br();let d=localStorage.getItem("how-to-handle-chat-history");(d===null||d==="")&&(d="full-history"),document.getElementById("how-to-handle-chat-history").value=d,setTimeout(()=>{let p=Xt.session.getLength();Xt.focus(),setTimeout(()=>{Xt.gotoLine(p)},100)},100),document.getElementById("chat-message").focus();let n=!1,o=!1,a=localStorage.getItem("cached-prompt"),l=localStorage.getItem("screenshot-bin-loadedMedia");if(l){let p=JSON.parse(l);n=p.length>0,await tf(p),hn({persistMediaList:!1});let g=await Ep(be.map(m=>m.file.name));g&&jp(g),await $l(r,p)}else await $l(r,[]),hn();nt=new Ci;let u=localStorage.getItem("timelineScenes");if(u){try{let p=JSON.parse(u),g=Pl(p);localStorage.setItem("timelineScenes",JSON.stringify(g)),nt.setScenes(g),ki(),o=g.length>0}catch(p){console.error("Error restoring timeline scenes:",p)}a&&localStorage.removeItem("cached-prompt")}n&&!o&&a&&(document.getElementById("chat-message").value=a),br();let h=document.querySelector(".media-thumbnails");h&&new MutationObserver(()=>{br()}).observe(h,{childList:!0})};document.getElementById("voice-select").onchange=()=>{let t=document.getElementById("voice-select"),e={name:t.item(t.selectedIndex).text,voice:t.item(t.selectedIndex).value};localStorage.setItem("voice-selection",JSON.stringify(e))};var Ix=()=>{let t=document.createElement("input");t.type="file",t.multiple=!0;let e=gr.map(c=>`.${c}`);t.accept=["image/*",...e].join(","),t.className="hidden-file-input",t.onchange=async()=>{if(t.files){await Rt(zp(t.files.length));try{await Ho(t.files),Fr()}catch(c){console.error("Error loading files:",c)}finally{await Et(),t.value=""}}},document.body.appendChild(t);let r=document.querySelector(".upload-image-button");r&&r.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),t.click()});let s=document.getElementById("click-to-browse-link");s&&s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),t.click()})},Ol=()=>{let t=document.getElementById("main-app"),e=document.getElementById("generate-video");if(t&&t.classList.add("player-visible"),e){let r=e.querySelector("i")?.outerHTML||"";e.innerHTML=`${r} Regenerate Video`}nt.render(),Fr(),setTimeout(()=>{let r=document.getElementById("play-pause-button");r&&(r.focus(),Fl("Video player is ready. Press Enter to play or use arrow keys to navigate controls."))},100)},$x=()=>{let t=document.getElementById("main-app"),e=document.querySelector(".export-dropdown"),r=document.getElementById("generate-video");if(t&&t.classList.remove("player-visible"),e&&e.classList.remove("active"),r){let s=r.querySelector("i")?.outerHTML||"";r.innerHTML=`${s} Generate Video`}nt.render(),Fr()},tg=t=>{let e=localStorage.getItem(`bot${t}-system-message`);(e===null||e==="")&&(e=Wt[t]),tt[t]=kt.createCopyFromHistoryArray([{role:"system",content:e}]),localStorage.setItem(`bot${t}-chat-history`,JSON.stringify(tt[t].getHistoryForStorage()))},Ox=t=>()=>{if(confirm("Are you sure you want to set the system message? Doing so will lose your chat history.")){let r=wr[t].getValue();localStorage.setItem(`bot${t}-system-message`,r),tg(t),Br()}},Nx=t=>()=>{let e=document.getElementById(`bot${t}-temp`).value;localStorage.setItem(`bot${t}-temp`,e)},Dx=t=>()=>{let e=document.getElementById(`bot${t}-top-p`).value;localStorage.setItem(`bot${t}-top-p`,e)},Ul=async()=>{Jp();try{let t=await Mi(Dt.DEFAULT);Hl(t),localStorage.setItem("reset-all-number",Rl.toString()),await we.clearAllFiles(),await Ie.deleteDatabase(),location.reload()}catch{alert("Error loading the default state.")}};document.getElementById("reset-all-button").onclick=async()=>{await Ul()};document.getElementById("player-reset-all-button").onclick=async()=>{await Ul()};document.getElementById("chat-reset-all-button").onclick=async()=>{await Ul()};document.getElementById("open-media-library-button").onclick=async()=>
2070{if(!(await ft.isStoreConfigured()&&!confirm("Are you sure you want to change the media library?")))try{let t=await window.showDirectoryPicker({mode:"read",startIn:"documents"});if(await ft.upsertLibraryHandle(t),await ft.isStoreConfigured()){let e=document.querySelector(".snagit-library-button");if(!e)return;await ol(),e.click()}}catch(t){console.warn("Media library selection cancelled or failed:",t)}};document.getElementById("toggle-settings-button").onclick=()=>{let t=document.getElementById("settings-area");t.classList.contains("hidden")?(t.classList.remove("hidden"),t.classList.add("settings-area-visible"),localStorage.setItem("settings-area-visible","true")):(t.classList.remove("settings-area-visible"),t.classList.add("hidden"),localStorage.setItem("settings-area-visible","false"))};document.getElementById("toggle-lua-area-button").onclick=()=>{let t=document.getElementById("lua-section"),e=document.getElementById("lua-overlay");t.classList.contains("hidden")?(t.classList.remove("hidden"),e.classList.add("visible"),localStorage.setItem("lua-area-visible","true"),Ke.resize(),Ke.focus()):(t.classList.add("hidden"),e.classList.remove("visible"),localStorage.setItem("lua-area-visible","false"))};document.getElementById("dismiss-lua-button").onclick=()=>{document.getElementById("toggle-lua-area-button").click()};document.getElementById("toggle-library-button").onclick=()=>{let t=document.getElementById("library-area");t.classList.contains("hidden")?(t.classList.remove("hidden"),t.classList.add("library-area-visible"),localStorage.setItem("library-area-visible","true")):(t.classList.remove("library-area-visible"),t.classList.add("hidden"),localStorage.setItem("library-area-visible","false"))};document.getElementById("load-default-lua-button").onclick=async()=>{let t=await Mi(Dt.DEFAULT);Ke.setValue(t.luaScript),Ke.gotoLine(Ke.session.getLength())};var Pr=()=>{let t=document.getElementById("lua-output");t.value="";let e=Ke.getValue();t.value=`Running Lua script...
2071`;let{finalLuaScript:r,luaScriptOutput:s,hadError:c}=Ih(e);t.value=s,Ke.setValue(r),Ke.gotoLine(Ke.session.getLength());let f=qe.getCanvasWidth(),i=qe.getCanvasHeight(),d=1920,n=1080;if(f!==d||i!==n){let o=d/f,a=n/i,l=Math.min(o,a);console.log(`Lua run: Project dimensions (${f}x${i}) differ from preview (${d}x${n}). Applying scale: ${l}`),st.setScale(l)}else console.log(`Lua run: Project dimensions (${f}x${i}) match preview. Resetting scale.`),st.setScale(1);if(!c)t.value=`Script succeeded. Output from script (if any) is below:
2072${s}`,localStorage.setItem(Kp,e),Ol();else{let o=localStorage.getItem("lua-area-visible");if(!o||o==="false")throw new Error(`Lua script failed, script output: '${s}'`)}};document.getElementById("run-lua-button").onclick=Pr;var Fx=160,Nl=0,gs=Nl,ms=!1,Al=!1,ng=()=>{Al||(Al=!0,ms=st?.isPlaying()??!1,ms&&st.pause()),gs!==Nl&&window.clearTimeout(gs),gs=window.setTimeout(()=>{gs=Nl;let t=ms;if(Al=!1,ms=!1,!!Ke.getValue().trim())try{Pr(),$h(),t&&st.play()}catch(e){console.error("Error re-running Lua script for preview style change:",e)}},Fx)},Px=t=>{let e=document.getElementById("energy-level-value");e&&(e.textContent=`${t}%`)},Tl={r:6,g:182,b:212}
2072,kl={r:229,g:39,b:154},Bx=t=>{let e=Math.min(1,Math.max(0,t/100)),r=(i,d)=>Math.round(i+(d-i)*e),s=r(Tl.r,kl.r),c=r(Tl.g,kl.g),f=r(Tl.b,kl.b);return`rgb(${s}, ${c}, ${f})`},Fp=(t,e)=>{Px(e),t.style.setProperty("--energy-thumb-color",Bx(e))},Hx=()=>{let t=document.getElementById("energy-level-slider");if(!t)return;let e=Math.round(No()*100);t.value=String(e),Fp(t,e),t.addEventListener("input",()=>{let r=Number(t.value);Fp(t,r),Lh(r/100),ng()})};Hx();var Ux=()=>{let t=document.getElementById("brand-color-input");t&&(t.value=tr(Fo()),t.addEventListener("input",()=>{Rh(t.value),ng()}))};Ux();var Wx=t=>{let e=t.trimStart();return e.startsWith("--")||e.startsWith("local ")||t.includes("Camtasia.currentProject")||t.includes("ClearTimeline(")},xi=(t,e=!0)=>{if(t.includes("```lua")){let r=t.split("```")[1];r=r.replace(`lua
2073`,""),Ke.setValue(r),localStorage.setItem("previous-script",r),e&&(Ol(),Pr())}else if(t!==""&&Wx(t)){let r=t;Ke.setValue(r),localStorage.setItem("previous-script",r),e&&(Ol(),Pr())}else throw new Error(`No Lua script found in the message: ${t}`)};document.getElementById("clear-lua-button").onclick=()=>{let t=document.getElementById("lua-output");t.value="",Ke.setValue("")};document.getElementById("bot-select").oninput=()=>{let t=document.getElementById("bot-select").value;if(localStorage.setItem("bot-number",t),t!==tn){if(t===bt){let e=document.getElementById("how-to-handle-chat-history");e.value!=="full-history"&&confirm("Would you like to switch to the full storyboard bot history?")&&(e.value="full-history")}}Br()};document.getElementById("generate-voiceover").onclick=async()=>{let t=tt[bt],e=document.getElementById("voice-select"),r=e.item(e.selectedIndex).value;await Ic(t,r,()=>{})};document.getElementById("how-to-handle-chat-history").oninput=()=>{let t=document.getElementById("how-to-handle-chat-history").value;localStorage.setItem("how-to-handle-chat-history",t)};var Pp=t=>{let e=(t.focus||"").toString().replace(/\n/g," ").trim(),r=(t.coordinates||"").toString().replace(/\n/g," ").trim(),s=(t.dimensions||"").toString().replace(/\n/g," ").trim(),c=r;return(!c.startsWith("(")||!c.includes(")"))&&(c=c.replace(/[()]/g,""),c=`(${c})`),`${e}  [${c}, ${s}]`},zx=async t=>{let e=be.map(d=>({path:d.file.name,type:d.file.type})),r=[],s=be.filter(d=>St(d.file.name)).map(d=>d.file.name);s.length>0&&r.push({type:"text",text:`Available screenshots: ${JSON.stringify(s,null,2)}
2074Please use these exact filenames in your scene descriptions.`});let c=[];$n?c=$n.scenes.map(d=>d.imageFileName??""):Sn&&(c=Sn.steps.map(d=>d.imageFileName??""));let f=yx(c.filter(Boolean)),i=d=>{if(!d)return!1;let n=f.get(d);return!n||n.send==="image"};for(let d of e)if(St(d.path)){let n=f.has(d.path);i(d.path)?r.push({type:"image_url",image_url:{url:""},filePath:d.path,fileType:d.type}):console.log(`Frame sampler: omitting image for ${d.path}; OCR + transcript only.`);try{if(await cr(d.path))try{let a=await Ei(d.path,n?"paragraph":"word");r.push({type:"text",text:a})}catch(a){console.error("Error formatting OCR data:",a),r.push({type:"text",text:`Error processing OCR data for ${d.path}`})}}catch(o){console.error(`Error processing OCR for ${d.path}:`,o),r.push({type:"text",text:`Error retrieving OCR data for ${d.path}`})}}else if(d.type==="text/plain")try{let n="";try{await Ie.init();let o=await Ie.getImage(d.path);o&&(n=await o.text())}catch(o){console.warn(`Could not get text from image store: ${o}`)}!n&&await ft.doesFileExist(d.path)&&(n=await(await ft.getFile(d.path)).text()),n?r.push({type:"text",text:`Text file ${d.path}:
2075${n}`}):console.warn(`Could not retrieve content for text file: ${d.path}`)}catch(n){console.error(`Error processing text file ${d.path}:`,n),r.push({type:"text",text:`Error retrieving content for text file: ${d.path}`})}if(Sn){let d=Sn.steps.length,n=`CRITICAL: There are ${d} captured steps. You MUST produce a storyboard scene for EACH of these ${d} steps, in order, using the exact filename given for each. Do NOT summarize, merge, or stop early. The following is additional meta data from a set of captures from Snagit. Treat the cursor coordinates below as higher priority than the OCR coordinates. Use the OCR text to understand what is on screen.
2076`;n+=`NOTE: To stay within limits, an image may not be attached for every step. Steps without an attached image are still fully described below by their OCR text and step description; use that text to understand what happened.
2077`,n+=`The Title of the document was \`${Sn.title}\`.
2078`,Sn.steps.forEach((o,a)=>{let l=i(o.imageFileName);n+=`Step ${a+1}.`,n+=`filename: "${o.imageFileName}", `,n+=`imageAttached: ${l?"yes":"no (described via OCR + description)"}, `,n+=`Description of the step "${o.title}". `,o.cursorCoords&&(n+=Np(o.cursorCoords)),n+=`
2079`}),r.push({type:"text",text:n})}if($n){let d=$n.scenes.length,n=`CRITICAL: There are ${d} recorded scenes in this TREC. You MUST produce a storyboard scene for EACH of these ${d} scenes, in order, using the exact filename given for each. Do NOT summarize, merge, or stop early: output all ${d} scenes. The following is additional meta data from the TREC file from Camtasia's recorder. Treat the cursor coordinates below as higher priority than the OCR coordinates for positioning. Use the OCR text to understand what is on screen. The SME (spoken transcript) information is context to inform the voiceover, but should not be copied verbatim as the transcript.
2080`;n+=`NOTE: To stay within limits, an image may not be attached for every scene. Scenes without an attached image are still fully described below by their OCR text and SME transcript; use that text to understand what happened in those frames.
2081`,$n.scenes.forEach((o,a)=>{let l=i(o.imageFileName);n+=`Scene ${a+1}:`,n+=`filename: "${o.imageFileName}", `,n+=`imageAttached: ${l?"yes":"no (described via OCR + transcript)"}, `,o.cursorCoords&&(n+=`${Np(o.cursorCoords)} `),n+=`infoFromSME: "${o.transcript}".
2082`}),r.push({type:"text",text:n})}return r.push({type:"text",text:t}),r},Dl=async()=>{if(console.log("Send button clicked"),be.length===0){console.warn("Cannot send message without at least one image"),sx();return}if(fn>0){console.warn("Cannot send message while processing");return}let t=document.querySelector(".welcome-content");t&&(t.classList.remove("visible"),br());let e=parseInt(document.getElementById("bot-select").value,10),r=e===parseInt(tn,10);await Rt(r?Wp:hs());let s=document.getElementById("chat-message"),c=s.value.trim();s.value="";let f={role:"user",content:c};console.log("Message prepared:",f);let i=localStorage.getItem("bot-number");console.log("Bot number:",i);let d="",n="",o=document.getElementById("how-to-handle-chat-history").value,a=null;try{if(r){console.log("Processing for Lua bot"),nt.applySceneEditsFromDOM();let p=document.getElementById("voice-select").value;for(let m of nt.getScenes())await bx(m,p);let g={scenes:nt.getScenes().map(m=>({sceneNumber:m.sceneNumber,title:m.sceneTitle,voiceover:{text:m.voiceover,audioFile:`scene${m.sceneNumber}.mp3`},callout:m.callout,screenshot:m.screenshot,endingPosition:m.endingPosition})),additionalMedia:be.filter(m=>!m.file.name.endsWith(".ocr")&&!m.file.name.endsWith(".lua")).map(m=>`./${m.file.name}`)};for(let m of ir)g.additionalMedia.push(m);f.content=`\`\`\`json
2083${JSON.stringify(g,null,2)}
2084\`\`\`
2085
2086Please write the Lua script for this video.`,a=ar(f,e,"no-history"),tt[e]=ar(f,e,o),localStorage.setItem(`bot${e}-chat-history`,JSON.stringify(tt[e].getHistoryForStorage()))}else{console.log("Processing for non-Lua bot");let h=f.content.toString(),p=await zx(h);f.content=p,a=ar(f,e,o),tt[e]=a,localStorage.setItem(`bot${e}-chat-history`,JSON.stringify(tt[e].getHistoryForStorage()))}console.log("Final message content type:",typeof f.content),console.log("Final message content:",typeof f.content=="object"?`Object with ${Array.isArray(f.content)?`${f.content.length} items`:"properties"}`:f.content);let l=parseFloat(document.getElementById(`bot${e}-temp`).value),u=parseFloat(document.getElementById(`bot${e}-top-p`).value);console.log("Creating request with temperature:",l,"topP:",u);try{if(!a)throw new Error("Chat history was not initialized for the request");let h=await a.getHistoryForChatGPT();console.log("Chat history messages:",h.length);let p=await nr(u,l,h,({attempt:b,maxAttempts:C,delaySeconds:E})=>confirm(`The AI service is currently busy and rejected the request because too much data was sent too quickly (rate limit).
2087
2088This can happen when a video has many screenshots, long transcripts, or large images.
2089
2090Retry attempt ${b} of ${C} will wait about ${E} second${E===1?"":"s"} before trying again.
2091
2092Select OK to wait and retry, or Cancel to stop.`)),g=new TextDecoder,m=Xt.getValue();nn=[],console.log("Starting to read response chunks");let y=0;for(;;){let{done:b,value:C}=await p.read();if(b){console.log("Finished reading response chunks, total chunks:",y);break}y++;let E=g.decode(C,{stream:!0});console.log(`Received chunk #${y} with ${E.length} characters`),n+=E;let w;for(;(w=n.indexOf(`
2093`))!==-1;){let k=n.slice(0,w).trim();if(n=n.slice(w+1),k)try{let I=JSON.parse(k);nn.push(I),En(hs(nn.length)),d+=`[Scene ${I.sceneNumber}]
2094`,console.log(`Added scene ${I.sceneNumber} to storyboard`)}catch{d+=`${k}
2095`}}Xt.setValue(`${m}
2096
2097## assistant
2098
2099${d}`),Xt.gotoLine(Xt.session.getLength()),nn.length>0&&(nt.setScenes(Dp(nn)),ki(),console.log(`Updated storyboard with ${nn.length} scenes`))}if(n.trim().length>0){console.log("Processing final chunk buffer with length:",n.trim().length);let b=n.trim().replace(/None\s*$/,"");try{let C=JSON.parse(b);if(C&&typeof C=="object"&&C?.sceneNumber){let E;try{E=formatScene(C)}catch{E={sceneNumber:C.sceneNumber,sceneTitle:C.sceneTitle,endingPosition:C.endingPosition,voiceover:C.voiceover,callout:C.callout,screenshot:C.screenshot}}if(E.endingPosition&&typeof E.endingPosition=="object"){let w=E.endingPosition;if(w.coordinates&&typeof w.coordinates=="string"&&(w.coordinates.includes("(")||(w.coordinates=`(${w.coordinates}
2099)`),w.coordinates=w.coordinates.replace(/\s+/g,"")),w.dimensions&&typeof w.dimensions=="string"){if(!w.dimensions.includes("x")){let I=w.dimensions.split(",").map(L=>L.trim());I.length===2&&(w.dimensions=`${I[0]}x${I[1]}`)}w.dimensions=w.dimensions.replace(/\s+/g,"")}let k=Pp(w);d+=`[Scene ${E.sceneNumber} - ${k}]
2100`}else d+=`[Scene ${E.sceneNumber}]
2101`;nn.push(E),En(hs(nn.length)),console.log(`Added final scene ${E.sceneNumber} to storyboard`)}else d+=n.trim()}catch{console.log("Final chunk is not JSON, processing as text");let E=n.split(`
2102`).filter(w=>w.trim().length>0);for(let w of E){let I=w.trim().replace(/^[\uFEFF]+/,"");try{let L=JSON.parse(I);if(L&&typeof L=="object"&&L?.sceneNumber){let F;try{F=formatScene(L)}catch{F={sceneNumber:L.sceneNumber,sceneTitle:L.sceneTitle,endingPosition:L.endingPosition,voiceover:L.voiceover,callout:L.callout,screenshot:L.screenshot}}if(F.endingPosition&&typeof F.endingPosition=="object"){let R=F.endingPosition;if(R.coordinates&&typeof R.coordinates=="string"&&(R.coordinates.includes("(")||(R.coordinates=`(${R.coordinates})`),R.coordinates=R.coordinates.replace(/\s+/g,"")),R.dimensions&&typeof R.dimensions=="string"){if(!R.dimensions.includes("x")){let A=R.dimensions.split(",").map(_=>_.trim());A.length===2&&(R.dimensions=`${A[0]}x${A[1]}`)}R.dimensions=R.dimensions.replace(/\s+/g,"")}let M=Pp(R);d+=`[Scene ${F.sceneNumber} - ${M}]
2103`}else d+=`[Scene ${F.sceneNumber}]
2104`;nn.push(F),En(hs(nn.length)),console.log(`Added scene from line ${F.sceneNumber} to storyboard`)}else d+=I}catch{d+=I}}}}}catch(h){throw console.error("Error during API request or response processing:",h),h}}catch(l){console.error("Error in chat send button handler:",l),alert(`Error: ${JSON.stringify(l)}`),d=`Error: ${l}`}finally{await Et(),console.log("Final response text length:",d.length),(d.endsWith("None")||d.endsWith(`None
2105`))&&(d=d.slice(0,d.length-4));try{console.log("Adding assistant message to chat history");let l=tt[e];if(l.addMessage({role:"assistant",content:d}),localStorage.setItem(`bot${e}-chat-history`,JSON.stringify(l.getHistoryForStorage())),Br(),Xt.gotoLine(Xt.session.getLength()),r)try{xi(d)}catch(u){console.error("Error looking for Lua script:",u)}if(nn.length>0){let u=Dp(nn);nt.setScenes(u),ki(),localStorage.setItem("timelineScenes",JSON.stringify(u)),nn=u,console.log(`Saved ${u.length} scenes to localStorage`)}}catch(l){console.error("Error in final processing of chat response:",l)}}},jx=()=>{document.getElementById("send-chat-button2")?.addEventListener("click",Dl),document.getElementById("send-chat-button").onclick=Dl},Gx='<i class="fas fa-book" aria-hidden="true"></i>Technical Documentation',Vx='<i class="fas fa-book" aria-hidden="true"></i>Writing documentation...',Ml=8e3,Kx=()=>{let t=document.getElementById("export-documentation-button");t&&(t.onclick=async()=>{if(!nt){yr("Generate a storyboard before exporting technical documentation.","error",Ml);return}nt.applySceneEditsFromDOM();let e=nt.getScenes(),r=Si();if(!Xo(e,r)){yr("Technical documentation needs a storyboard whose scenes have a screenshot and voiceover.","error",Ml);return}t.disabled=!0,t.innerHTML=Vx;try{let s=await zf(e,r,{highlightColor:Fo()});yr(`Technical documentation ready: ${s.steps.length} steps exported.`,"success")}catch(s){console.error("Error generating technical documentation:",s),yr(`Could not export technical documentation: ${s instanceof Error?s.message:String(s)}`,"error",Ml)}finally{t.disabled=!1,t.innerHTML=Gx}})};document.getElementById("chat-message").addEventListener("keypress",t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),document.getElementById("send-chat-button").click())});var Bp=0,Hp=0,Yx=()=>{Bp++;let t=Date.now(),e=Math.random().toString(36).substring(2,8);return`pasted_image_${Bp}_${t}_${e}.png`};document.getElementById("chat-message").addEventListener("paste",async t=>{Hp++;let e=Hp;console.log(`Paste Event #${e} triggered`);let r=t.clipboardData?.items;if(!r){console.log(`Paste Event #${e}: No clipboard items found.`);return}console.log(`Paste Event #${e}: Found ${r.length} items.`);for(let f=0;f<r.length;f++){let i=r[f];console.log(i?`Paste Event #${e} - Item ${f}: kind=${i.kind}, type=${i.type}`:`Paste Event #${e} - Item ${f}: null/undefined`)}let s="";if(jh(r).length===0)return;t.preventDefault();let c=[];await Rt({title:"Adding pasted content",status:"Reading the clipboard and preparing its images\u2026",placement:"media"});try{for(let f=0;f<r.length;f++){let i=r[f];if(i){if(i.kind==="file"&&i.type.startsWith("image/")){let d=i.getAsFile();if(d){let n=Yx();console.log(`Paste Event #${e}: Original filename: ${d.name}, Assigning unique name: ${n}`);let o=new File([d],n,{type:d.type});console.log(`Paste Event #${e}: Processing image file with new name: ${o.name}`),c.push((async()=>{console.log(`Paste Event #${e}: Starting full processing for ${o.name}`);try{await Il(async()=>{let l=new FileReader,u=await new Promise((g,m)=>{l.onload=()=>{g(l.result)},l.onerror=()=>{m(l.error)},l.readAsArrayBuffer(o)}),h=o.name;await rl(o,o,!1);let p=new Blob([new Uint8Array(u)],{type:o.type});we&&await we.addFileIfNeeded(h,p),console.log(`Paste Event #${e}: Starting OCR for ${h}`),await new Promise(g=>setTimeout(g,100)),await Vn(u,h),console.log(`Paste Event #${e}: OCR completed for ${h}`)});let a=await cr(o.name);if(a)console.log(`Paste Event #${e}: Verified OCR data exists for ${o.name} with ${a.words.length} words`);else{console.warn(`Paste Event #${e}: No OCR data found for ${o.name} after processing!`),console.log(`Paste Event #${e}: Attempting OCR again for ${o.name}`),await Il(async()=>{let u=new FileReader,h=await new Promise((p,g)=>{u.onload=()=>p(u.result),u.onerror=()=>g(u.error),u.readAsArrayBuffer(o)});await new Promise(p=>setTimeout(p,500)),await Vn(h,o.name)});let l=await cr(o.name);l?console.log(`Paste Event #${e}: Successfully retried OCR for ${o.name}, found ${l.words.length} words`):console.error(`Paste Event #${e}: OCR still failed after retry for ${o.name}`)}console.log(`Paste Event #${e}: Full processing completed for ${o.name}`)}catch(a){console.error(`Paste Event #${e}: Error processing ${o.name}:`,a),alert(`Failed to process pasted image: ${o.name}`)}})())}else console.log(`Paste Event #${e}: Item is image but getAsFile() returned null.`)}
2105else if(i.kind==="string"&&i.type==="text/plain"){let d=new Promise(n=>i.getAsString(n));c.push(d.then(async n=>(s+=n,Promise.resolve())).catch(n=>{console.error("Error processing pasted text:",n)}))}}}if(console.log(`Paste Event #${e}: Waiting for all image processing to complete...`),await Promise.all(c),console.log(`Paste Event #${e}: All image processing completed`),console.log(`Paste Event #${e}: All processing promises resolved.`),s){let f=document.getElementById("chat-message"),i=f.selectionStart,d=f.selectionEnd;f.value=f.value.substring(0,i)+s+f.value.substring(d),f.selectionEnd=i+s.length,f.selectionStart=i+s.length,f.scrollTop=f.scrollHeight,f.focus()}}catch(f){console.error(`Paste Event #${e}: Error handling pasted content:`,f),alert("An error occurred while processing pasted content.")}finally{await Et(),console.log(`Paste Event #${e}: Handling finished.`)}});document.getElementById("clear-chat-history").onclick=()=>{if(confirm("Are you sure you want to clear the chat history?")){tg(parseInt(document.getElementById("bot-select").value,10)),Br(),$x();let t=document.querySelector(".welcome-content");t&&t.classList.add("visible"),br()}};document.getElementById("vim-mode").onclick=()=>{let t=[Ke,...wr];for(let e of t)e.setKeyboardHandler(document.getElementById("vim-mode").checked?"ace/keyboard/vim":""),localStorage.setItem("vim-mode",document.getElementById("vim-mode").checked.toString()),e.setOption("relativeLineNumbers",document.getElementById("vim-mode").checked)};document.getElementById("delete-media-button").onclick=()=>{let t=document.getElementById("medias-select"),e=t.options[t.selectedIndex];if(e&&e.value!==""){let r=Number(e.value),s=qe.trackAtIndex(r);qe.removeTrack(s),t.remove(t.selectedIndex)}};for(let t=0;t<Wt.length;t++)document.getElementById(`set-bot${t}-system-message-button`).onclick=Ox(t);for(let t=0;t<Wt.length;t++)document.getElementById(`bot${t}-temp`).oninput=Nx(t);for(let t=0;t<Wt.length;t++)document.getElementById(`bot${t}-top-p`).oninput=Dx(t);document.getElementById("lua-output").ondblclick=()=>{let t=document.getElementById("lua-output").value;if(t===""||!t.match(/(.*):(\d+)(.*)/))return;let e=t.replace(/(.*):(\d+)(.*)/,"$2");Ke.focus(),setTimeout(()=>{Ke.gotoLine(parseInt(e,10))},100)};document.getElementById("chat-message").addEventListener("keydown",t=>{t.altKey&&t.code==="KeyZ"&&(t.preventDefault(),document.getElementById("toggle-chat-history-size-button").click())});document.getElementById("lua-script").addEventListener("keydown",t=>{t.ctrlKey&&t.key==="Enter"&&(t.preventDefault(),Pr())});var rg=t=>{let e=document.getElementById("swap-template-button");if(e){let r=t===Dt.DEFAULT?Dt.IMAGE:Dt.DEFAULT;e.innerHTML=`
2106      <i class="fas fa-exchange"></i>
2107      <span class="current-template">${t}</span>
2108      <span class="template-arrow">\u2192</span>
2109      <span class="next-template">${r}</span>
2110    `,e.setAttribute("title",`Switch to ${r} template`)}},Wl=async(t,e,r=!1)=>{let s=c=>{if(!c)return"";let f=c;return f.startsWith("./")&&(f=f.substring(2)),f.startsWith("/")&&(f=f.substring(1)),f};try{await Rt(),localStorage.setItem("current-template",e),rg(e),Hl(t),t.bots.forEach((c,f)=>{if(wr[f]){wr[f].setValue(c.systemMessage),tt[f]=kt.createCopyFromHistoryArray([{role:"system",content:c.systemMessage}]);let i=document.getElementById(`bot${f}-temp`),d=document.getElementById(`bot${f}-top-p`);i&&(i.value=c.temperature.toString(),localStorage.setItem(`bot${f}-temp`,c.temperature.toString())),d&&(d.value=c.topP.toString(),localStorage.setItem(`bot${f}-top-p`,c.topP.toString()))}}),t.luaScript&&(Ke.setValue(t.luaScript),localStorage.setItem("previous-script",t.luaScript)),Br();try{if(!we)console.warn("applyTemplate: wasmStore is not available for file operations.");else{console.log("applyTemplate: Starting selective file cleanup from wasmStore...");let c=new Set;t.defaultMediaList&&Array.isArray(t.defaultMediaList)&&t.defaultMediaList.forEach(i=>{let d=s(i);d&&c.add(d)}),t.loadedMedia&&Array.isArray(t.loadedMedia)&&t.loadedMedia.forEach(i=>{if(i?.path){let d=s(i.path);if(d&&c.add(d),St(i.path)){let n=`${i.path}.ocr`,o=s(n);o&&c.add(o)}}}),Gt&&console.log("applyTemplate: Files in incoming template definition:",Array.from(c));let f=await we.listFilesInDirectory("./");if(!f||!Array.isArray(f))console.warn("applyTemplate: Could not list files in wasmStore or result was invali
2110d.");else{let i=new Set;be.forEach(d=>{let n=s(d.file.name);if(n&&i.add(n),St(d.file.name)){let o=s(`${d.file.name}.ocr`);o&&i.add(o)}}),Gt&&console.log("applyTemplate: User-related session files to protect:",Array.from(i));for(let d of f){let n=s(d);if(n===""||n==="."||n===".."){Gt&&console.log(`applyTemplate: Skipping deletion of special/protected entry: ${n}`);continue}if(i.has(n)){Gt&&console.log(`applyTemplate: Preserving user/session file in wasmStore: ${n}`);continue}if(c.has(n)){Gt&&console.log(`applyTemplate: File ${n} is part of the incoming template, skipping explicit deletion.`);continue}Gt&&console.log(`applyTemplate: Attempting to delete presumed stale file from a PREVIOUS template: ${n}`);try{let l=!1;for(let u=1;u<=3;u++)try{await we.deleteFile(n),Gt&&console.log(`applyTemplate: Deleted presumed old/template file ${n} (attempt ${u})`),l=!0;break}catch(h){if(u===3)throw h;console.warn(`applyTemplate: Attempt ${u} to delete ${n} failed. Retrying after 100ms... Error:`,h),await new Promise(p=>setTimeout(p,100))}!l&&Gt&&console.warn(`applyTemplate: Failed to delete presumed old/template file ${n} after 3 attempts.`)}catch(o){o===null?console.warn(`applyTemplate: Deletion of ${n} ultimately failed with a 'null' error (even after retries).`):(console.warn(`applyTemplate: Error deleting presumed old/template file ${n} (even after retries):`,o),o instanceof Error?console.warn(`Details: Name: ${o.name}, Message: ${o.message}, Stack: ${o.stack}`):console.warn(`applyTemplate: Caught error is not an instance of Error. Type: ${typeof o}, Value: ${JSON.stringify(o)}`))}}}}}catch(c){console.error("Error during selective file cleanup from wasmStore:",c)}try{await $l(t)}catch(c){console.error("Error loading media for template:",c)}try{hn()}catch(c){console.error("Error updating media preview:",c)}if(r){let c=document.querySelector(".welcome-content");c&&c.classList.remove("visible"),await Bl(),br()}console.log("applyTemplate: Restoring current user-loaded media items to wasmStore after template application...");for(let c of be)try{if(we){let f=s(c.file.name);if(!f)continue;if(await we.doesFileExist(f))Gt&&console.log(`applyTemplate: User-loaded file ${f} already present in wasmStore.`);else if(Gt&&console.log(`applyTemplate: Restoring ${f} to wasmStore.`),await we.addFileIfNeeded(f,c.file),St(c.file.name)){console.log(`applyTemplate: Re-running OCR for restored image ${f}`);let d=await c.file.arrayBuffer();await Vn(d,f)}}else{console.warn("applyTemplate: wasmStore not available for restoring user media.");break}}catch(f){console.error(`applyTemplate: Error restoring user-loaded file ${c.file.name} to wasmStore:`,f)}}catch(c){c instanceof Error?console.error("Error applying template:",c,c.stack):console.error("Error applying template:",c);let f=c instanceof Error?c.message:String(c);throw c instanceof Error?c:new Error(`Error applying template: ${f}`)}finally{await Et()}};window.insertTemplate=async t=>{if(!tl(fn)){console.warn("Template selection is unavailable while media is being processed.");return}let e=document.getElementById("chat-message"),r={animate:"Create an animated video from these images with smooth transitions and effects.",tutorial:"Create a step-by-step tutorial video from these screenshots.",presentation:"Convert these slides into an engaging video presentation.",social:"Create an attention-grabbing social media video from this content.",focus:"Draw attention to main call-to-action in the screenshot."};e.value=r[t]??"",e.focus();let c={animate:Dt.IMAGE,social:Dt.SOCIAL,focus:Dt.FOCUS,tutorial:Dt.DEFAULT,presentation:Dt.DEFAULT}[t];if(c)try{console.log(`Attempting to load template: ${c}`);let f=await Mi(c);if(!f){console.error(`Template data is null or undefined for ${c}`),alert(`Error loading template ${c}: Template data is missing.`);return}console.log(`Successfully fetched template: ${c}, applying...`),await Wl(f,c,!1),console.log("Template applied, activating storyboard bot...");let i=document.getElementById("bot-0-btn");window.setActive(i,bt)}catch(f){let i=f instanceof Error?f.message:String(f);console.error(`Error switching to ${c} template:`,f,f instanceof Error?f.stack:""),alert(`Failed to switch to template: ${i}`)}else console.warn(`No template mapping found for type: ${t}`)};document.getElementById("save-session-button").onclick=async()=>{await Rt();try{let t=[];for(let l=0;l<Wt.length;l++){let u=parseFloat(document.getElementById(`bot${l}-temp`).value),h=parseFloat(document.getElementById(`bot${l}-top-p`).value),p=localStorage.getItem(`bot${l}-system-message`),g=tt[l].getHistoryForStorage();t.push({temperature:u,topP:h,systemMessage:p,chatHistory:g})}
2110let e="0.0.4",r=Ke.getValue(),s=qh(),c=JSON.parse(s),f=localStorage.getItem("voice-selection"),i=localStorage.getItem("media-allow-list"),d={version:e,bots:t,luaScript:r,loadedMedia:c,voiceSelection:f,mediaAllowList:i},n={suggestedName:`${new Date().toISOString()}-session.lumaChat`,types:[{description:"Luma Chat Session",accept:{"application/json":[".lumaChat"]}}]},a=await(await window.showSaveFilePicker(n)).createWritable();await a.write(JSON.stringify(d,null,2)),await a.close()}catch(t){console.error("Error saving session:",t),alert("Failed to save session. Please try again.")}finally{await Et()}};document.getElementById("swap-template-button").onclick=async()=>{let e=(localStorage.getItem("current-template")??Dt.DEFAULT)===Dt.DEFAULT?Dt.IMAGE:Dt.DEFAULT;try{let r=await Mi(e);await Wl(r,e,!0)}catch(r){console.error("Error swapping template:",r),alert(`Failed to switch to ${e} template.`)}};document.getElementById("load-session-button").onclick=()=>{let t=document.createElement("input");t.type="file",t.accept=".lumaChat",t.onchange=async()=>{if(t.files?.length&&confirm("Loading a session will overwrite your current chat history, system messages, and settings. Continue?")){await Rt();try{let r=await t.files[0].text(),s=Cc(r);Hl(s),await Wl(s,Dt.DEFAULT,!0)}catch(e){console.error("Error loading session:",e),alert("Failed to load session. Please check the file and try again.")}finally{await Et()}}},t.click()};document.getElementById("download-trec-metadata-button").onclick=async()=>{let t=localStorage.getItem("lastTranscriptionGUID");if(!t){alert("No TREC transcription found.");return}let e=localStorage.getItem(`trec_transcript_${t}`);if(!e){alert("No TREC metadata found for the last transcription.");return}try{let r=JSON.parse(e),s=await Promise.all(r.map(async a=>{let l=null;if(a.imageFileName)try{let u=await cr(a.imageFileName);if(u){let h=gx(u),p=mx(h,a.sceneEndingCursorCoords,a.imageSize);l={words:vx(p)}}}catch(u){console.warn(`Failed to get OCR data for ${a.imageFileName}:`,u)}return{cursorCoords:a.sceneEndingCursorCoords,imageSize:a.imageSize,startTimeS:a.sceneStartTimeSeconds,endTimeS:a.sceneEndTimeSeconds,transcript:a.transcript,mouseAction:a.interactionType,ocrNearCursor:l}})),c=localStorage.getItem(`trec_source_filename_${t}`),f="trec-metadata.json";c&&(f=c.toLowerCase().endsWith(".trec")?`${c.slice(0,-Vp)}.json`:`${c}.json`);let i=JSON.stringify(s,null,2),d=new Blob([i],{type:"application/json"}),n=URL.createObjectURL(d),o=document.createElement("a");o.href=n,o.download=f,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}catch(r){console.error("Error generating enhanced TREC download:",r),alert("Failed to generate enhanced TREC metadata. See console for details.")}};document.getElementById("download-storyboard-json-button")?.addEventListener("click",()=>{if(!nt?.getScenes().length)return;let t=Si();if(!t){alert("No TREC metadata found for this storyboard.");return}try{nt.applySceneEditsFromDOM();
2110let e=kp(nt.getScenes(),t),r=localStorage.getItem("lastTranscriptionGUID"),s=t.sourceFileName??(r?localStorage.getItem(`trec_source_filename_${r}`):null),f=`${(s?.toLowerCase().endsWith(".trec")?s.slice(0,-Vp):s)||"trec"}-storyboard.json`,i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),d=URL.createObjectURL(i),n=document.createElement("a");n.href=d,n.download=f,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(d)}catch(e){console.error("Error generating storyboard JSON download:",e),alert(e instanceof Error?e.message:"Failed to generate storyboard JSON.")}});document.getElementById("toggle-trec-up-actions-button")?.addEventListener("click",()=>{let t=!Yp();localStorage.setItem(Gp,t.toString()),Zp()});document.getElementById("toggle-experimental-model-button")?.addEventListener("click",()=>{localStorage.setItem(Uo,(!yi()).toString()),Xp()});document.getElementById("reset-storyboard-prompt-button")?.addEventListener("click",()=>{Rp(localStorage,parseInt(bt,10)),alert("Storyboard system prompt and chat history cleared. Reloading the latest template prompt."),location.reload()});document.getElementById("resend-storyboard-button")?.addEventListener("click",()=>{if(!Si()){alert("No TREC has been imported this session. Import a TREC first, then use Resend to iterate.");return}let t=document.getElementById("chat-message");t&&t.value.trim()===""&&(t.value="Create the storyboard for this recording.");let e=document.getElementById("bot-select");e&&(e.value=bt),Dl()});var Up=async t=>we?await we.getFileSize(t)>0:!1,Zx=async()=>{let t=localStorage.getItem(Kp);if(!(!t||t.trim()===""||be.length===0)&&!(!we||!window.project))try{for(let c of be)await we.addFileIfNeeded(c.file.name,c.file);let e=localStorage.getItem(wi);if(e){let c=JSON.parse(e);for(let f of c){if(await we.doesFileExist(f))continue;let i=await Ie.getImage(f).catch(()=>null);i&&await we.addFileIfNeeded(f,i)}}for(let c of ir)if(!await Up(c))try{let f=await fetch(`/static/${c}`);if(f.ok){let i=await f.blob();i.size>0&&await we.addFileIfNeeded(c,i,!0)}}catch(f){console.warn(`restoreGeneratedVideo: failed to fetch default media ${c}:`,f)}let r=[...be.map(c=>c.file.name),...ir],s=localStorage.getItem(wi);s&&r.push(...JSON.parse(s));for(let c of r)if(!await Up(c)){console.warn(`restoreGeneratedVideo: skipping replay, missing/empty media in OPFS: ${c}`);return}Ke.setValue(t),Pr()}catch(e){console.error("restoreGeneratedVideo: failed to rebuild the video on load:",e)}};(async()=>
2110{await Rt(nx),Gt=new URLSearchParams(window.location.search).has("debug"),document.body.setAttribute("data-debug",Gt.toString()),Gt||(localStorage.removeItem(Uo),localStorage.removeItem(Wo)),Zp(),Xp(),ux(),Gt||(document.getElementById("generate-voiceover").classList.add("hidden"),document.getElementById("toggle-settings-button").classList.add("hidden"),document.getElementById("toggle-lua-area-button").classList.add("hidden"),document.getElementById("toggle-library-button").classList.add("hidden"),document.getElementById("bot-0-btn").classList.add("hidden"),document.getElementById("bot-1-btn").classList.add("hidden"),document.getElementById("toggle-timeline-button").classList.add("hidden"));try{document.readyState==="loading"&&await new Promise(d=>document.addEventListener("DOMContentLoaded",d));let e=document.getElementById("bot-select"),r=document.getElementById("bot-0-btn");e&&r&&window.setActive(r,bt),await Oh(),En({title:"Restoring your workspace",status:"Reloading your media and saved project details\u2026",placement:"startup"}),await ft.initialize().catch(console.warn),await Rx(),Ix();let s=localStorage.getItem("current-template")??Dt.DEFAULT;rg(s),nt=new Ci,qp();let c=localStorage.getItem("timelineScenes");if(c)try{let d=JSON.parse(c),n=Pl(d);localStorage.setItem("timelineScenes",JSON.stringify(n)),nt.setScenes(n),ki()}catch(d){console.error("Error restoring timeline scenes:",d)}En({title:"Finishing setup",status:"Preparing your saved scenes and preview\u2026",placement:"startup"}),await Zx();let f=document.getElementById("voice-select");Lx(f),br();let i=document.querySelector(".media-thumbnails");i&&new MutationObserver(()=>{br()}).observe(i,{childList:!0})}catch(e){console.error("Error during initialization:",e),alert("Failed to initialize application. Please refresh the page.")}finally{await Et()}})();document.addEventListener("keydown",t=>{if(t.ctrlKey&&t.key==="L"){t.preventDefault();let e=document.getElementById("toggle-lua-area-button"),s=document.getElementById("lua-section")?.classList.contains("hidden")&&e;e?.click(),s&&Ke.focus()}});document.addEventListener("DOMContentLoaded",async()=>{await eg(),qp();let t=document.getElementById("send-chat-button"),e=document.getElementById("how-to-handle-chat-history");t&&t.classList.add("lua-bot-only"),e&&e.classList.add("lua-bot-only");let r=localStorage.getItem("bot-number")??bt,s=document.getElementById(`bot-${r}-btn`);s&&window.setActive(s,r),Cx(),await ef(),jx(),Fr();let c=document.querySelector(".export-dropdown");document.getElementById("export-dropdown-button").addEventListener("click",g=>{g.stopPropagation(),c.classList.toggle("active")}),document.addEventListener("click",g=>{c.contains(g.target)||c.classList.remove("active")}),Kx();let i=document.querySelector(".menu-dropdown"),d=document.getElementById("menu-dropdown-button");d.hasAttribute("tabindex")||d.setAttribute("tabindex","0"),d.setAttribute("aria-haspopup","true"),d.setAttribute("aria-expanded","false"),d.setAttribute("aria-label","Main menu - settings, tools, and options"),d.addEventListener("click",g=>{g.stopPropagation();let m=i.classList.toggle("active");if(d.setAttribute("aria-expanded",m.toString()),m){let y=i.querySelector(".dropdown-panel button");y&&setTimeout(()=>
2110y.focus(),0)}}),d.addEventListener("keydown",g=>{let m=g;if(m.key==="Enter"||m.key===" "){g.preventDefault(),g.stopPropagation();let y=i.classList.toggle("active");if(d.setAttribute("aria-expanded",y.toString()),y){let b=i.querySelector(".dropdown-panel button");b&&setTimeout(()=>b.focus(),0)}}}),i.addEventListener("keydown",g=>{let m=g;if(i.classList.contains("active"))switch(m.key){case"Escape":g.preventDefault(),i.classList.remove("active"),d.setAttribute("aria-expanded","false"),d.focus();break;case"Enter":case" ":document.activeElement instanceof HTMLElement&&(g.preventDefault(),document.activeElement.click(),i.classList.remove("active"));break}}),document.addEventListener("click",g=>{!i.contains(g.target)&&g.isTrusted&&(i.classList.remove("active"),d.setAttribute("aria-expanded","false"))});let n=document.getElementById("modern-send-button");n&&n.addEventListener("click",()=>{let g=document.getElementById("send-chat-button");g&&g.click()});let o=document.getElementById("new-add-button"),a=o?.closest(".add-menu-dropdown");o&&a&&(o.hasAttribute("tabindex")||o.setAttribute("tabindex","0"),o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label","Add content - upload images or view library"),o.addEventListener("click",g=>{g.stopPropagation();let m=a.querySelector(".dropdown-panel");if(!a.classList.contains("active")){m.style.visibility="hidden",m.style.display="flex";let b=m.offsetHeight;m.style.display="",m.style.visibility="";let C=o.getBoundingClientRect(),E=window.innerHeight-C.bottom,w=C.top;E<b&&w>b?a.classList.add("open-upward"):a.classList.remove("open-upward")}a.classList.toggle("active");let y=a.classList.contains("active");if(o.setAttribute("aria-expanded",y.toString()),y){let b=a.querySelector(".dropdown-panel button");b&&setTimeout(()=>b.focus(),0)}}),o.addEventListener("keydown",g=>{let m=g;if(m.key==="Enter"||m.key===" "){g.preventDefault(),g.stopPropagation();let y=a.querySelector(".dropdown-panel");if(!a.classList.contains("active")){y.style.visibility="hidden",y.style.display="flex";let C=y.offsetHeight;y.style.display="",y.style.visibility="";let E=o.getBoundingClientRect(),w=window.innerHeight-E.bottom,k=E.top;w<C&&k>C?a.classList.add("open-upward"):a.classList.remove("open-upward")}a.classList.toggle("active");let b=a.classList.contains("active");if(o.setAttribute("aria-expanded",b.toString()),b){let C=a.querySelector(".dropdown-panel button");C&&setTimeout(()=>C.focus(),0)}}}),a.addEventListener("keydown",g=>{let m=g;if(a.classList.contains("active"))switch(m.key){case"Escape":g.preventDefault(),a.classList.remove("active"),o.setAttribute("aria-expanded","false"),o.focus();break;case"Enter":case" ":document.activeElement instanceof HTMLElement&&(g.preventDefault(),document.activeElement.click(),a.classList.remove("active"));break}}),document.addEventListener("click",g=>{!a.contains(g.target)&&g.isTrusted&&(a.classList.remove("active"),o.setAttribute("aria-expanded","false"))}));let l=document.getElementById("add-screenshots-from-disk-button");l&&l.addEventListener("click",()=>{let g=document.querySelector(".hidden-file-input");g?(g.click(),a?.classList.remove("active")):console.error("File input element not found")});let u=document.getElementById("view-library-from-menu-button");u&&u.addEventListener("click",()=>{let g=document.querySelector(".snagit-library-button");g?(g.click(),a?.classList.remove("active")):console.error("Snagit library button not found")});let h=document.getElementById("chat-message");h&&(h.addEventListener("input",async()=>
2110{Ll(h),await mr(),Fr();let g=h.value;lx(g)}),Ll(h));let p=document.getElementById("new-prompt-box");if(p){let g=()=>{p.classList.remove("drag-over-box")};p.addEventListener("dragenter",m=>{m.preventDefault(),m.stopPropagation();let y=m.dataTransfer&&Array.from(m.dataTransfer.types).includes("Files"),C=m.target.closest(".media-thumbnails");y&&!C?p.classList.add("drag-over-box"):p.classList.remove("drag-over-box")}),p.addEventListener("dragover",m=>{m.preventDefault(),m.stopPropagation();let y=m.dataTransfer&&Array.from(m.dataTransfer.types).includes("Files"),C=m.target.closest(".media-thumbnails");y&&!C?(p.classList.add("drag-over-box"),m.dataTransfer&&(m.dataTransfer.dropEffect="copy")):(p.classList.remove("drag-over-box"),y&&C&&m.dataTransfer&&(m.dataTransfer.dropEffect="none"))}),p.addEventListener("dragleave",m=>{m.preventDefault(),m.stopPropagation();let y=p.getBoundingClientRect();(m.clientX<=y.left||m.clientX>=y.right||m.clientY<=y.top||m.clientY>=y.bottom)&&p.classList.remove("drag-over-box")}),p.addEventListener("drop",g,{capture:!0}),p.addEventListener("drop",async m=>{m.preventDefault(),m.stopPropagation();let y=!!m.dataTransfer?.files?.length,C=m.target.closest(".media-thumbnails");if(y&&!C&&m.dataTransfer){await Rt(zp(m.dataTransfer.files.length));
2110try{await Ho(m.dataTransfer.files),await mr(),Fr()}catch(E){console.error("Error loading dropped files:",E),alert("Error processing dropped files.")}finally{await Et()}}})}});})();
2111/*! Bundled license information:
2112
2113ace-builds/src-noconflict/ace.js:
2114  (*
2115  * based on code from:
2116  *
2117  * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2118  * Available via the MIT or new BSD license.
2119  * see: http://github.com/jrburke/requirejs for details
2120  *)
2121*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.