var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__publicField=(e,t,i)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,i),i);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("monaco-editor")):"function"==typeof define&&define.amd?define(["exports","monaco-editor"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MarsgisEditor={},e.monaco)}(this,(function(e,t){"use strict";function i(e){if(e&&e.__esModule)return e;var t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return e&&Object.keys(e).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var n=i(t);const r=class{static setConfig(e){r.apiConf=e,r.sessionName=e.packageName+"-homepage-config"}static getConfig(){return r.apiConf}static getPackageName(){return r.apiConf.packageName}static getExampleList(){if("online"===r.apiConf.configFetchType)return r.fetchExampleList();try{const e=JSON.parse(sessionStorage.getItem(r.sessionName)||"");if(e)return r.saveCompConfig(e),Promise.resolve(e);throw new Error("无缓存数据")}catch(e){return r.fetchExampleList()}}static async fetchExampleList(){const e=await fetch(r.apiConf.configSourceUrl),t=await e.json();return r.saveCompConfig(t),"local"===r.apiConf.configFetchType&&sessionStorage.setItem(r.sessionName,JSON.stringify(t)),t}static async getCompConfig(e){try{const t=r.mars3dExampleConfig;if(t)return t[e];throw new Error("无缓存数据")}catch(t){return await r.getExampleList(),r.getCompConfig(e)}}static saveCompConfig(e){const t={};r.totalCount=0,e.forEach(((e,i)=>{e.id=`ex_${i}`,e.children&&(e.count=0,e.children.forEach(((i,n)=>{i.id=`${e.id}_${n}`,i.children&&(i.count=i.children.length,i.children.forEach(((n,s)=>{e.count++,n.id=`${i.id}_${s}`,n.fullName=`${e.name} - ${i.name} - ${n.name}`,n.thumbnail=`${r.apiConf.thumbnailPublicPath||"/"}${n.thumbnail||"thumbnail.jpg"}`,t[n.main]=n,n.hidden||r.totalCount++})))})))})),r.mars3dExampleConfig=t}static getResourcesByLibs(e){e&&0!==e.length||(e=[r.apiConf.packageName]);let t=[];const i={};for(let n=0,s=e.length;ne.startsWith("http")||e.startsWith("//:")?e:r.apiConf.libPublicPath+e))))}return t}static getLibs(e,t=[],i=[]){return r.getResourcesByLibs(t).concat(i).map((t=>{let i=t;return t.startsWith(".")||t.startsWith("http")||t.startsWith("//:")?i=t:t.startsWith("/")?"/"!==r.apiConf.baseUrl&&(i=r.apiConf.baseUrl+t):i=`${r.apiConf.resourcePublicPath}/${e}/${t}`,{name:i,url:i}}))}static getQueryString(e){return new URL(window.location.href).searchParams.get(e)}static LoadSource(e){const t=i=>{if(e.length){const n=e.shift();let s;s=n.endsWith(".css")?r.loadLink(n):r.loadScript(n),s.then((()=>{t(i)}))}else i(!0)};return new Promise((e=>{t(e)}))}static loadScript(e,t=!0){const i=document.createElement("script");return i.async=t,i.src=e,document.body.appendChild(i),new Promise((e=>{i.onload=()=>{e(!0)}}))}static loadLink(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,document.head.appendChild(t),new Promise((e=>{t.onload=()=>{e(!0)}}))}static scriptFilter(e){return e=(e=(e=e.replace(/const /gm,"var ")).replace(/let /gm,"var ")).replace(/export /gm,""),e=(e="mars3d"===r.apiConf.packageName?(e=e.replace('import * as mars3d from "mars3d"',"")).replace("const Cesium = mars3d.Cesium",""):(e=e.replace('import * as mars2d from "mars2d"',"")).replace("const L = mars3d.L","")).replace(/import /gm,"// import ")}};let s=r;function a(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})})),t}__publicField(s,"apiConf"),__publicField(s,"sessionName"),__publicField(s,"totalCount",0),__publicField(s,"mars3dExampleConfig");var o={},c=a(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),l={};!function(e){var t=/[|\\{}()[\]^$+*?.]/g;e.escapeRegExpChars=function(e){return e?String(e).replace(t,"\\$&"):""};var i={"&":"&","<":"<",">":">",'"':""","'":"'"},n=/[&<>'"]/g;function r(e){return i[e]||e}e.escapeXML=function(e){return null==e?"":String(e).replace(n,r)},e.escapeXML.toString=function(){return Function.prototype.toString.call(this)+';\nvar _ENCODE_HTML_RULES = {\n "&": "&"\n , "<": "<"\n , ">": ">"\n , \'"\': """\n , "\'": "'"\n }\n , _MATCH_HTML = /[&<>\'"]/g;\nfunction encode_char(c) {\n return _ENCODE_HTML_RULES[c] || c;\n};\n'},e.shallowCopy=function(e,t){if(t=t||{},null!=e)for(var i in t)e[i]=t[i];return e},e.shallowCopyFromList=function(e,t,i){if(i=i||[],t=t||{},null!=e)for(var n=0;n * @author Tiancheng "Timothy" Gu * @project EJS * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} */ var t=c,i=c,n=l,r=!1,s=A,a="locals",o=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],d=o.concat("cache"),u=/^\uFEFF/,m=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;function p(i,n){var r;if(n.some((function(n){return r=e.resolveInclude(i,n,!0),t.existsSync(r)})))return r}function g(t,i){var n,r=t.filename,s=arguments.length>1;if(t.cache){if(!r)throw new Error("cache option requires a filename");if(n=e.cache.get(r))return n;s||(i=I(r).toString().replace(u,""))}else if(!s){if(!r)throw new Error("Internal EJS error: no file name or template provided");i=I(r).toString().replace(u,"")}return n=e.compile(i,t),t.cache&&e.cache.set(r,n),n}function h(t,i,n){var r;if(!n){if("function"==typeof e.promiseImpl)return new e.promiseImpl((function(e,n){try{e(r=g(t)(i))}catch(s){n(s)}}));throw new Error("Please provide a callback function")}try{r=g(t)(i)}catch(s){return n(s)}n(null,r)}function I(t){return e.fileLoader(t)}function f(i,r){var s=n.shallowCopy(n.createNullProtoObjWherePossible(),r);if(s.filename=function(i,n){var r,s,a=n.views,o=/^[A-Za-z]+:\\|^\//.exec(i);if(o&&o.length)i=i.replace(/^\/*/,""),r=Array.isArray(n.root)?p(i,n.root):e.resolveInclude(i,n.root||"/",!0);else if(n.filename&&(s=e.resolveInclude(i,n.filename),t.existsSync(s)&&(r=s)),!r&&Array.isArray(a)&&(r=p(i,a)),!r&&"function"!=typeof n.includer)throw new Error('Could not find the include file "'+n.escapeFunction(i)+'"');return r}(i,s),"function"==typeof r.includer){var a=r.includer(i,s.filename);if(a&&(a.filename&&(s.filename=a.filename),a.template))return g(s,a.template)}return g(s)}function M(e,t,i,n,r){var s=t.split("\n"),a=Math.max(n-3,0),o=Math.min(s.length,n+3),c=r(i),l=s.slice(a,o).map((function(e,t){var i=t+a+1;return(i==n?" >> ":" ")+i+"| "+e})).join("\n");throw e.path=c,e.message=(c||"ejs")+":"+n+"\n"+l+"\n\n"+e.message,e}function y(e){return e.replace(/;(\s*$)/,"$1")}function S(t,i){i=i||n.createNullProtoObjWherePossible();var r=n.createNullProtoObjWherePossible();this.templateText=t,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",r.client=i.client||!1,r.escapeFunction=i.escape||i.escapeFunction||n.escapeXML,r.compileDebug=!1!==i.compileDebug,r.debug=!!i.debug,r.filename=i.filename,r.openDelimiter=i.openDelimiter||e.openDelimiter||"<",r.closeDelimiter=i.closeDelimiter||e.closeDelimiter||">",r.delimiter=i.delimiter||e.delimiter||"%",r.strict=i.strict||!1,r.context=i.context,r.cache=i.cache||!1,r.rmWhitespace=i.rmWhitespace,r.root=i.root,r.includer=i.includer,r.outputFunctionName=i.outputFunctionName,r.localsName=i.localsName||e.localsName||a,r.views=i.views,r.async=i.async,r.destructuredLocals=i.destructuredLocals,r.legacyInclude=void 0===i.legacyInclude||!!i.legacyInclude,r.strict?r._with=!1:r._with=void 0===i._with||i._with,this.opts=r,this.regex=this.createRegex()}e.cache=n.cache,e.fileLoader=t.readFileSync,e.localsName=a,e.promiseImpl=new Function("return this;")().Promise,e.resolveInclude=function(e,t,n){var r=i.dirname,s=i.extname,a=(0,i.resolve)(n?t:r(t),e);return s(e)||(a+=".ejs"),a},e.compile=function(e,t){return t&&t.scope&&(r||(console.warn("`scope` option is deprecated and will be removed in EJS 3"),r=!0),t.context||(t.context=t.scope),delete t.scope),new S(e,t).compile()},e.render=function(e,t,i){var r=t||n.createNullProtoObjWherePossible(),s=i||n.createNullProtoObjWherePossible();return 2==arguments.length&&n.shallowCopyFromList(s,r,o),g(s,e)(r)},e.renderFile=function(){var e,t,i,r=Array.prototype.slice.call(arguments),s=r.shift(),a={filename:s};return"function"==typeof arguments[arguments.length-1]&&(e=r.pop()),r.length?(t=r.shift(),r.length?n.shallowCopy(a,r.pop()):(t.settings&&(t.settings.views&&(a.views=t.settings.views),t.settings["view cache"]&&(a.cache=!0),(i=t.settings["view options"])&&n.shallowCopy(a,i)),n.shallowCopyFromList(a,t,d)),a.filename=s):t=n.createNullProtoObjWherePossible(),h(a,t,e)},e.Template=S,e.clearCache=function(){e.cache.reset()},S.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"},S.prototype={createRegex:function(){var e="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",t=n.escapeRegExpChars(this.opts.delimiter),i=n.escapeRegExpChars(this.opts.openDelimiter),r=n.escapeRegExpChars(this.opts.closeDelimiter);return e=e.replace(/%/g,t).replace(//g,r),new RegExp(e)},compile:function(){var e,t,r,s=this.opts,a="",o="",c=s.escapeFunction,l=s.filename?JSON.stringify(s.filename):"undefined";if(!this.source){if(this.generateSource(),a+=' var __output = "";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n',s.outputFunctionName){if(!m.test(s.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");a+=" var "+s.outputFunctionName+" = __append;\n"}if(s.localsName&&!m.test(s.localsName))throw new Error("localsName is not a valid JS identifier.");if(s.destructuredLocals&&s.destructuredLocals.length){for(var A=" var __locals = ("+s.localsName+" || {}),\n",d=0;d0&&(A+=",\n "),A+=u+" = __locals."+u}a+=A+";\n"}!1!==s._with&&(a+=" with ("+s.localsName+" || {}) {\n",o+=" }\n"),o+=" return __output;\n",this.source=a+this.source+o}e=s.compileDebug?"var __line = 1\n , __lines = "+JSON.stringify(this.templateText)+"\n , __filename = "+l+";\ntry {\n"+this.source+"} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n":this.source,s.client&&(e="escapeFn = escapeFn || "+c.toString()+";\n"+e,s.compileDebug&&(e="rethrow = rethrow || "+M.toString()+";\n"+e)),s.strict&&(e='"use strict";\n'+e),s.debug&&console.log(e),s.compileDebug&&s.filename&&(e=e+"\n//# sourceURL="+l+"\n");try{if(s.async)try{r=new Function("return (async function(){}).constructor;")()}catch(I){throw I instanceof SyntaxError?new Error("This environment does not support async/await"):I}else r=Function;t=new r(s.localsName+", escapeFn, include, rethrow",e)}catch(I){throw I instanceof SyntaxError&&(s.filename&&(I.message+=" in "+s.filename),I.message+=" while compiling ejs\n\n",I.message+="If the above error is not helpful, you may want to try EJS-Lint:\n",I.message+="https://github.com/RyanZim/EJS-Lint",s.async||(I.message+="\n",I.message+="Or, if you meant to create an async function, pass `async: true` as an option.")),I}var p=s.client?t:function(e){return t.apply(s.context,[e||n.createNullProtoObjWherePossible(),c,function(t,i){var r=n.shallowCopy(n.createNullProtoObjWherePossible(),e);return i&&(r=n.shallowCopy(r,i)),f(t,s)(r)},M])};if(s.filename&&"function"==typeof Object.defineProperty){var g=s.filename,h=i.basename(g,i.extname(g));try{Object.defineProperty(p,"name",{value:h,writable:!1,enumerable:!1,configurable:!0})}catch(I){}}return p},generateSource:function(){this.opts.rmWhitespace&&(this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var e=this,t=this.parseTemplateText(),i=this.opts.delimiter,n=this.opts.openDelimiter,r=this.opts.closeDelimiter;t&&t.length&&t.forEach((function(s,a){var o;if(0===s.indexOf(n+i)&&0!==s.indexOf(n+i+i)&&(o=t[a+2])!=i+r&&o!="-"+i+r&&o!="_"+i+r)throw new Error('Could not find matching close tag for "'+s+'".');e.scanLine(s)}))},parseTemplateText:function(){for(var e,t=this.templateText,i=this.regex,n=i.exec(t),r=[];n;)0!==(e=n.index)&&(r.push(t.substring(0,e)),t=t.slice(e)),r.push(n[0]),t=t.slice(n[0].length),n=i.exec(t);return t&&r.push(t),r},_addOutput:function(e){if(this.truncate&&(e=e.replace(/^(?:\r\n|\r|\n)/,""),this.truncate=!1),!e)return e;e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/"/g,'\\"'),this.source+=' ; __append("'+e+'")\n'},scanLine:function(e){var t,i=this.opts.delimiter,n=this.opts.openDelimiter,r=this.opts.closeDelimiter;switch(t=e.split("\n").length-1,e){case n+i:case n+i+"_":this.mode=S.modes.EVAL;break;case n+i+"=":this.mode=S.modes.ESCAPED;break;case n+i+"-":this.mode=S.modes.RAW;break;case n+i+"#":this.mode=S.modes.COMMENT;break;case n+i+i:this.mode=S.modes.LITERAL,this.source+=' ; __append("'+e.replace(n+i+i,n+i)+'")\n';break;case i+i+r:this.mode=S.modes.LITERAL,this.source+=' ; __append("'+e.replace(i+i+r,i+r)+'")\n';break;case i+r:case"-"+i+r:case"_"+i+r:this.mode==S.modes.LITERAL&&this._addOutput(e),this.mode=null,this.truncate=0===e.indexOf("-")||0===e.indexOf("_");break;default:if(this.mode){switch(this.mode){case S.modes.EVAL:case S.modes.ESCAPED:case S.modes.RAW:e.lastIndexOf("//")>e.lastIndexOf("\n")&&(e+="\n")}switch(this.mode){case S.modes.EVAL:this.source+=" ; "+e+"\n";break;case S.modes.ESCAPED:this.source+=" ; __append(escapeFn("+y(e)+"))\n";break;case S.modes.RAW:this.source+=" ; __append("+y(e)+")\n";break;case S.modes.COMMENT:break;case S.modes.LITERAL:this._addOutput(e)}}else this._addOutput(e)}this.opts.compileDebug&&t&&(this.currentLine+=t,this.source+=" ; __line = "+this.currentLine+"\n")}},e.escapeXML=n.escapeXML,e.__express=e.renderFile,e.VERSION=s,e.name="ejs","undefined"!=typeof window&&(window.ejs=e)}(o);var d="undefined"!=typeof window?window:null,u=null===d,m=u?void 0:d.document,p="horizontal",g=function(){return!1},h=u?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=m.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",I=function(e){return"string"==typeof e||e instanceof String},f=function(e){if(I(e)){var t=m.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},M=function(e,t,i){var n=e[t];return void 0!==n?n:i},y=function(e,t,i,n){if(t){if("end"===n)return 0;if("center"===n)return e/2}else if(i){if("start"===n)return 0;if("center"===n)return e/2}return e},S=function(e,t){var i=m.createElement("div");return i.className="gutter gutter-"+t,i},b=function(e,t,i){var n={};return I(t)?n[e]=t:n[e]=h+"("+t+"% - "+i+"px)",n},v=function(e,t){var i;return(i={})[e]=t+"px",i},D=function(e,t){if(void 0===t&&(t={}),u)return{};var i,n,r,s,a,o,c=e;Array.from&&(c=Array.from(c));var l=f(c[0]).parentNode,A=getComputedStyle?getComputedStyle(l):null,h=A?A.flexDirection:null,I=M(t,"sizes")||c.map((function(){return 100/c.length})),D=M(t,"minSize",100),w=Array.isArray(D)?D:c.map((function(){return D})),C=M(t,"maxSize",1/0),N=Array.isArray(C)?C:c.map((function(){return C})),E=M(t,"expandToMin",!1),k=M(t,"gutterSize",10),j=M(t,"gutterAlign","center"),x=M(t,"snapOffset",30),z=Array.isArray(x)?x:c.map((function(){return x})),L=M(t,"dragInterval",1),P=M(t,"direction",p),T=M(t,"cursor",P===p?"col-resize":"row-resize"),Q=M(t,"gutter",S),B=M(t,"elementStyle",b),Z=M(t,"gutterStyle",v);function J(e,t,n,r){var s=B(i,t,n,r);Object.keys(s).forEach((function(t){e.style[t]=s[t]}))}function O(){return o.map((function(e){return e.size}))}function Y(e){return"touches"in e?e.touches[0][n]:e[n]}function F(e){var t=o[this.a],i=o[this.b],n=t.size+i.size;t.size=e/this.size*n,i.size=n-e/this.size*n,J(t.element,t.size,this._b,t.i),J(i.element,i.size,this._c,i.i)}function V(e){var i,n=o[this.a],r=o[this.b];this.dragging&&(i=Y(e)-this.start+(this._b-this.dragOffset),L>1&&(i=Math.round(i/L)*L),i<=n.minSize+n.snapOffset+this._b?i=n.minSize+this._b:i>=this.size-(r.minSize+r.snapOffset+this._c)&&(i=this.size-(r.minSize+this._c)),i>=n.maxSize-n.snapOffset+this._b?i=n.maxSize+this._b:i<=this.size-(r.maxSize-r.snapOffset+this._c)&&(i=this.size-(r.maxSize+this._c)),F.call(this,i),M(t,"onDrag",g)(O()))}function R(){var e=o[this.a].element,t=o[this.b].element,n=e.getBoundingClientRect(),a=t.getBoundingClientRect();this.size=n[i]+a[i]+this._b+this._c,this.start=n[r],this.end=n[s]}function U(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var i=e[a];return 0===i?null:i-=P===p?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(l);if(null===t)return e;if(w.reduce((function(e,t){return e+t}),0)>t)return e;var i=0,n=[],r=e.map((function(r,s){var a=t*r/100,o=y(k,0===s,s===e.length-1,j),c=w[s]+o;return a0&&n[r]-i>0){var a=Math.min(i,n[r]-i);i-=a,s=e-a}return s/t*100}))}function W(){var e=this,i=o[e.a].element,n=o[e.b].element;e.dragging&&M(t,"onDragEnd",g)(O()),e.dragging=!1,d.removeEventListener("mouseup",e.stop),d.removeEventListener("touchend",e.stop),d.removeEventListener("touchcancel",e.stop),d.removeEventListener("mousemove",e.move),d.removeEventListener("touchmove",e.move),e.stop=null,e.move=null,i.removeEventListener("selectstart",g),i.removeEventListener("dragstart",g),n.removeEventListener("selectstart",g),n.removeEventListener("dragstart",g),i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",m.body.style.cursor=""}function H(e){if(!("button"in e)||0===e.button){var i=this,n=o[i.a].element,r=o[i.b].element;i.dragging||M(t,"onDragStart",g)(O()),e.preventDefault(),i.dragging=!0,i.move=V.bind(i),i.stop=W.bind(i),d.addEventListener("mouseup",i.stop),d.addEventListener("touchend",i.stop),d.addEventListener("touchcancel",i.stop),d.addEventListener("mousemove",i.move),d.addEventListener("touchmove",i.move),n.addEventListener("selectstart",g),n.addEventListener("dragstart",g),r.addEventListener("selectstart",g),r.addEventListener("dragstart",g),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",i.gutter.style.cursor=T,i.parent.style.cursor=T,m.body.style.cursor=T,R.call(i),i.dragOffset=Y(e)-i.end}}P===p?(i="width",n="clientX",r="left",s="right",a="clientWidth"):"vertical"===P&&(i="height",n="clientY",r="top",s="bottom",a="clientHeight"),I=U(I);var G=[];function X(e){var t=e.i===G.length,i=t?G[e.i-1]:G[e.i];R.call(i);var n=t?i.size-e.minSize-i._c:e.minSize+i._b;F.call(i,n)}return(o=c.map((function(e,t){var n,r={element:f(e),size:I[t],minSize:w[t],maxSize:N[t],snapOffset:z[t],i:t};if(t>0&&((n={a:t-1,b:t,dragging:!1,direction:P,parent:l})._b=y(k,t-1==0,!1,j),n._c=y(k,!1,t===c.length-1,j),"row-reverse"===h||"column-reverse"===h)){var s=n.a;n.a=n.b,n.b=s}if(t>0){var a=Q(t,P,r.element);!function(e,t,n){var r=Z(i,t,n);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(a,k,t),n._a=H.bind(n),a.addEventListener("mousedown",n._a),a.addEventListener("touchstart",n._a),l.insertBefore(a,r.element),n.gutter=a}return J(r.element,r.size,y(k,0===t,t===c.length-1,j),t),t>0&&G.push(n),r}))).forEach((function(e){var t=e.element.getBoundingClientRect()[i];t0){var n=G[i-1],r=o[n.a],s=o[n.b];r.size=t[i-1],s.size=e,J(r.element,r.size,n._b,r.i),J(s.element,s.size,n._c,s.i)}}))},getSizes:O,collapse:function(e){X(o[e])},destroy:function(e,t){G.forEach((function(n){if(!0!==t?n.parent.removeChild(n.gutter):(n.gutter.removeEventListener("mousedown",n._a),n.gutter.removeEventListener("touchstart",n._a)),!0!==e){var r=B(i,n.a.size,n._b);Object.keys(r).forEach((function(e){o[n.a].element.style[e]="",o[n.b].element.style[e]=""}))}}))},parent:l,pairs:G}};class w{constructor(){__publicField(this,"_cache",{})}on(e,t){const i=this._cache[e]=this._cache[e]||[];return-1===i.indexOf(t)&&i.push(t),this}emit(e,...t){const i=this._cache[e];return Array.isArray(i)&&i.forEach((e=>{e(...t)})),this}off(e,t){const i=this._cache[e];if(Array.isArray(i))if(t){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}else i.length=0;return this}}class C extends w{constructor(e,t,i){super(),__publicField(this,"split"),__publicField(this,"leftId"),__publicField(this,"rightId"),this.leftId=e,this.rightId=t,this.split=D([`#${e}`,`#${t}`],{sizes:i?[35,65]:[0,100],minSize:[0,800],gutterSize:5,gutter(e,t){const n=document.createElement("div");return i||(n.style.display="none"),n.className=`gutter gutter-${t}`,n.id="split-gutter",n},onDrag:()=>{this.getSize(0)<5?this.collapse():(document.getElementById("split-gutter").style.display="block",this.emit("layout"))}}),i||(document.getElementById(this.rightId).style.width="100%")}getSize(e){return this.split.getSizes()[e]}expand(){this.split.setSizes([35,65]),document.getElementById("split-gutter").style.display="block",this.emit("layout")}collapse(){this.split.collapse(0),document.getElementById("split-gutter").style.display="none",document.getElementById(this.rightId).style.width="100%",this.emit("layout")}setLeft(e){const t=document.getElementById(this.leftId);t&&(t.innerHTML=e)}setRight(e){const t=document.getElementById(this.rightId);t&&(t.innerHTML=e)}}const N={theme:"vs-dark",formatOnPaste:!0,fontSize:14,scrollbar:{verticalScrollbarSize:2}};class E extends w{constructor(e){super(),__publicField(this,"editor"),__publicField(this,"uiEditor"),__publicField(this,"resetBtn"),__publicField(this,"runBtn"),__publicField(this,"jsContainerId","js-editor"),__publicField(this,"originScript"),__publicField(this,"config"),__publicField(this,"showJsBtn"),__publicField(this,"showUIBtn"),__publicField(this,"jsEditorContainer"),__publicField(this,"uiEditorContainer"),__publicField(this,"fileNameEle"),this.config=e,this.editor=n.editor.create(document.getElementById(this.jsContainerId),__spreadValues({language:"javascript",value:""},N)),this.fetchScript(),this.config.hasPannel&&this.fetchUISource().then((e=>{this.uiEditor=n.editor.create(document.getElementById("ui-editor"),__spreadValues({language:s.apiConf.UIFileLanguage,readOnly:!0},N)),this.uiEditor.setValue(e)})),this.bindEvent()}async fetchScript(){const e=await fetch(`${s.apiConf.resourcePublicPath}/${this.config.main}/map.js`);this.originScript=await e.text(),this.editor.setValue(this.originScript),this.emit("run",this.originScript)}async fetchUISource(e){let t;if(s.apiConf.fetchUICode){t=await s.apiConf.fetchUICode(this.config.main,e)}else if(e){const i=await fetch(e.url.replaceAll("{main}",`${s.apiConf.resourcePublicPath}/${this.config.main}`));t=await i.text()}else{const e=await fetch(s.apiConf.UIFile(this.config.main));t=await e.text()}return t}resize(){this.editor&&this.editor.layout(),this.uiEditor&&this.uiEditor.layout()}bindEvent(){this.jsEditorContainer||(this.jsEditorContainer=document.getElementById("js-editor")),this.uiEditorContainer||(this.uiEditorContainer=document.getElementById("ui-editor")),this.resetBtn||(this.resetBtn=document.getElementById("jsreset")),this.runBtn||(this.runBtn=document.getElementById("jsrun")),this.fileNameEle||(this.fileNameEle=document.getElementById("filename")),this.config.hasPannel&&(this.showJsBtn||(this.showJsBtn=document.getElementById("showjs-button")),this.showUIBtn||(this.showUIBtn=document.getElementById("showui-button")),this.showJsBtn.addEventListener("click",(()=>{this.jsEditorContainer.style.display="block",this.uiEditorContainer.style.display="none",this.fileNameEle.innerHTML="JS代码",this.resize()})),this.showUIBtn.addEventListener("click",(()=>{this.uiEditorContainer.style.display="block",this.jsEditorContainer.style.display="none",this.fileNameEle.innerHTML="UI面板代码(只读)",this.resize()})),document.querySelectorAll(".uidep-item").forEach((e=>{e.addEventListener("click",(async e=>{const t=e.currentTarget;try{const e=JSON.parse(t.dataset.file);console.log(e);const i=await this.fetchUISource(e);console.log(i),this.uiEditor.setValue(i),this.uiEditorContainer.style.display="block",this.jsEditorContainer.style.display="none",this.fileNameEle.innerHTML=`${e.name}(只读)`,this.resize()}catch(i){throw i}}))}))),this.resetBtn.addEventListener("click",(()=>{this.editor.setValue(this.originScript),this.emit("run",this.scriptFilter(this.originScript))})),this.runBtn.addEventListener("click",(()=>{this.emit("run",this.scriptFilter(this.editor.getValue()))})),window.addEventListener("resize",(()=>{this.resize()})),document.addEventListener("keydown",(e=>{if(!e.ctrlKey)return;const t=String.fromCharCode(e.keyCode).toLowerCase();"s"===t?(e.preventDefault(),this.emit("run",this.scriptFilter(this.editor.getValue()))):"r"===t&&(e.preventDefault(),this.emit("run",this.scriptFilter(this.originScript)))}))}scriptFilter(e){return e=(e=(e=e.replace(/export let /gm,"var ")).replace(/export const /gm,"var ")).replace(/export /gm,""),e=(e="mars3d"===s.apiConf.packageName?(e=e.replace('import * as mars3d from "mars3d"',"")).replace("const Cesium = mars3d.Cesium",""):(e=e.replace('import * as mars2d from "mars2d"',"")).replace("const L = mars3d.L","")).replace(/import /gm,"// import ")}}class k extends w{constructor(e){super(),__publicField(this,"sanboxWapper"),__publicField(this,"scriptDoc"),__publicField(this,"htmlTemp"),__publicField(this,"resourcePublicPath"),__publicField(this,"exampleConfig"),this.exampleConfig=e,this.sanboxWapper=document.getElementById("sanbox"),this.resourcePublicPath=s.apiConf.resourcePublicPath||"",this.getTemp()}writeScriptDoc(e){this.scriptDoc=s.scriptFilter(e),this.loadFramePage()}async loadFramePage(){const{main:e}=this.exampleConfig;if(this.scriptDoc&&this.htmlTemp){const t=this.createFrame().contentWindow.document,i=`\n