leiting-bim 2.1.39 → 2.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(_,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue"),require("ant-design-vue"),require("@ant-design/icons-vue")):typeof define=="function"&&define.amd?define(["exports","vue","ant-design-vue","@ant-design/icons-vue"],d):(_=typeof globalThis<"u"?globalThis:_||self,d(_.LeitingBim={},_.Vue,_.antd,_.iconsVue))})(this,(function(_,d,me,pn){"use strict";var es=typeof document<"u"?document.currentScript:null;const It={cesiumUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.137/Cesium.js",cesiumCssUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.137/Widgets/widgets.css",accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjZGI0MzM1ZS1hMjY4LTRlYzgtYjg1MC03NmI2ZjUxMmM5ZTUiLCJpZCI6OTUzODIsImlhdCI6MTY1MzYyMTM4OX0.ygoPAb1FvQkQGtziq5nTsWT-u7dCheu5hcG0p9TQFpU"};let Bt=null,Wt;function ts(n){return n.accessToken&&(Wt=n.accessToken),Bt||(Bt=new Promise((e,t)=>{if(window.Cesium){Wt&&(window.Cesium.Ion.defaultAccessToken=Wt),e();return}const{cesiumUrl:i,cesiumCssUrl:s}=n;if(s){const r=document.createElement("link");r.rel="stylesheet",r.href=s,document.head.appendChild(r)}const o=document.createElement("script");o.src=i,o.async=!0,o.onload=()=>{Wt&&window.Cesium&&(window.Cesium.Ion.defaultAccessToken=Wt),e()},o.onerror=r=>{console.error("Failed to load Cesium script",r),Bt=null,t(r)},document.head.appendChild(o)}),Bt)}function ld(){return window.Cesium?Promise.resolve():Bt||Promise.reject(new Error("Cesium loading has not been initiated."))}function ns(){return Wt}class cd{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}setSceneOptions(e){if(!this.viewer||!this.viewer.scene)return;const t=this.viewer.scene;typeof e.showGlobe=="boolean"&&t.globe&&(t.globe.show=e.showGlobe),typeof e.showSkyAtmosphere=="boolean"&&t.skyAtmosphere&&(t.skyAtmosphere.show=e.showSkyAtmosphere),typeof e.showSkyBox=="boolean"&&t.skyBox&&(t.skyBox.show=e.showSkyBox)}clearBackground(){!this.viewer||!this.viewer.scene||(this.viewer.scene.backgroundColor=new this.cesium.Color(0,0,0,0))}enableTestLabel(){this.viewer&&(this.viewer.extend(this.cesium.viewerCesium3DTilesInspectorMixin),this.viewer.cesium3DTilesInspector.viewModel)}enableCesiumFXAA(e){if(!this.viewer||!this.viewer.scene)return;let t=window.devicePixelRatio;for(;t>=2;)t/=2;this.viewer.resolutionScale=t,this.viewer.scene.postProcessStages.fxaa.enabled=e,this.viewer.scene.highDynamicRange=!0,this.viewer.scene.postProcessStages.tonemapper=this.cesium.Tonemapper.PBR_NEUTRAL,this.viewer.scene.postProcessStages.exposure=1}async getSnapDomSImageBase64(e="base-cx-BIM-gis",t={}){const{format:i="png",quality:s=.8,scale:o=1,returnDataUrl:r=!1}=t;try{const l=await Promise.resolve().then(()=>UI),a=this.viewer&&this.viewer.container&&this.viewer.container.id;let c=null;if(a&&(c=document.getElementById(a)),!c&&this.viewer&&this.viewer.container&&(c=this.viewer.container),!c)return null;document.fonts&&document.fonts.ready&&await document.fonts.ready;let u=null;const h=l.snapdom||l.default||l;let f=null;if(i==="webp"&&h.toWebp)f=await h.toWebp(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(h.toPng)f=await h.toPng(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(h.toBlob){const A=await h.toBlob(c,{type:i==="webp"?"image/webp":"image/png",quality:s,pixelRatio:o,embedFonts:!0,className:e});f=await this.blobToDataURL(A)}else console.warn("snapdom methods not found on:",h);if(f&&typeof f!="string")f instanceof Blob?u=await this.blobToDataURL(f):f.src&&typeof f.src=="string"?u=f.src:(console.warn("getSnapDomSImageBase64 returned non-string:",f),f.data&&typeof f.data=="string"?u=f.data:u=String(f));else{const A=String(f);u=A.startsWith("data:")?A:`data:image/${i};base64,${A}`}return u?r?u:String(u):null}catch(l){return console.error("getSnapDomSImageBase64 failed",l),null}}async blobToDataURL(e){return new Promise((t,i)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=o=>i(o),s.readAsDataURL(e)})}viewBase64Image(e,t="png"){if(!e){console.warn("viewBase64Image: No base64 data provided");return}const i=`data:image/${t};base64,`,s=e.startsWith("data:")?e:i+e,o=window.open();o?(o.document.write(`
1
+ (function(_,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue"),require("ant-design-vue"),require("@ant-design/icons-vue")):typeof define=="function"&&define.amd?define(["exports","vue","ant-design-vue","@ant-design/icons-vue"],d):(_=typeof globalThis<"u"?globalThis:_||self,d(_.LeitingBim={},_.Vue,_.antd,_.iconsVue))})(this,(function(_,d,me,pn){"use strict";var es=typeof document<"u"?document.currentScript:null;const xt={cesiumUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.137/Cesium.js",cesiumCssUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.137/Widgets/widgets.css",accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjZGI0MzM1ZS1hMjY4LTRlYzgtYjg1MC03NmI2ZjUxMmM5ZTUiLCJpZCI6OTUzODIsImlhdCI6MTY1MzYyMTM4OX0.ygoPAb1FvQkQGtziq5nTsWT-u7dCheu5hcG0p9TQFpU"};let Bt=null,Wt;function ts(n){return n.accessToken&&(Wt=n.accessToken),Bt||(Bt=new Promise((e,t)=>{if(window.Cesium){Wt&&(window.Cesium.Ion.defaultAccessToken=Wt),e();return}const{cesiumUrl:i,cesiumCssUrl:s}=n;if(s){const r=document.createElement("link");r.rel="stylesheet",r.href=s,document.head.appendChild(r)}const o=document.createElement("script");o.src=i,o.async=!0,o.onload=()=>{Wt&&window.Cesium&&(window.Cesium.Ion.defaultAccessToken=Wt),e()},o.onerror=r=>{console.error("Failed to load Cesium script",r),Bt=null,t(r)},document.head.appendChild(o)}),Bt)}function ld(){return window.Cesium?Promise.resolve():Bt||Promise.reject(new Error("Cesium loading has not been initiated."))}function ns(){return Wt}class cd{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}setSceneOptions(e){if(!this.viewer||!this.viewer.scene)return;const t=this.viewer.scene;typeof e.showGlobe=="boolean"&&t.globe&&(t.globe.show=e.showGlobe),typeof e.showSkyAtmosphere=="boolean"&&t.skyAtmosphere&&(t.skyAtmosphere.show=e.showSkyAtmosphere),typeof e.showSkyBox=="boolean"&&t.skyBox&&(t.skyBox.show=e.showSkyBox)}clearBackground(){!this.viewer||!this.viewer.scene||(this.viewer.scene.backgroundColor=new this.cesium.Color(0,0,0,0))}enableTestLabel(){this.viewer&&(this.viewer.extend(this.cesium.viewerCesium3DTilesInspectorMixin),this.viewer.cesium3DTilesInspector.viewModel)}enableCesiumFXAA(e){if(!this.viewer||!this.viewer.scene)return;let t=window.devicePixelRatio;for(;t>=2;)t/=2;this.viewer.resolutionScale=t,this.viewer.scene.postProcessStages.fxaa.enabled=e,this.viewer.scene.highDynamicRange=!0,this.viewer.scene.postProcessStages.tonemapper=this.cesium.Tonemapper.PBR_NEUTRAL,this.viewer.scene.postProcessStages.exposure=1}async getSnapDomSImageBase64(e="base-cx-BIM-gis",t={}){const{format:i="png",quality:s=.8,scale:o=1,returnDataUrl:r=!1}=t;try{const l=await Promise.resolve().then(()=>Hx),a=this.viewer&&this.viewer.container&&this.viewer.container.id;let c=null;if(a&&(c=document.getElementById(a)),!c&&this.viewer&&this.viewer.container&&(c=this.viewer.container),!c)return null;document.fonts&&document.fonts.ready&&await document.fonts.ready;let u=null;const h=l.snapdom||l.default||l;let f=null;if(i==="webp"&&h.toWebp)f=await h.toWebp(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(h.toPng)f=await h.toPng(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(h.toBlob){const A=await h.toBlob(c,{type:i==="webp"?"image/webp":"image/png",quality:s,pixelRatio:o,embedFonts:!0,className:e});f=await this.blobToDataURL(A)}else console.warn("snapdom methods not found on:",h);if(f&&typeof f!="string")f instanceof Blob?u=await this.blobToDataURL(f):f.src&&typeof f.src=="string"?u=f.src:(console.warn("getSnapDomSImageBase64 returned non-string:",f),f.data&&typeof f.data=="string"?u=f.data:u=String(f));else{const A=String(f);u=A.startsWith("data:")?A:`data:image/${i};base64,${A}`}return u?r?u:String(u):null}catch(l){return console.error("getSnapDomSImageBase64 failed",l),null}}async blobToDataURL(e){return new Promise((t,i)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=o=>i(o),s.readAsDataURL(e)})}viewBase64Image(e,t="png"){if(!e){console.warn("viewBase64Image: No base64 data provided");return}const i=`data:image/${t};base64,`,s=e.startsWith("data:")?e:i+e,o=window.open();o?(o.document.write(`
2
2
  <html>
3
3
  <head><title>Snapshot Preview</title></head>
4
4
  <body style="margin:0; display:flex; justify-content:center; align-items:center; height:100vh; background:#333;">
@@ -9,8 +9,8 @@
9
9
  void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
10
10
  material.diffuse *= u_tilesBrightness;
11
11
  }
12
- `});c.isModelAdjustment=!0,a.customShader=c}else{let c="color('white')";e!==1&&(c=`${c} * ${e}`),a.style=new i.Cesium3DTileStyle({color:c})}}}}var Fo=typeof global=="object"&&global&&global.Object===Object&&global,dd=typeof self=="object"&&self&&self.Object===Object&&self,St=Fo||dd||Function("return this")(),ni=St.Symbol,Ro=Object.prototype,ud=Ro.hasOwnProperty,hd=Ro.toString,gn=ni?ni.toStringTag:void 0;function fd(n){var e=ud.call(n,gn),t=n[gn];try{n[gn]=void 0;var i=!0}catch{}var s=hd.call(n);return i&&(e?n[gn]=t:delete n[gn]),s}var pd=Object.prototype,gd=pd.toString;function md(n){return gd.call(n)}var Ad="[object Null]",yd="[object Undefined]",Oo=ni?ni.toStringTag:void 0;function mn(n){return n==null?n===void 0?yd:Ad:Oo&&Oo in Object(n)?fd(n):md(n)}function zt(n){return n!=null&&typeof n=="object"}var Cd="[object Symbol]";function Ed(n){return typeof n=="symbol"||zt(n)&&mn(n)==Cd}var is=Array.isArray,wd=/\s/;function bd(n){for(var e=n.length;e--&&wd.test(n.charAt(e)););return e}var vd=/^\s+/;function xd(n){return n&&n.slice(0,bd(n)+1).replace(vd,"")}function Xe(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Lo=NaN,Id=/^[-+]0x[0-9a-f]+$/i,Bd=/^0b[01]+$/i,Sd=/^0o[0-7]+$/i,Md=parseInt;function No(n){if(typeof n=="number")return n;if(Ed(n))return Lo;if(Xe(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Xe(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=xd(n);var t=Bd.test(n);return t||Sd.test(n)?Md(n.slice(2),t?2:8):Id.test(n)?Lo:+n}function Uo(n){return n}var Td="[object AsyncFunction]",Dd="[object Function]",kd="[object GeneratorFunction]",Pd="[object Proxy]";function ss(n){if(!Xe(n))return!1;var e=mn(n);return e==Dd||e==kd||e==Td||e==Pd}var os=St["__core-js_shared__"],_o=(function(){var n=/[^.]+$/.exec(os&&os.keys&&os.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function Fd(n){return!!_o&&_o in n}var Rd=Function.prototype,Od=Rd.toString;function Ld(n){if(n!=null){try{return Od.call(n)}catch{}try{return n+""}catch{}}return""}var Nd=/[\\^$.*+?()[\]{}|]/g,Ud=/^\[object .+?Constructor\]$/,_d=Function.prototype,Qd=Object.prototype,Hd=_d.toString,Gd=Qd.hasOwnProperty,Yd=RegExp("^"+Hd.call(Gd).replace(Nd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vd(n){if(!Xe(n)||Fd(n))return!1;var e=ss(n)?Yd:Ud;return e.test(Ld(n))}function Wd(n,e){return n?.[e]}function rs(n,e){var t=Wd(n,e);return Vd(t)?t:void 0}var Qo=Object.create,zd=(function(){function n(){}return function(e){if(!Xe(e))return{};if(Qo)return Qo(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}})();function jd(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function $d(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var Kd=800,Xd=16,qd=Date.now;function Jd(n){var e=0,t=0;return function(){var i=qd(),s=Xd-(i-t);if(t=i,s>0){if(++e>=Kd)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Zd(n){return function(){return n}}var ii=(function(){try{var n=rs(Object,"defineProperty");return n({},"",{}),n}catch{}})(),eu=ii?function(n,e){return ii(n,"toString",{configurable:!0,enumerable:!1,value:Zd(e),writable:!0})}:Uo,tu=Jd(eu),nu=9007199254740991,iu=/^(?:0|[1-9]\d*)$/;function Ho(n,e){var t=typeof n;return e=e??nu,!!e&&(t=="number"||t!="symbol"&&iu.test(n))&&n>-1&&n%1==0&&n<e}function as(n,e,t){e=="__proto__"&&ii?ii(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function si(n,e){return n===e||n!==n&&e!==e}var su=Object.prototype,ou=su.hasOwnProperty;function ru(n,e,t){var i=n[e];(!(ou.call(n,e)&&si(i,t))||t===void 0&&!(e in n))&&as(n,e,t)}function au(n,e,t,i){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var l=e[o],a=void 0;a===void 0&&(a=n[l]),s?as(t,l,a):ru(t,l,a)}return t}var Go=Math.max;function lu(n,e,t){return e=Go(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Go(i.length-e,0),r=Array(o);++s<o;)r[s]=i[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=i[s];return l[e]=t(r),jd(n,this,l)}}function cu(n,e){return tu(lu(n,e,Uo),n+"")}var du=9007199254740991;function Yo(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=du}function ls(n){return n!=null&&Yo(n.length)&&!ss(n)}function uu(n,e,t){if(!Xe(t))return!1;var i=typeof e;return(i=="number"?ls(t)&&Ho(e,t.length):i=="string"&&e in t)?si(t[e],n):!1}function hu(n){return cu(function(e,t){var i=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=n.length>3&&typeof o=="function"?(s--,o):void 0,r&&uu(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++i<s;){var l=t[i];l&&n(e,l,i,o)}return e})}var fu=Object.prototype;function Vo(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||fu;return n===t}function pu(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var gu="[object Arguments]";function Wo(n){return zt(n)&&mn(n)==gu}var zo=Object.prototype,mu=zo.hasOwnProperty,Au=zo.propertyIsEnumerable,cs=Wo((function(){return arguments})())?Wo:function(n){return zt(n)&&mu.call(n,"callee")&&!Au.call(n,"callee")};function yu(){return!1}var jo=typeof _=="object"&&_&&!_.nodeType&&_,$o=jo&&typeof module=="object"&&module&&!module.nodeType&&module,Cu=$o&&$o.exports===jo,Ko=Cu?St.Buffer:void 0,Eu=Ko?Ko.isBuffer:void 0,Xo=Eu||yu,wu="[object Arguments]",bu="[object Array]",vu="[object Boolean]",xu="[object Date]",Iu="[object Error]",Bu="[object Function]",Su="[object Map]",Mu="[object Number]",Tu="[object Object]",Du="[object RegExp]",ku="[object Set]",Pu="[object String]",Fu="[object WeakMap]",Ru="[object ArrayBuffer]",Ou="[object DataView]",Lu="[object Float32Array]",Nu="[object Float64Array]",Uu="[object Int8Array]",_u="[object Int16Array]",Qu="[object Int32Array]",Hu="[object Uint8Array]",Gu="[object Uint8ClampedArray]",Yu="[object Uint16Array]",Vu="[object Uint32Array]",ue={};ue[Lu]=ue[Nu]=ue[Uu]=ue[_u]=ue[Qu]=ue[Hu]=ue[Gu]=ue[Yu]=ue[Vu]=!0,ue[wu]=ue[bu]=ue[Ru]=ue[vu]=ue[Ou]=ue[xu]=ue[Iu]=ue[Bu]=ue[Su]=ue[Mu]=ue[Tu]=ue[Du]=ue[ku]=ue[Pu]=ue[Fu]=!1;function Wu(n){return zt(n)&&Yo(n.length)&&!!ue[mn(n)]}function zu(n){return function(e){return n(e)}}var qo=typeof _=="object"&&_&&!_.nodeType&&_,An=qo&&typeof module=="object"&&module&&!module.nodeType&&module,ju=An&&An.exports===qo,ds=ju&&Fo.process,Jo=(function(){try{var n=An&&An.require&&An.require("util").types;return n||ds&&ds.binding&&ds.binding("util")}catch{}})(),Zo=Jo&&Jo.isTypedArray,er=Zo?zu(Zo):Wu;function $u(n,e){var t=is(n),i=!t&&cs(n),s=!t&&!i&&Xo(n),o=!t&&!i&&!s&&er(n),r=t||i||s||o,l=r?pu(n.length,String):[],a=l.length;for(var c in n)r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ho(c,a))||l.push(c);return l}function Ku(n,e){return function(t){return n(e(t))}}function Xu(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var qu=Object.prototype,Ju=qu.hasOwnProperty;function Zu(n){if(!Xe(n))return Xu(n);var e=Vo(n),t=[];for(var i in n)i=="constructor"&&(e||!Ju.call(n,i))||t.push(i);return t}function tr(n){return ls(n)?$u(n):Zu(n)}var yn=rs(Object,"create");function eh(){this.__data__=yn?yn(null):{},this.size=0}function th(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var nh="__lodash_hash_undefined__",ih=Object.prototype,sh=ih.hasOwnProperty;function oh(n){var e=this.__data__;if(yn){var t=e[n];return t===nh?void 0:t}return sh.call(e,n)?e[n]:void 0}var rh=Object.prototype,ah=rh.hasOwnProperty;function lh(n){var e=this.__data__;return yn?e[n]!==void 0:ah.call(e,n)}var ch="__lodash_hash_undefined__";function dh(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=yn&&e===void 0?ch:e,this}function Mt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Mt.prototype.clear=eh,Mt.prototype.delete=th,Mt.prototype.get=oh,Mt.prototype.has=lh,Mt.prototype.set=dh;function uh(){this.__data__=[],this.size=0}function oi(n,e){for(var t=n.length;t--;)if(si(n[t][0],e))return t;return-1}var hh=Array.prototype,fh=hh.splice;function ph(n){var e=this.__data__,t=oi(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():fh.call(e,t,1),--this.size,!0}function gh(n){var e=this.__data__,t=oi(e,n);return t<0?void 0:e[t][1]}function mh(n){return oi(this.__data__,n)>-1}function Ah(n,e){var t=this.__data__,i=oi(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function ot(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}ot.prototype.clear=uh,ot.prototype.delete=ph,ot.prototype.get=gh,ot.prototype.has=mh,ot.prototype.set=Ah;var nr=rs(St,"Map");function yh(){this.size=0,this.__data__={hash:new Mt,map:new(nr||ot),string:new Mt}}function Ch(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function ri(n,e){var t=n.__data__;return Ch(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Eh(n){var e=ri(this,n).delete(n);return this.size-=e?1:0,e}function wh(n){return ri(this,n).get(n)}function bh(n){return ri(this,n).has(n)}function vh(n,e){var t=ri(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function jt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}jt.prototype.clear=yh,jt.prototype.delete=Eh,jt.prototype.get=wh,jt.prototype.has=bh,jt.prototype.set=vh;var ir=Ku(Object.getPrototypeOf,Object),xh="[object Object]",Ih=Function.prototype,Bh=Object.prototype,sr=Ih.toString,Sh=Bh.hasOwnProperty,Mh=sr.call(Object);function Th(n){if(!zt(n)||mn(n)!=xh)return!1;var e=ir(n);if(e===null)return!0;var t=Sh.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&sr.call(t)==Mh}function Dh(){this.__data__=new ot,this.size=0}function kh(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function Ph(n){return this.__data__.get(n)}function Fh(n){return this.__data__.has(n)}var Rh=200;function Oh(n,e){var t=this.__data__;if(t instanceof ot){var i=t.__data__;if(!nr||i.length<Rh-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new jt(i)}return t.set(n,e),this.size=t.size,this}function $t(n){var e=this.__data__=new ot(n);this.size=e.size}$t.prototype.clear=Dh,$t.prototype.delete=kh,$t.prototype.get=Ph,$t.prototype.has=Fh,$t.prototype.set=Oh;var or=typeof _=="object"&&_&&!_.nodeType&&_,rr=or&&typeof module=="object"&&module&&!module.nodeType&&module,Lh=rr&&rr.exports===or,ar=Lh?St.Buffer:void 0;ar&&ar.allocUnsafe;function Nh(n,e){return n.slice()}var lr=St.Uint8Array;function Uh(n){var e=new n.constructor(n.byteLength);return new lr(e).set(new lr(n)),e}function _h(n,e){var t=Uh(n.buffer);return new n.constructor(t,n.byteOffset,n.length)}function Qh(n){return typeof n.constructor=="function"&&!Vo(n)?zd(ir(n)):{}}function Hh(n){return function(e,t,i){for(var s=-1,o=Object(e),r=i(e),l=r.length;l--;){var a=r[++s];if(t(o[a],a,o)===!1)break}return e}}var Gh=Hh(),us=function(){return St.Date.now()},Yh="Expected a function",Vh=Math.max,Wh=Math.min;function hs(n,e,t){var i,s,o,r,l,a,c=0,u=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(Yh);e=No(e)||0,Xe(t)&&(u=!!t.leading,h="maxWait"in t,o=h?Vh(No(t.maxWait)||0,e):o,f="trailing"in t?!!t.trailing:f);function p(S){var I=i,g=s;return i=s=void 0,c=S,r=n.apply(g,I),r}function A(S){return c=S,l=setTimeout(y,e),u?p(S):r}function C(S){var I=S-a,g=S-c,k=e-I;return h?Wh(k,o-g):k}function m(S){var I=S-a,g=S-c;return a===void 0||I>=e||I<0||h&&g>=o}function y(){var S=us();if(m(S))return E(S);l=setTimeout(y,C(S))}function E(S){return l=void 0,f&&i?p(S):(i=s=void 0,r)}function x(){l!==void 0&&clearTimeout(l),c=0,i=a=s=l=void 0}function M(){return l===void 0?r:E(us())}function T(){var S=us(),I=m(S);if(i=arguments,s=this,a=S,I){if(l===void 0)return A(a);if(h)return clearTimeout(l),l=setTimeout(y,e),p(a)}return l===void 0&&(l=setTimeout(y,e)),r}return T.cancel=x,T.flush=M,T}function fs(n,e,t){(t!==void 0&&!si(n[e],t)||t===void 0&&!(e in n))&&as(n,e,t)}function zh(n){return zt(n)&&ls(n)}function ps(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function jh(n){return au(n,tr(n))}function $h(n,e,t,i,s,o,r){var l=ps(n,t),a=ps(e,t),c=r.get(a);if(c){fs(n,t,c);return}var u=o?o(l,a,t+"",n,e,r):void 0,h=u===void 0;if(h){var f=is(a),p=!f&&Xo(a),A=!f&&!p&&er(a);u=a,f||p||A?is(l)?u=l:zh(l)?u=$d(l):p?(h=!1,u=Nh(a)):A?(h=!1,u=_h(a)):u=[]:Th(a)||cs(a)?(u=l,cs(l)?u=jh(l):(!Xe(l)||ss(l))&&(u=Qh(a))):h=!1}h&&(r.set(a,u),s(u,a,i,o,r),r.delete(a)),fs(n,t,u)}function cr(n,e,t,i,s){n!==e&&Gh(e,function(o,r){if(s||(s=new $t),Xe(o))$h(n,e,r,t,cr,i,s);else{var l=i?i(ps(n,r),o,r+"",n,e,s):void 0;l===void 0&&(l=o),fs(n,r,l)}},tr)}var Kh=hu(function(n,e,t){cr(n,e,t)});function dr({Cesium:n,tileset:e}){const t=e.leiting;if(!t||!t.model||!t.model.formData)return;const i=t.model.formData,s=t.box,o=n.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,n.Math.toRadians(i.totalRotation||0)),r=n.Matrix4.fromRotationTranslation(n.Matrix3.fromQuaternion(o),n.Cartesian3.ZERO),l=n.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),a=n.Transforms.eastNorthUpToFixedFrame(l),c=n.Matrix4.multiply(a,r,new n.Matrix4);if(e._root){if(!s){e._root.transform=c;return}try{const{center:u}=s,h=e.root.boundingVolume.boundingSphere,f=new n.Cartesian3(u.x,u.y,0),p=n.Matrix4.multiplyByPoint(c,f,new n.Cartesian3),A=n.Cartographic.fromCartesian(p),C=h.center,m=n.Transforms.eastNorthUpToFixedFrame(new n.Cartesian3(C.x,C.y,C.z)),y=new n.Cartesian3(-u.x+(i.X||0),-u.y+(i.Y||0),i.Z||0),E=n.Matrix4.fromTranslation(y),x=n.Matrix4.multiply(r,E,new n.Matrix4),M=n.Cartesian3.fromDegrees(A.longitude/Math.PI*180,A.latitude/Math.PI*180,i.height),T=n.Transforms.eastNorthUpToFixedFrame(M),S=n.Matrix4.multiply(T,x,new n.Matrix4);n.Matrix4.multiply(m,x,m),e._root.transform=S}catch(u){console.error("Update model position failed:",u)}}}const Kt={NotLoaded:0,Loading:1,Loaded:2,Error:3},Tt=4294967295,qe=65535,gs=255,Xh=8,ur=9,qh=0,Jh=99,Zh=67324752,hr=134695760,ef=hr,fr=33639248,tf=101010256,pr=101075792,nf=117853008,Xt=22,ms=20,As=56,sf=12,of=20,gr=4,rf=1,af=39169,lf=10,cf=1,df=21589,uf=28789,hf=25461,ff=6534,pf=30837,gf=30805,mr=1,mf=6,Ar=8,yr=2048,Af=16,yf=1,Cf=2,Ef=4,wf=32,Cr=61440,ys=16384,Cs=73,bf=420,vf=2048,xf=1024,If=512,Bf="/",Es=30,Sf=10,Mf=14,Tf=18,he=void 0,ft="undefined",Dt="function",Df=64;let Er=2;try{typeof navigator!=ft&&navigator.hardwareConcurrency&&(Er=navigator.hardwareConcurrency)}catch{}const kf={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:Er,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=ft&&CompressionStream,DecompressionStream:typeof DecompressionStream!=ft&&DecompressionStream},wr=Object.assign({},kf);function Pf(){return wr}function Ff(n){return Math.max(n.chunkSize,Df)}function ai(n){const{baseURI:e,chunkSize:t,maxWorkers:i,terminateWorkerTimeout:s,useCompressionStream:o,useWebWorkers:r,CompressionStream:l,DecompressionStream:a,CompressionStreamZlib:c,DecompressionStreamZlib:u,workerURI:h,wasmURI:f}=n;_e("baseURI",e),_e("wasmURI",f),_e("workerURI",h),_e("chunkSize",t),_e("maxWorkers",i),_e("terminateWorkerTimeout",s),_e("useCompressionStream",o),_e("useWebWorkers",r),_e("CompressionStream",l),_e("DecompressionStream",a),_e("CompressionStreamZlib",c),_e("DecompressionStreamZlib",u)}function _e(n,e){e!==he&&(wr[n]=e)}function Rf(n){let e;n({workerURI:()=>(e||(e="data:text/javascript,"+encodeURIComponent(`(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:f,Promise:l,TextEncoder:u,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:S}=self,b=void 0,v="undefined",k="function",z=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;z[t]=e}class C{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^z[255&(e^t[n])];this.t=e}get(){return~this.t}}class A extends d{constructor(){let t;const e=new C;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new f(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const x={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=x.o(n);return 32===s?t.concat(e):x.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+x.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=x.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=x.o(r);return s.push(x.u(e+o&31,e+o>32?n:s.pop(),1)),s}},I={bytes:{p(t){const e=x.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(x.u(8*(3&n),s)),e}}},R=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=I.I.m(t));const n=e.C=x.concat(e.C,t),s=e.A,o=e.A=s+x.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=x.concat(e,[x.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+f+o[t]+n.v[s.floor(t/20)]|0;f=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+f|0}},P={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},U={importKey:t=>new U.M(I.bytes.m(t)),_(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,l;const u=new ArrayBuffer(o),w=new f(u);let p=0;const d=x;for(e=I.bytes.m(e),l=1;(o||1)>p;l++){for(i=c=t.encrypt(d.concat(e,[l])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return u.slice(0,s/8)},M:class{constructor(t){const e=this,n=e.B=R,s=[[],[]];e.D=[new n,new n];const r=e.D[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.D[0].update(s[0]),e.D[1].update(s[1]),e.W=new n(e.D[0])}reset(){const t=this;t.W=new t.B(t.D[0]),t.K=!1}update(t){this.K=!0,this.W.update(t)}digest(){const t=this,e=t.W.P(),n=new t.B(t.D[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.K)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},V=typeof w!=v&&typeof w.getRandomValues==k,M="Invalid password",_="Invalid signature",B="zipjs-abort-check-password";function D(t){return V?w.getRandomValues(t):P.getRandomValues(t)}const W=16,K={name:"PBKDF2"},E=e.assign({hash:{name:"HMAC"}},K),L=e.assign({iterations:1e3,hash:{name:"SHA-1"}},K),O=["deriveBits"],T=[8,12,16],j=[16,24,32],H=10,Z=[0,0,0,0],F=typeof w!=v,N=F&&w.subtle,q=F&&typeof N!=v,G=I.bytes,J=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let f=i=0;!n[f];f^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[f]=o,s[o]=f,h=r[a=r[c=r[f]]];let l=16843009*h^65537*a^257*c^16843008*f,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=u=u<<24^u>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],f=i[3],l=i[4];let u,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],S=4;for(let t=0;s>t;t++)u=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^f[255&g]^n[S],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^f[255&d]^n[S+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^f[255&y]^n[S+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^f[255&m]^n[S+3],S+=4,d=u,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&g]^n[S++],u=d,d=y,y=m,m=g,g=u;return o}},Q=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=x.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return x.l(e,r)}},X=U.M;let Y=F&&q&&typeof N.importKey==k,$=F&&q&&typeof N.deriveBits==k;class tt extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await st(t,e,n,it(s,0,T[e])),i=it(s,T[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(M)})(n,i,s,it(t,0,T[i]+2)),t=it(t,T[i]+2),c?e.error(new r(B)):a()):await h;const f=new o(t.length-H-(t.length-H)%W);e.enqueue(nt(n,t,f,0,H,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=it(i,0,i.length-H),h=it(i,i.length-H);let f=new o;if(a.length){const t=at(G,a);s.update(t);const e=n.update(t);f=ct(G,e)}if(e){const t=it(ct(G,s.digest()),0,H);for(let e=0;H>e;e++)if(t[e]!=h[e])throw new r(_)}t.enqueue(f)}}})}}class et extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=D(new o(T[e]));return ot(s,await st(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%W);h.set(a,0),e.enqueue(nt(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(at(G,s));n.update(t),c=ct(G,t)}r.signature=ct(G,n.digest()).slice(0,H),t.enqueue(ot(c,r.signature))}}}),r=this}}function nt(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,f=e.length-r;let l;for(h.length&&(e=ot(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,f-f%W)),l=0;f-W>=l;l+=W){const t=at(G,it(e,l,l+W));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(ct(G,r),l+s)}return t.pending=it(e,l),n}async function st(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!Y)return U.importKey(e);try{return await N.importKey("raw",e,n,!1,r)}catch{return Y=!1,U.importKey(e)}})(0,r,E,0,O),a=await(async(t,e,n)=>{if(!$)return U._(e,t.salt,L.iterations,n);try{return await N.deriveBits(t,e,n)}catch{return $=!1,U._(e,t.salt,L.iterations,n)}})(e.assign({salt:i},L),c,8*(2*j[s]+2)),h=new o(a),f=at(G,it(h,0,j[s])),l=at(G,it(h,j[s],2*j[s])),u=it(h,2*j[s]);return e.assign(n,{keys:{key:f,$:l,passwordVerification:u},X:new Q(new J(f),t.from(Z)),Y:new X(l)}),u}function rt(t,e){return e===b?(t=>{if(typeof u==v){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function ot(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function it(t,e,n){return t.subarray(e,n)}function ct(t,e){return t.p(e)}function at(t,e){return t.m(e)}class ht extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;if(n.password){const e=lt(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(M);t=t.subarray(12)}s?e.error(new r(B)):e.enqueue(lt(n,t))}})}}class ft extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=D(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ut(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ut(n,t),r),e.enqueue(s)}})}}function lt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,n[s]);return n}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,e[s]);return n}function wt(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new C(s[0]),et:new C(s[2])});for(let e=0;e<n.length;e++)pt(t,n.charCodeAt(e))}function pt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=mt(s.imul(mt(r+yt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function dt(t){const e=2|t.keys[2];return yt(s.imul(e,1^e)>>>8)}function yt(t){return 255&t}function mt(t){return 4294967295&t}class gt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,l=this;let u,w,p=super.readable;o&&!c||!a||(u=new A,p=kt(p,u)),r&&(p=vt(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=kt(p,new ft(t)):(w=new et(t),p=kt(p,w))),bt(l,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new f(u.value.buffer).getUint32(0)),l.signature=t})}}class St extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:l,rt:u}=t;let w,p,d=super.readable;i&&(o?d=kt(d,new ht(t)):(p=new tt(t),d=kt(d,p))),h&&(d=vt(d,l,{chunkSize:e,rt:u},s,n,s)),i&&!o||!c||(w=new A,d=kt(d,w)),bt(this,d,()=>{if((!i||o)&&c){const t=new f(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(_)}})}}function bt(t,n,s){n=kt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function vt(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=kt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=kt(t,new r(c,n));else{if(!o)throw s;t=kt(t,new o(c,n))}}return t}function kt(t,e){return t.pipeThrough(e)}const zt="data",Ct="close";class At extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=gt:o.startsWith("inflate")&&(i=St),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,f=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),l=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==b&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(f).pipeThrough(a).pipeThrough(l)})}}class xt extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}const It=new h,Rt=new h;let Pt,Ut,Vt,Mt,_t,Bt=0;async function Dt(t){try{const{options:e,config:s}=t;if(!e.useCompressionStream)try{await self.initModule(t.config)}catch{e.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},o=t.readable||new y({async pull(t){const e=new l(t=>It.set(Bt,t));Wt({type:"pull",messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),i=t.writable||new m({async write(t){let e;const s=new l(t=>e=t);Rt.set(Bt,e),Wt({type:zt,value:t,messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER,await s}},r),c=new At(e,s);Pt=new AbortController;const{signal:a}=Pt;await o.pipeThrough(c).pipeThrough(new xt(s.chunkSize)).pipeTo(i,{signal:a,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:h,inputSize:f,outputSize:u}=c;Wt({type:Ct,result:{signature:h,inputSize:f,outputSize:u}})}catch(t){t.outputSize=0,Kt(t)}}function Wt(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t)}function Kt(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}function Et(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=Vt(c),this.in=Vt(a),this.it=a,this.ht=new o(c),t?(this.ft=Ut.deflate_process,this.lt=Ut.deflate_last_consumed,this.ut=Ut.deflate_end,this.wt=Ut.deflate_new(),n="gzip"===e?Ut.deflate_init_gzip(this.wt,i):"deflate-raw"===e?Ut.deflate_init_raw(this.wt,i):Ut.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.ft=Ut.inflate9_process,this.lt=Ut.inflate9_last_consumed,this.ut=Ut.inflate9_end,this.wt=Ut.inflate9_new(),n=Ut.inflate9_init_raw(this.wt)):(this.ft=Ut.inflate_process,this.lt=Ut.inflate_last_consumed,this.ut=Ut.inflate_end,this.wt=Ut.inflate_new(),n="deflate-raw"===e?Ut.inflate_init_raw(this.wt):"gzip"===e?Ut.inflate_init_gzip(this.wt):Ut.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(_t.buffer),h=this.ft,f=this.lt,l=this.ct,u=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Mt&&Mt(this.in),this.in=Vt(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,l,c,0),p=16777215&o;if(p&&(u.set(a.subarray(l,l+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=f(this.wt);if(0===d)break;w+=d}}catch(t){this.ut&&this.wt&&this.ut(this.wt),this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct),n.error(t)}},flush(e){try{const n=new o(_t.buffer),s=this.ft,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4),h=16777215&o,f=o>>24&255;if(!t){const t=128&f?f-256:f;if(0>t)throw new r("process error:"+t)}if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===f||0===h)break}}catch(t){e.error(t)}finally{if(this.ut&&this.wt){const t=this.ut(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct)}}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Dt(t),e==zt){const t=It.get(n);It.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Rt.get(n);Rt.delete(n),t()}e==Ct&&Pt.abort()}catch(t){Kt(t)}});class Lt{constructor(t="deflate",e){return Et(!0,t,e)}}class Ot{constructor(t="deflate",e){return Et(!1,t,e)}}let Tt=!1;self.initModule=async t=>{try{const e=await(async(t,{baseURI:e})=>{if(!Tt){let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(Ut=t,({malloc:Vt,free:Mt,memory:_t}=Ut),"function"!=typeof Vt||"function"!=typeof Mt||!_t)throw Ut=Vt=Mt=_t=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),Tt=!0}})(t.wasmURI,t);return t.nt=Lt,t.st=Ot,e}catch{}}});
13
- `)),e)})}const br=[];for(let n=0;n<256;n++){let e=n;for(let t=0;t<8;t++)e&1?e=e>>>1^3988292384:e=e>>>1;br[n]=e}class li{constructor(e){this.crc=e||-1}append(e){let t=this.crc|0;for(let i=0,s=e.length|0;i<s;i++)t=t>>>8^br[(t^e[i])&255];this.crc=t}get(){return~this.crc}}class vr extends TransformStream{constructor(){let e;const t=new li;super({transform(i,s){t.append(i),s.enqueue(i)},flush(){const i=new Uint8Array(4);new DataView(i.buffer).setUint32(0,t.get()),e.value=i}}),e=this}}function Of(n){if(typeof TextEncoder==ft){n=unescape(encodeURIComponent(n));const e=new Uint8Array(n.length);for(let t=0;t<e.length;t++)e[t]=n.charCodeAt(t);return e}else return new TextEncoder().encode(n)}const Fe={concat(n,e){if(n.length===0||e.length===0)return n.concat(e);const t=n[n.length-1],i=Fe.getPartial(t);return i===32?n.concat(e):Fe._shiftRight(e,i,t|0,n.slice(0,n.length-1))},bitLength(n){const e=n.length;if(e===0)return 0;const t=n[e-1];return(e-1)*32+Fe.getPartial(t)},clamp(n,e){if(n.length*32<e)return n;n=n.slice(0,Math.ceil(e/32));const t=n.length;return e=e&31,t>0&&e&&(n[t-1]=Fe.partial(e,n[t-1]&2147483648>>e-1,1)),n},partial(n,e,t){return n===32?e:(t?e|0:e<<32-n)+n*1099511627776},getPartial(n){return Math.round(n/1099511627776)||32},_shiftRight(n,e,t,i){for(i===void 0&&(i=[]);e>=32;e-=32)i.push(t),t=0;if(e===0)return i.concat(n);for(let r=0;r<n.length;r++)i.push(t|n[r]>>>e),t=n[r]<<32-e;const s=n.length?n[n.length-1]:0,o=Fe.getPartial(s);return i.push(Fe.partial(e+o&31,e+o>32?t:i.pop(),1)),i}},ci={bytes:{fromBits(n){const t=Fe.bitLength(n)/8,i=new Uint8Array(t);let s;for(let o=0;o<t;o++)(o&3)===0&&(s=n[o/4]),i[o]=s>>>24,s<<=8;return i},toBits(n){const e=[];let t,i=0;for(t=0;t<n.length;t++)i=i<<8|n[t],(t&3)===3&&(e.push(i),i=0);return t&3&&e.push(Fe.partial(8*(t&3),i)),e}}},xr={};xr.sha1=class{constructor(n){const e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],n?(e._h=n._h.slice(0),e._buffer=n._buffer.slice(0),e._length=n._length):e.reset()}reset(){const n=this;return n._h=n._init.slice(0),n._buffer=[],n._length=0,n}update(n){const e=this;typeof n=="string"&&(n=ci.utf8String.toBits(n));const t=e._buffer=Fe.concat(e._buffer,n),i=e._length,s=e._length=i+Fe.bitLength(n);if(s>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(t);let r=0;for(let l=e.blockSize+i-(e.blockSize+i&e.blockSize-1);l<=s;l+=e.blockSize)e._block(o.subarray(16*r,16*(r+1))),r+=1;return t.splice(0,16*r),e}finalize(){const n=this;let e=n._buffer;const t=n._h;e=Fe.concat(e,[Fe.partial(1,1)]);for(let i=e.length+2;i&15;i++)e.push(0);for(e.push(Math.floor(n._length/4294967296)),e.push(n._length|0);e.length;)n._block(e.splice(0,16));return n.reset(),t}_f(n,e,t,i){if(n<=19)return e&t|~e&i;if(n<=39)return e^t^i;if(n<=59)return e&t|e&i|t&i;if(n<=79)return e^t^i}_S(n,e){return e<<n|e>>>32-n}_block(n){const e=this,t=e._h,i=Array(80);for(let c=0;c<16;c++)i[c]=n[c];let s=t[0],o=t[1],r=t[2],l=t[3],a=t[4];for(let c=0;c<=79;c++){c>=16&&(i[c]=e._S(1,i[c-3]^i[c-8]^i[c-14]^i[c-16]));const u=e._S(5,s)+e._f(c,o,r,l)+a+i[c]+e._key[Math.floor(c/20)]|0;a=l,l=r,r=e._S(30,o),o=s,s=u}t[0]=t[0]+s|0,t[1]=t[1]+o|0,t[2]=t[2]+r|0,t[3]=t[3]+l|0,t[4]=t[4]+a|0}};const Ir={};Ir.aes=class{constructor(n){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const t=e._tables[0][4],i=e._tables[1],s=n.length;let o,r,l,a=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=n.slice(0),l=[]],o=s;o<4*s+28;o++){let c=r[o-1];(o%s===0||s===8&&o%s===4)&&(c=t[c>>>24]<<24^t[c>>16&255]<<16^t[c>>8&255]<<8^t[c&255],o%s===0&&(c=c<<8^c>>>24^a<<24,a=a<<1^(a>>7)*283)),r[o]=r[o-s]^c}for(let c=0;o;c++,o--){const u=r[c&3?o:o-4];o<=4||c<4?l[c]=u:l[c]=i[0][t[u>>>24]]^i[1][t[u>>16&255]]^i[2][t[u>>8&255]]^i[3][t[u&255]]}}encrypt(n){return this._crypt(n,0)}decrypt(n){return this._crypt(n,1)}_precompute(){const n=this._tables[0],e=this._tables[1],t=n[4],i=e[4],s=[],o=[];let r,l,a,c;for(let u=0;u<256;u++)o[(s[u]=u<<1^(u>>7)*283)^u]=u;for(let u=r=0;!t[u];u^=l||1,r=o[r]||1){let h=r^r<<1^r<<2^r<<3^r<<4;h=h>>8^h&255^99,t[u]=h,i[h]=u,c=s[a=s[l=s[u]]];let f=c*16843009^a*65537^l*257^u*16843008,p=s[h]*257^h*16843008;for(let A=0;A<4;A++)n[A][u]=p=p<<24^p>>>8,e[A][h]=f=f<<24^f>>>8}for(let u=0;u<5;u++)n[u]=n[u].slice(0),e[u]=e[u].slice(0)}_crypt(n,e){if(n.length!==4)throw new Error("invalid aes block size");const t=this._key[e],i=t.length/4-2,s=[0,0,0,0],o=this._tables[e],r=o[0],l=o[1],a=o[2],c=o[3],u=o[4];let h=n[0]^t[0],f=n[e?3:1]^t[1],p=n[2]^t[2],A=n[e?1:3]^t[3],C=4,m,y,E;for(let x=0;x<i;x++)m=r[h>>>24]^l[f>>16&255]^a[p>>8&255]^c[A&255]^t[C],y=r[f>>>24]^l[p>>16&255]^a[A>>8&255]^c[h&255]^t[C+1],E=r[p>>>24]^l[A>>16&255]^a[h>>8&255]^c[f&255]^t[C+2],A=r[A>>>24]^l[h>>16&255]^a[f>>8&255]^c[p&255]^t[C+3],C+=4,h=m,f=y,p=E;for(let x=0;x<4;x++)s[e?3&-x:x]=u[h>>>24]<<24^u[f>>16&255]<<16^u[p>>8&255]<<8^u[A&255]^t[C++],m=h,h=f,f=p,p=A,A=m;return s}};const Lf={getRandomValues(n){const e=new Uint32Array(n.buffer),t=i=>{let s=987654321;const o=4294967295;return function(){return s=36969*(s&65535)+(s>>16)&o,i=18e3*(i&65535)+(i>>16)&o,(((s<<16)+i&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let i=0,s;i<n.length;i+=4){const o=t((s||Math.random())*4294967296);s=o()*987654071,e[i/4]=o()*4294967296|0}return n}},Br={};Br.ctrGladman=class{constructor(n,e){this._prf=n,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(n){return this.calculate(this._prf,n,this._iv)}incWord(n){if((n>>24&255)===255){let e=n>>16&255,t=n>>8&255,i=n&255;e===255?(e=0,t===255?(t=0,i===255?i=0:++i):++t):++e,n=0,n+=e<<16,n+=t<<8,n+=i}else n+=1<<24;return n}incCounter(n){(n[0]=this.incWord(n[0]))===0&&(n[1]=this.incWord(n[1]))}calculate(n,e,t){let i;if(!(i=e.length))return[];const s=Fe.bitLength(e);for(let o=0;o<i;o+=4){this.incCounter(t);const r=n.encrypt(t);e[o]^=r[0],e[o+1]^=r[1],e[o+2]^=r[2],e[o+3]^=r[3]}return Fe.clamp(e,s)}};const kt={importKey(n){return new kt.hmacSha1(ci.bytes.toBits(n))},pbkdf2(n,e,t,i){if(t=t||1e4,i<0||t<0)throw new Error("invalid params to pbkdf2");const s=(i>>5)+1<<2;let o,r,l,a,c;const u=new ArrayBuffer(s),h=new DataView(u);let f=0;const p=Fe;for(e=ci.bytes.toBits(e),c=1;f<(s||1);c++){for(o=r=n.encrypt(p.concat(e,[c])),l=1;l<t;l++)for(r=n.encrypt(r),a=0;a<r.length;a++)o[a]^=r[a];for(l=0;f<(s||1)&&l<o.length;l++)h.setInt32(f,o[l]),f+=4}return u.slice(0,i/8)}};kt.hmacSha1=class{constructor(n){const e=this,t=e._hash=xr.sha1,i=[[],[]];e._baseHash=[new t,new t];const s=e._baseHash[0].blockSize/32;n.length>s&&(n=new t().update(n).finalize());for(let o=0;o<s;o++)i[0][o]=n[o]^909522486,i[1][o]=n[o]^1549556828;e._baseHash[0].update(i[0]),e._baseHash[1].update(i[1]),e._resultHash=new t(e._baseHash[0])}reset(){const n=this;n._resultHash=new n._hash(n._baseHash[0]),n._updated=!1}update(n){const e=this;e._updated=!0,e._resultHash.update(n)}digest(){const n=this,e=n._resultHash.finalize(),t=new n._hash(n._baseHash[1]).update(e).finalize();return n.reset(),t}encrypt(n){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(n),this.digest(n)}};const Nf=typeof crypto!=ft&&typeof crypto.getRandomValues==Dt,Sr="Invalid password",Mr="Invalid signature",ws="zipjs-abort-check-password";function Tr(n){return Nf?crypto.getRandomValues(n):Lf.getRandomValues(n)}const qt=16,Uf="raw",Dr={name:"PBKDF2"},_f={name:"HMAC"},Qf="SHA-1",Hf=Object.assign({hash:_f},Dr),bs=Object.assign({iterations:1e3,hash:{name:Qf}},Dr),Gf=["deriveBits"],Cn=[8,12,16],En=[16,24,32],pt=10,Yf=[0,0,0,0],di=typeof crypto!=ft,wn=di&&crypto.subtle,kr=di&&typeof wn!=ft,Je=ci.bytes,Vf=Ir.aes,Wf=Br.ctrGladman,zf=kt.hmacSha1;let Pr=di&&kr&&typeof wn.importKey==Dt,Fr=di&&kr&&typeof wn.deriveBits==Dt;class jf extends TransformStream{constructor({password:e,rawPassword:t,signed:i,encryptionStrength:s,checkPasswordOnly:o}){super({start(){Object.assign(this,{ready:new Promise(r=>this.resolveReady=r),password:Lr(e,t),signed:i,strength:s-1,pending:new Uint8Array})},async transform(r,l){const a=this,{password:c,strength:u,resolveReady:h,ready:f}=a;c?(await Kf(a,u,c,Qe(r,0,Cn[u]+2)),r=Qe(r,Cn[u]+2),o?l.error(new Error(ws)):h()):await f;const p=new Uint8Array(r.length-pt-(r.length-pt)%qt);l.enqueue(Rr(a,r,p,0,pt,!0))},async flush(r){const{signed:l,ctr:a,hmac:c,pending:u,ready:h}=this;if(c&&a){await h;const f=Qe(u,0,u.length-pt),p=Qe(u,u.length-pt);let A=new Uint8Array;if(f.length){const C=vn(Je,f);c.update(C);const m=a.update(C);A=bn(Je,m)}if(l){const C=Qe(bn(Je,c.digest()),0,pt);for(let m=0;m<pt;m++)if(C[m]!=p[m])throw new Error(Mr)}r.enqueue(A)}}})}}class $f extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:i}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:Lr(e,t),strength:i-1,pending:new Uint8Array})},async transform(o,r){const l=this,{password:a,strength:c,resolveReady:u,ready:h}=l;let f=new Uint8Array;a?(f=await Xf(l,c,a),u()):await h;const p=new Uint8Array(f.length+o.length-o.length%qt);p.set(f,0),r.enqueue(Rr(l,o,p,f.length,0))},async flush(o){const{ctr:r,hmac:l,pending:a,ready:c}=this;if(l&&r){await c;let u=new Uint8Array;if(a.length){const h=r.update(vn(Je,a));l.update(h),u=bn(Je,h)}s.signature=bn(Je,l.digest()).slice(0,pt),o.enqueue(vs(u,s.signature))}}}),s=this}}function Rr(n,e,t,i,s,o){const{ctr:r,hmac:l,pending:a}=n,c=e.length-s;a.length&&(e=vs(a,e),t=Zf(t,c-c%qt));let u;for(u=0;u<=c-qt;u+=qt){const h=vn(Je,Qe(e,u,u+qt));o&&l.update(h);const f=r.update(h);o||l.update(f),t.set(bn(Je,f),u+i)}return n.pending=Qe(e,u),t}async function Kf(n,e,t,i){const s=await Or(n,e,t,Qe(i,0,Cn[e])),o=Qe(i,Cn[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error(Sr)}async function Xf(n,e,t){const i=Tr(new Uint8Array(Cn[e])),s=await Or(n,e,t,i);return vs(i,s)}async function Or(n,e,t,i){n.password=null;const s=await qf(Uf,t,Hf,!1,Gf),o=await Jf(Object.assign({salt:i},bs),s,8*(En[e]*2+2)),r=new Uint8Array(o),l=vn(Je,Qe(r,0,En[e])),a=vn(Je,Qe(r,En[e],En[e]*2)),c=Qe(r,En[e]*2);return Object.assign(n,{keys:{key:l,authentication:a,passwordVerification:c},ctr:new Wf(new Vf(l),Array.from(Yf)),hmac:new zf(a)}),c}async function qf(n,e,t,i,s){if(Pr)try{return await wn.importKey(n,e,t,i,s)}catch{return Pr=!1,kt.importKey(e)}else return kt.importKey(e)}async function Jf(n,e,t){if(Fr)try{return await wn.deriveBits(n,e,t)}catch{return Fr=!1,kt.pbkdf2(e,n.salt,bs.iterations,t)}else return kt.pbkdf2(e,n.salt,bs.iterations,t)}function Lr(n,e){return e===he?Of(n):e}function vs(n,e){let t=n;return n.length+e.length&&(t=new Uint8Array(n.length+e.length),t.set(n,0),t.set(e,n.length)),t}function Zf(n,e){if(e&&e>n.length){const t=n;n=new Uint8Array(e),n.set(t,0)}return n}function Qe(n,e,t){return n.subarray(e,t)}function bn(n,e){return n.fromBits(e)}function vn(n,e){return n.toBits(e)}const xn=12;class ep extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:i}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),_r(this,e)},transform(s,o){const r=this;if(r.password){const l=Nr(r,s.subarray(0,xn));if(r.password=null,l.at(-1)!=r.passwordVerification)throw new Error(Sr);s=s.subarray(xn)}i?o.error(new Error(ws)):o.enqueue(Nr(r,s))}})}}class tp extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),_r(this,e)},transform(i,s){const o=this;let r,l;if(o.password){o.password=null;const a=Tr(new Uint8Array(xn));a[xn-1]=o.passwordVerification,r=new Uint8Array(i.length+a.length),r.set(Ur(o,a),0),l=xn}else r=new Uint8Array(i.length),l=0;r.set(Ur(o,i),l),s.enqueue(r)}})}}function Nr(n,e){const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=Qr(n)^e[i],xs(n,t[i]);return t}function Ur(n,e){const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=Qr(n)^e[i],xs(n,e[i]);return t}function _r(n,e){const t=[305419896,591751049,878082192];Object.assign(n,{keys:t,crcKey0:new li(t[0]),crcKey2:new li(t[2])});for(let i=0;i<e.length;i++)xs(n,e.charCodeAt(i))}function xs(n,e){let[t,i,s]=n.keys;n.crcKey0.append([e]),t=~n.crcKey0.get(),i=Gr(Math.imul(Gr(i+Hr(t)),134775813)+1),n.crcKey2.append([i>>>24]),s=~n.crcKey2.get(),n.keys=[t,i,s]}function Qr(n){const e=n.keys[2]|2;return Hr(Math.imul(e,e^1)>>>8)}function Hr(n){return n&255}function Gr(n){return n&4294967295}const Yr="Invalid uncompressed size",np="deflate-raw",ip="deflate64-raw";class sp extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:i,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:l,zipCrypto:a,signed:c,level:u}=e,h=this;let f,p,A=super.readable;(!r||a)&&c&&(f=new vr,A=Ze(A,f)),o&&(A=Wr(A,l,{level:u,chunkSize:t},s,i,s)),r&&(a?A=Ze(A,new tp(e)):(p=new $f(e),A=Ze(A,p))),Vr(h,A,()=>{let C;r&&!a&&(C=p.signature),(!r||a)&&c&&(C=new DataView(f.value.buffer).getUint32(0)),h.signature=C})}}class op extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:i,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:l,signature:a,compressed:c,useCompressionStream:u,deflate64:h}=e;let f,p,A=super.readable;r&&(o?A=Ze(A,new ep(e)):(p=new jf(e),A=Ze(A,p))),c&&(A=Wr(A,u,{chunkSize:t,deflate64:h},s,i,s)),(!r||o)&&l&&(f=new vr,A=Ze(A,f)),Vr(this,A,()=>{if((!r||o)&&l){const C=new DataView(f.value.buffer);if(a!=C.getUint32(0,!1))throw new Error(Mr)}})}}function Vr(n,e,t){e=Ze(e,new TransformStream({flush:t})),Object.defineProperty(n,"readable",{get(){return e}})}function Wr(n,e,t,i,s,o){const r=e&&i?i:s||o,l=t.deflate64?ip:np;try{n=Ze(n,new r(l,t))}catch(a){if(e)if(s)n=Ze(n,new s(l,t));else if(o)n=Ze(n,new o(l,t));else throw a;else throw a}return n}function Ze(n,e){return n.pipeThrough(e)}const rp="message",ap="start",lp="pull",zr="data",cp="ack",jr="close",dp="deflate",$r="inflate";class up extends TransformStream{constructor(e,t){super({});const i=this,{codecType:s}=e;let o;s.startsWith(dp)?o=sp:s.startsWith($r)&&(o=op),i.outputSize=0;let r=0;const l=new o(e,t),a=super.readable,c=new TransformStream({transform(h,f){h&&h.length&&(r+=h.length,f.enqueue(h))},flush(){Object.assign(i,{inputSize:r})}}),u=new TransformStream({transform(h,f){if(h&&h.length&&(f.enqueue(h),i.outputSize+=h.length,e.outputSize!==he&&i.outputSize>e.outputSize))throw new Error(Yr)},flush(){const{signature:h}=l;Object.assign(i,{signature:h,inputSize:r})}});Object.defineProperty(i,"readable",{get(){return a.pipeThrough(c).pipeThrough(l).pipeThrough(u)}})}}class hp extends TransformStream{constructor(e){let t;super({transform:i,flush(s){t&&t.length&&s.enqueue(t)}});function i(s,o){if(t){const r=new Uint8Array(t.length+s.length);r.set(t),r.set(s,t.length),s=r,t=null}s.length>e?(o.enqueue(s.slice(0,e)),i(s.slice(e),o)):t=s}}}let Kr=typeof Worker!=ft,Xr=()=>{};function fp({initModule:n}){Xr=n}class Is{constructor(e,{readable:t,writable:i},{options:s,config:o,streamOptions:r,useWebWorkers:l,transferStreams:a,workerURI:c},u){const{signal:h}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new hp(o.chunkSize)).pipeThrough(new pp(r),{signal:h}),writable:i,options:Object.assign({},s),workerURI:c,transferStreams:a,terminate(){return new Promise(f=>{const{worker:p,busy:A}=e;p?(A?e.resolveTerminated=f:(p.terminate(),f()),e.interface=null):f()})},onTaskFinished(){const{resolveTerminated:f}=e;f&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),f()),e.busy=!1,u(e)}}),(l&&Kr?gp:qr)(e,o)}}class pp extends TransformStream{constructor({onstart:e,onprogress:t,size:i,onend:s}){let o=0;super({async start(){e&&await Bs(e,i)},async transform(r,l){o+=r.length,t&&await Bs(t,o,i),l.enqueue(r)},async flush(){s&&await Bs(s,o)}})}}async function Bs(n,...e){try{await n(...e)}catch{}}function qr(n,e){return{run:()=>mp(n,e)}}function gp(n,e){const{baseURI:t,chunkSize:i}=e;let{wasmURI:s}=e;if(!n.interface){typeof s==Dt&&(s=s());let o;try{o=Cp(n.workerURI,t,n)}catch{return Kr=!1,qr(n,e)}Object.assign(n,{worker:o,interface:{run:()=>Ap(n,{chunkSize:i,wasmURI:s,baseURI:t})}})}return n.interface}async function mp({options:n,readable:e,writable:t,onTaskFinished:i},s){let o;try{if(!n.useCompressionStream)try{await Xr(s)}catch{n.useCompressionStream=!0}o=new up(n,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:l,outputSize:a}=o;return{signature:r,inputSize:l,outputSize:a}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{i()}}async function Ap(n,e){let t,i;const s=new Promise((h,f)=>{t=h,i=f});Object.assign(n,{reader:null,writer:null,resolveResult:t,rejectResult:i,result:s});const{readable:o,options:r}=n,{writable:l,closed:a}=yp(n.writable),c=ui({type:ap,options:r,config:e,readable:o,writable:l},n);c||Object.assign(n,{reader:o.getReader(),writer:l.getWriter()});const u=await s;return c||await l.getWriter().close(),await a,u}function yp(n){let e;const t=new Promise(s=>e=s);return{writable:new WritableStream({async write(s){const o=n.getWriter();await o.ready,await o.write(s),o.releaseLock()},close(){e()},abort(s){return n.getWriter().abort(s)}}),closed:t}}let Jr=!0;function Cp(n,e,t){const i={type:"module"};let s,o;if(typeof n==Dt&&(n=n()),n.startsWith("data:")||n.startsWith("blob:"))try{o=new Worker(n)}catch{o=new Worker(n,i)}else{try{s=new URL(n,e)}catch{s=n}o=new Worker(s,i)}return o.addEventListener(rp,r=>Ep(r,t)),o}function ui(n,{worker:e,writer:t,onTaskFinished:i,transferStreams:s}){try{const{value:o,readable:r,writable:l}=n,a=[];if(o&&(n.value=o,a.push(n.value.buffer)),s&&Jr?(r&&a.push(r),l&&a.push(l)):n.readable=n.writable=null,a.length)try{return e.postMessage(n,a),!0}catch{Jr=!1,n.readable=n.writable=null,e.postMessage(n)}else e.postMessage(n)}catch(o){throw t&&t.releaseLock(),i(),o}}async function Ep({data:n},e){const{type:t,value:i,messageId:s,result:o,error:r}=n,{reader:l,writer:a,resolveResult:c,rejectResult:u,onTaskFinished:h}=e;try{if(r){const{message:p,stack:A,code:C,name:m,outputSize:y}=r,E=new Error(p);Object.assign(E,{stack:A,code:C,name:m,outputSize:y}),f(E)}else{if(t==lp){const{value:p,done:A}=await l.read();ui({type:zr,value:p,done:A,messageId:s},e)}t==zr&&(await a.ready,await a.write(new Uint8Array(i)),ui({type:cp,messageId:s},e)),t==jr&&f(null,o)}}catch(p){ui({type:jr,messageId:s},e),f(p)}function f(p,A){p?u(p):c(A),a&&a.releaseLock(),h()}}let Pt=[];const Ss=[];let Zr=0;async function wp(n,e){const{options:t,config:i}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:l,signed:a,encrypted:c}=t,{workerURI:u,maxWorkers:h}=i;e.transferStreams=s||s===he;const f=!l&&!a&&!c&&!e.transferStreams;return e.useWebWorkers=!f&&(o||o===he&&i.useWebWorkers),e.workerURI=e.useWebWorkers&&u?u:he,t.useCompressionStream=r||r===he&&i.useCompressionStream,(await p()).run();async function p(){const C=Pt.find(m=>!m.busy);if(C)return ea(C),new Is(C,n,e,A);if(Pt.length<h){const m={indexWorker:Zr};return Zr++,Pt.push(m),new Is(m,n,e,A)}else return new Promise(m=>Ss.push({resolve:m,stream:n,workerOptions:e}))}function A(C){if(Ss.length){const[{resolve:m,stream:y,workerOptions:E}]=Ss.splice(0,1);m(new Is(C,y,E,A))}else C.worker?(ea(C),bp(C,e)):Pt=Pt.filter(m=>m!=C)}}function bp(n,e){const{config:t}=e,{terminateWorkerTimeout:i}=t;Number.isFinite(i)&&i>=0&&(n.terminated?n.terminated=!1:n.terminateTimeout=setTimeout(async()=>{Pt=Pt.filter(s=>s!=n);try{await n.terminate()}catch{}},i))}function ea(n){const{terminateTimeout:e}=n;e&&(clearTimeout(e),n.terminateTimeout=null)}const vp="Writer iterator completed too soon",xp="Content-Type",Ip=64*1024,ta="writable";class Ms{constructor(){this.size=0}init(){this.initialized=!0}}class na extends Ms{get readable(){const e=this,{chunkSize:t=Ip}=e,i=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:l}=i,{chunkOffset:a}=this,c=r===he?t:Math.min(t,r-a),u=await Se(e,o+a,c,l);s.enqueue(u),a+t>r||r===he&&!u.length&&c?s.close():this.chunkOffset+=t}});return i}}class Ts extends na{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,t){const i=this,s=e+t;let r=await(e||s<i.size?i.blob.slice(e,s):i.blob).arrayBuffer();return r.byteLength>t&&(r=r.slice(e,s)),new Uint8Array(r)}}class Bp extends Ms{constructor(e){super();const t=this,i=new TransformStream,s=[];e&&s.push([xp,e]),Object.defineProperty(t,ta,{get(){return i.writable}}),t.blob=new Response(i.readable,{headers:s}).blob()}getData(){return this.blob}}class Sp extends Bp{constructor(e){super(e),Object.assign(this,{encoding:e,utf8:!e||e.toLowerCase()=="utf-8"})}async getData(){const{encoding:e,utf8:t}=this,i=await super.getData();if(i.text&&t)return i.text();{const s=new FileReader;return new Promise((o,r)=>{Object.assign(s,{onload:({target:l})=>o(l.result),onerror:()=>r(s.error)}),s.readAsText(i,e)})}}}class Mp extends na{constructor(e){super(),this.readers=e}async init(){const e=this,{readers:t}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(t.map(async(i,s)=>{await i.init(),s!=t.length-1&&(e.lastDiskOffset+=i.size),e.size+=i.size})),super.init()}async readUint8Array(e,t,i=0){const s=this,{readers:o}=this;let r,l=i;l==-1&&(l=o.length-1);let a=e;for(;o[l]&&a>=o[l].size;)a-=o[l].size,l++;const c=o[l];if(c){const u=c.size;if(a+t<=u)r=await Se(c,a,t);else{const h=u-a;r=new Uint8Array(t);const f=await Se(c,a,h);r.set(f,0);const p=await s.readUint8Array(e+h,t-h,i);r.set(p,h),f.length+p.length<t&&(r=r.subarray(0,f.length+p.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(l,s.lastDiskNumber),r}}class ia extends Ms{constructor(e,t=4294967295){super();const i=this;Object.assign(i,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});let s,o,r;const l=new WritableStream({async write(u){const{availableSize:h}=i;if(r)u.length>=h?(await a(u.subarray(0,h)),await c(),i.diskOffset+=s.size,i.diskNumber++,r=null,await this.write(u.subarray(h))):await a(u);else{const{value:f,done:p}=await e.next();if(p&&!f)throw new Error(vp);s=f,s.size=0,s.maxSize&&(i.maxSize=s.maxSize),i.availableSize=i.maxSize,await hi(s),o=f.writable,r=o.getWriter(),await this.write(u)}},async close(){await r.ready,await c()}});Object.defineProperty(i,ta,{get(){return l}});async function a(u){const h=u.length;h&&(await r.ready,await r.write(u),s.size+=h,i.size+=h,i.availableSize-=h)}async function c(){await r.close()}}}class Tp{constructor(e){return Array.isArray(e)&&(e=new Mp(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class Dp{constructor(e){return e.writable===he&&typeof e.next==Dt&&(e=new ia(e)),e instanceof WritableStream&&(e={writable:e}),e.size===he&&(e.size=0),e instanceof ia||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function hi(n,e){if(n.init&&!n.initialized)await n.init(e);else return Promise.resolve()}function Se(n,e,t,i){return n.readUint8Array(e,t,i)}const sa="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),kp=sa.length==256;function Pp(n){if(kp){let e="";for(let t=0;t<n.length;t++)e+=sa[n[t]];return e}else return new TextDecoder().decode(n)}function fi(n,e){return e&&e.trim().toLowerCase()=="cp437"?Pp(n):new TextDecoder(e).decode(n)}const oa="filename",ra="rawFilename",aa="comment",la="rawComment",ca="uncompressedSize",da="compressedSize",ua="offset",ha="diskNumberStart",Ds="lastModDate",ks="rawLastModDate",fa="lastAccessDate",Fp="rawLastAccessDate",pa="creationDate",ga="rawCreationDate",Rp=[oa,ra,ca,da,Ds,ks,aa,la,fa,pa,ga,ua,ha,"internalFileAttributes","externalFileAttributes","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","compressionMethod","signature","extraField","extraFieldUnix","extraFieldInfoZip","uid","gid","unixMode","setuid","setgid","sticky","bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class ma{constructor(e){Rp.forEach(t=>this[t]=e[t])}}const Op="filenameEncoding",Lp="commentEncoding",Np="decodeText",Up="extractPrependedData",_p="extractAppendedData",Qp="password",Hp="rawPassword",Gp="passThrough",Yp="signal",Vp="checkPasswordOnly",Wp="checkOverlappingEntryOnly",zp="checkOverlappingEntry",jp="checkSignature",$p="useWebWorkers",Kp="useCompressionStream",Xp="transferStreams",qp="preventClose",Ps="File format is not recognized",Jp="End of central directory not found",Zp="End of Zip64 central directory locator not found",eg="Central directory header not found",tg="Local file header not found",ng="Zip64 extra field not found",ig="File contains encrypted entry",sg="Encryption method not supported",Aa="Compression method not supported",ya="Split zip file",og="Overlapping entry found",Ca="utf-8",rg="UTF8",Ea="cp437",ag=[[ca,Tt],[da,Tt],[ua,Tt],[ha,qe]],lg={[qe]:{getValue:fe,bytes:4},[Tt]:{getValue:Jt,bytes:8}};class wa{constructor(e,t={}){Object.assign(this,{reader:new Tp(e),options:t,config:Pf(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:i}=t;const{config:s}=t;if(await hi(i),(i.size===he||!i.readUint8Array)&&(i=new Ts(await new Response(i.readable).blob()),await hi(i)),i.size<Xt)throw new Error(Ps);i.chunkSize=Ff(s);const o=await gg(i,tf,i.size,Xt,qe*16);if(!o){const P=await Se(i,0,4),F=pe(P);throw fe(F)==hr?new Error(ya):new Error(Jp)}const r=pe(o);let l=fe(r,12),a=fe(r,16);const c=o.offset,u=Ie(r,20),h=c+Xt+u;let f=Ie(r,4);const p=i.lastDiskNumber||0;let A=Ie(r,6),C=Ie(r,8),m=0,y=0;if(a==Tt||l==Tt||C==qe||A==qe){const P=await Se(i,o.offset-ms,ms),F=pe(P);if(fe(F,0)==nf){a=Jt(F,8);let L=await Se(i,a,As,-1),G=pe(L);const O=o.offset-ms-As;if(fe(G,0)!=pr&&a!=O){const v=a;a=O,a>v&&(m=a-v),L=await Se(i,a,As,-1),G=pe(L)}if(fe(G,0)!=pr)throw new Error(Zp);f==qe&&(f=fe(G,16)),A==qe&&(A=fe(G,20)),C==qe&&(C=Jt(G,32)),l==Tt&&(l=Jt(G,40)),a-=l}}if(a>=i.size&&(m=i.size-a-l-Xt,a=i.size-l-Xt),p!=f)throw new Error(ya);if(a<0)throw new Error(Ps);let E=0,x=await Se(i,a,l,A),M=pe(x);if(l){const P=o.offset-l;if(fe(M,E)!=fr&&a!=P){const F=a;a=P,a>F&&(m+=a-F),x=await Se(i,a,l,A),M=pe(x)}}const T=o.offset-a-(i.lastDiskOffset||0);if(l!=T&&T>=0&&(l=T,x=await Se(i,a,l,A),M=pe(x)),a<0||a>=i.size)throw new Error(Ps);const S=Me(t,e,Op),I=Me(t,e,Lp);for(let P=0;P<C;P++){const F=new cg(i,s,t.options);if(fe(M,E)!=fr)throw new Error(eg);ba(F,M,E+6);const L=!!F.bitFlag.languageEncodingFlag,G=E+46,O=G+F.filenameLength,v=O+F.extraFieldLength,w=Ie(M,E+4),b=w>>8==0,B=w>>8==3,R=x.subarray(G,O),U=Ie(M,E+32),N=v+U,D=x.subarray(v,N),Q=L,V=L,$=fe(M,E+38),J=$&gs,ne={readOnly:!!(J&yf),hidden:!!(J&Cf),system:!!(J&Ef),directory:!!(J&Af),archive:!!(J&wf)},re=fe(M,E+42)+m,Y=Me(t,e,Np)||fi,j=Q?Ca:S||Ea,X=V?Ca:I||Ea;let se=Y(R,j);se===he&&(se=fi(R,j));let oe=Y(D,X);oe===he&&(oe=fi(D,X)),Object.assign(F,{versionMadeBy:w,msDosCompatible:b,compressedSize:0,uncompressedSize:0,commentLength:U,offset:re,diskNumberStart:Ie(M,E+34),internalFileAttributes:Ie(M,E+36),externalFileAttributes:$,msdosAttributesRaw:J,msdosAttributes:ne,rawFilename:R,filenameUTF8:Q,commentUTF8:V,rawExtraField:x.subarray(O,v),rawComment:D,filename:se,comment:oe}),y=Math.max(re,y),va(F,F,M,E+6);const ae=F.externalFileAttributes>>16&qe;F.unixMode===he&&(ae&(bf|Cs|ys))!=0&&(F.unixMode=ae);const Ce=!!(F.unixMode&vf),le=!!(F.unixMode&xf),Pe=!!(F.unixMode&If),ct=F.unixMode!==he?(F.unixMode&Cs)!=0:B&&(ae&Cs)!=0,$e=F.unixMode!==he&&(F.unixMode&Cr)==ys,vt=(ae&Cr)==ys;Object.assign(F,{setuid:Ce,setgid:le,sticky:Pe,unixExternalUpper:ae,internalFileAttribute:F.internalFileAttributes,externalFileAttribute:F.externalFileAttributes,executable:ct,directory:$e||vt||b&&ne.directory||se.endsWith(Bf)&&!F.uncompressedSize,zipCrypto:F.encrypted&&!F.extraFieldAES});const it=new ma(F);it.getData=(Ut,_t)=>F.getData(Ut,it,t.readRanges,_t),it.arrayBuffer=async Ut=>{const _t=new TransformStream,[Xi]=await Promise.all([new Response(_t.readable).arrayBuffer(),F.getData(_t,it,t.readRanges,Ut)]);return Xi},E=N;const{onprogress:dn}=e;if(dn)try{await dn(P+1,C,new ma(F))}catch{}yield it}const g=Me(t,e,Up),k=Me(t,e,_p);return g&&(t.prependedData=y>0?await Se(i,0,y):new Uint8Array),t.comment=u?await Se(i,c+Xt,u):new Uint8Array,k&&(t.appendedData=h<i.size?await Se(i,h,i.size-h):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const i of this.getEntriesGenerator(e))t.push(i);return t}async close(){}}class cg{constructor(e,t,i){Object.assign(this,{reader:e,config:t,options:i})}async getData(e,t,i,s={}){const o=this,{reader:r,offset:l,diskNumberStart:a,extraFieldAES:c,extraFieldZip64:u,compressionMethod:h,config:f,bitFlag:p,signature:A,rawLastModDate:C,uncompressedSize:m,compressedSize:y}=o,{dataDescriptor:E}=p,x=t.localDirectory={},M=await Se(r,l,Es,a),T=pe(M);let S=Me(o,s,Qp),I=Me(o,s,Hp);const g=Me(o,s,Gp);if(S=S&&S.length&&S,I=I&&I.length&&I,c&&c.originalCompressionMethod!=Jh)throw new Error(Aa);if(h!=qh&&h!=Xh&&h!=ur&&!g)throw new Error(Aa);if(fe(T,0)!=Zh)throw new Error(tg);ba(x,T,4);const{extraFieldLength:k,filenameLength:P,lastAccessDate:F,creationDate:L}=x;x.rawExtraField=k?await Se(r,l+Es+P,k,a):new Uint8Array,va(o,x,T,4,!0),Object.assign(t,{lastAccessDate:F,creationDate:L});const G=o.encrypted&&x.encrypted&&!g,O=G&&!c;if(g||(t.zipCrypto=O),G){if(!O&&c.strength===he)throw new Error(sg);if(!S&&!I)throw new Error(ig)}const v=l+Es+P+k,w=y,b=r.readable;Object.assign(b,{diskNumberStart:a,offset:v,size:w});const B=Me(o,s,Yp),R=Me(o,s,Vp);let U=Me(o,s,zp);const N=Me(o,s,Wp);N&&(U=!0);const{onstart:D,onprogress:Q,onend:V}=s,$=h==ur;let J=Me(o,s,Kp);$&&(J=!1);const ne={options:{codecType:$r,password:S,rawPassword:I,zipCrypto:O,encryptionStrength:c&&c.strength,signed:Me(o,s,jp)&&!g,passwordVerification:O&&(E?C>>>8&gs:A>>>24&gs),outputSize:g?y:m,signature:A,compressed:h!=0&&!g,encrypted:o.encrypted&&!g,useWebWorkers:Me(o,s,$p),useCompressionStream:J,transferStreams:Me(o,s,Xp),deflate64:$,checkPasswordOnly:R},config:f,streamOptions:{signal:B,size:w,onstart:D,onprogress:Q,onend:V}};U&&await pg({reader:r,fileEntry:t,offset:l,diskNumberStart:a,signature:A,compressedSize:y,uncompressedSize:m,dataOffset:v,dataDescriptor:E||x.bitFlag.dataDescriptor,extraFieldZip64:u||x.extraFieldZip64,readRanges:i});let re;try{if(!N){R&&(e=new WritableStream),e=new Dp(e),await hi(e,g?y:m),{writable:re}=e;const{outputSize:Y}=await wp({readable:b,writable:re},ne);if(e.size+=Y,Y!=(g?y:m))throw new Error(Yr)}}catch(Y){if(Y.outputSize!==he&&(e.size+=Y.outputSize),!R||Y.message!=ws)throw Y}finally{!Me(o,s,qp)&&re&&!re.locked&&await re.getWriter().close()}return R||N?he:e.getData?e.getData():re}}function ba(n,e,t){const i=n.rawBitFlag=Ie(e,t+2),s=(i&mr)==mr,o=fe(e,t+6);Object.assign(n,{encrypted:s,version:Ie(e,t),bitFlag:{level:(i&mf)>>1,dataDescriptor:(i&Ar)==Ar,languageEncodingFlag:(i&yr)==yr},rawLastModDate:o,lastModDate:mg(o),filenameLength:Ie(e,t+22),extraFieldLength:Ie(e,t+24)})}function va(n,e,t,i,s){const{rawExtraField:o}=e,r=e.extraField=new Map,l=pe(new Uint8Array(o));let a=0;try{for(;a<o.length;){const E=Ie(l,a),x=Ie(l,a+2);r.set(E,{type:E,data:o.slice(a+4,a+4+x)}),a+=4+x}}catch{}const c=Ie(t,i+4);Object.assign(e,{signature:fe(t,i+Sf),compressedSize:fe(t,i+Mf),uncompressedSize:fe(t,i+Tf)});const u=r.get(rf);u&&(dg(u,e),e.extraFieldZip64=u);const h=r.get(uf);h&&(xa(h,oa,ra,e,n),e.extraFieldUnicodePath=h);const f=r.get(hf);f&&(xa(f,aa,la,e,n),e.extraFieldUnicodeComment=f);const p=r.get(af);p?(ug(p,e,c),e.extraFieldAES=p):e.compressionMethod=c;const A=r.get(lf);A&&(hg(A,e),e.extraFieldNTFS=A);const C=r.get(gf);if(C)Ia(C,e,!1),e.extraFieldUnix=C;else{const E=r.get(pf);E&&(Ia(E,e,!0),e.extraFieldInfoZip=E)}const m=r.get(df);m&&(fg(m,e,s),e.extraFieldExtendedTimestamp=m);const y=r.get(ff);y&&(e.extraFieldUSDZ=y)}function dg(n,e){e.zip64=!0;const t=pe(n.data),i=ag.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<i.length;s++){const[r,l]=i[s];if(e[r]==l){const a=lg[l];e[r]=n[r]=a.getValue(t,o),o+=a.bytes}else if(n[r])throw new Error(ng)}}function xa(n,e,t,i,s){const o=pe(n.data),r=new li;r.append(s[t]);const l=pe(new Uint8Array(4));l.setUint32(0,r.get(),!0);const a=fe(o,1);Object.assign(n,{version:gt(o,0),[e]:fi(n.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&a==fe(l,0)}),n.valid&&(i[e]=n[e],i[e+rg]=!0)}function ug(n,e,t){const i=pe(n.data),s=gt(i,4);Object.assign(n,{vendorVersion:gt(i,0),vendorId:gt(i,2),strength:s,originalCompressionMethod:t,compressionMethod:Ie(i,5)}),e.compressionMethod=n.compressionMethod}function hg(n,e){const t=pe(n.data);let i=4,s;try{for(;i<n.data.length&&!s;){const o=Ie(t,i),r=Ie(t,i+2);o==cf&&(s=n.data.slice(i+4,i+4+r)),i+=4+r}}catch{}try{if(s&&s.length==24){const o=pe(s),r=o.getBigUint64(0,!0),l=o.getBigUint64(8,!0),a=o.getBigUint64(16,!0);Object.assign(n,{rawLastModDate:r,rawLastAccessDate:l,rawCreationDate:a});const c=Fs(r),u=Fs(l),h=Fs(a),f={lastModDate:c,lastAccessDate:u,creationDate:h};Object.assign(n,f),Object.assign(e,f)}}catch{}}function Ia(n,e,t){try{const i=pe(new Uint8Array(n.data));let s=0;const o=gt(i,s++),r=gt(i,s++),l=n.data.subarray(s,s+r);s+=r;const a=Ba(l),c=gt(i,s++),u=n.data.subarray(s,s+c);s+=c;const h=Ba(u);let f=he;if(!t&&s+2<=n.data.length){const p=n.data;f=new DataView(p.buffer,p.byteOffset+s,2).getUint16(0,!0)}Object.assign(n,{version:o,uid:a,gid:h,unixMode:f}),a!==he&&(e.uid=a),h!==he&&(e.gid=h),f!==he&&(e.unixMode=f)}catch{}}function Ba(n){const e=new Uint8Array(4);return e.set(n,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function fg(n,e,t){const i=pe(n.data),s=gt(i,0),o=[],r=[];t?((s&1)==1&&(o.push(Ds),r.push(ks)),(s&2)==2&&(o.push(fa),r.push(Fp)),(s&4)==4&&(o.push(pa),r.push(ga))):n.data.length>=5&&(o.push(Ds),r.push(ks));let l=1;o.forEach((a,c)=>{if(n.data.length>=l+4){const u=fe(i,l);e[a]=n[a]=new Date(u*1e3);const h=r[c];n[h]=u}l+=4})}async function pg({reader:n,fileEntry:e,offset:t,diskNumberStart:i,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:l,dataDescriptor:a,extraFieldZip64:c,readRanges:u}){let h=0;if(i)for(let A=0;A<i;A++){const C=n.readers[A];h+=C.size}let f=0;if(a&&(c?f=of:f=sf),f){const A=await Se(n,l+o,f+gr,i);if(fe(pe(A),0)==ef){const m=fe(pe(A),4);let y,E;c?(y=Jt(pe(A),8),E=Jt(pe(A),16)):(y=fe(pe(A),8),E=fe(pe(A),12)),(e.encrypted&&!e.zipCrypto||m==s)&&y==o&&E==r&&(f+=gr)}}const p={start:h+t,end:h+l+o+f,fileEntry:e};for(const A of u)if(A.fileEntry!=e&&p.start>=A.start&&p.start<A.end){const C=new Error(og);throw C.overlappingEntry=A.fileEntry,C}u.push(p)}async function gg(n,e,t,i,s){const o=new Uint8Array(4),r=pe(o);Ag(r,0,e);const l=i+s;return await a(i)||await a(Math.min(l,t));async function a(c){const u=t-c,h=await Se(n,u,c);for(let f=h.length-i;f>=0;f--)if(h[f]==o[0]&&h[f+1]==o[1]&&h[f+2]==o[2]&&h[f+3]==o[3])return{offset:u+f,buffer:h.slice(f,f+i).buffer}}}function Me(n,e,t){return e[t]===he?n.options[t]:e[t]}function mg(n){const e=(n&4294901760)>>16,t=n&qe;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(t&63488)>>11,(t&2016)>>5,(t&31)*2,0)}catch{}}function Fs(n){return new Date(Number(n/BigInt(1e4)-BigInt(116444736e5)))}function gt(n,e){return n.getUint8(e)}function Ie(n,e){return n.getUint16(e,!0)}function fe(n,e){return n.getUint32(e,!0)}function Jt(n,e){return Number(n.getBigUint64(e,!0))}function Ag(n,e,t){n.setUint32(e,t,!0)}function pe(n){return new DataView(n.buffer)}try{ai({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:es&&es.tagName.toUpperCase()==="SCRIPT"&&es.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function yg(n){let e;n({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const l=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,a=[];for(let c=0;l>c;c+=4){const u=Le.indexOf(r[c])<<18|Le.indexOf(r[c+1])<<12|(63&Le.indexOf(r[c+2]))<<6|63&Le.indexOf(r[c+3]);a.push(u>>16&255),r[c+2]!=="="&&a.push(u>>8&255),r[c+3]!=="="&&a.push(255&u)}return new Uint8Array(a)})(t);let i=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const l=t[r++];if(128&l){const a=3+(127&l),c=t[r++]<<8|t[r++],u=s-c;o(s+a);for(let h=0;a>h;h++)i[s++]=i[u+h]}else{const a=l;o(s+a);for(let c=0;a>c&&r<t.length;c++)i[s++]=t[r++]}}return(r=>{let l="";const a=r.length;let c=0;for(;a>c+2;c+=3){const h=r[c]<<16|r[c+1]<<8|r[c+2];l+=Le[h>>18&63]+Le[h>>12&63]+Le[h>>6&63]+Le[63&h]}const u=a-c;if(u===1){const h=r[c]<<16;l+=Le[h>>18&63]+Le[h>>12&63]+"=="}else if(u===2){const h=r[c]<<16|r[c+1]<<8;l+=Le[h>>18&63]+Le[h>>12&63]+Le[h>>6&63]+"="}return l})(new Uint8Array(i.buffer.slice(0,s)));function o(r){if(i.length<r){let l=2*i.length;for(;r>l;)l*=2;const a=new Uint8Array(l);a.set(i.subarray(0,s)),i=a}}})("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BAGZgAAEAVmAAAQB2YAABAE5gAAEAbmAAAQBeYAABAH5gAAEAQWAAAQBhYAABAFFgAAEAcWAAAQBJYAABAGlgAAEAWWAAAQB5YAABAEVgAAEAZWAAAQBVYAABAHVgAAEATWAAAQBtYAABAF1gAAEAfWAAAQBDYAABAGNgAAEAU2AAAQBzYAABIARMwIArYAABAFtgAAEAe2AAAQBHYAABAGdgAAEAV2AAAQB3YAABAE9gAAEAb2AAAQBfYAABAH9gAAEAROAAMIFEwEJAJOAAAgBk4AACAFTgAAIAVOAAAgB04AACAHTgAAIATOAAAgBM4AACAGzgAAIAbOAAAgBc4AACAFzgAAIAfOAAAgB84AACAELgAAIgBDagAQCgAAEgAAIAUuAAAgBS4AACAHLgAAIAcuAAAgBK4AACAErgAAIAauAAAgBq4AACAFrgAAIAWuAAAgB64AACAHrgAAIARuAAAgBG4AACAGbgAAIAZuAAAgBW4AACAFbgAAIAduAAAgB24AACAE7gAAIATuAAAgBu4AACAG7gAAIAXuAAAgBe4AACAH7gAAIAfuAAAiBA7YBB4AACAGHgAAIAYeAAAgBR4AACAFHgAAIAceAAAgBx4AACAEngAAIASeAAAgBp4AACAGngAAIAWeAAAgBZ4AACAHngAAIAeeAAAgBF4AACAEXgAAIAZeAAAgBl4AACAFXgAAIAVeAAAgB14AACAHXgAAIATeAAAgBN4AACAG3gAAIAbeAAAgBd4AACAF3gAAIAfeAAAgB94AACAEPgAAIAQ+AAAgBj4AACAGPgAAIAU+AAAgBT4AACAHPgAAIAc+AAAgBL4AACAEvgAAIAa+AAAgBr4AACAFvgAAIAW+AAAgB74AACAHvgAAIAR+AAAgBH4AACAGfgAAIAZ+AAAgBX4AACAFfgAAIAd+AAAgB34AACAE/gAAIAT+AAAgBv4AACAG/gAAIAX+AAAgBf4AACAH/gAAIAf+AAAiBBAoBQIAABAEggAAEAWCAAAQBEIAABAFQgAAEATCAAAQBcIIFVgMHAEiAAAQBKIAABAFogAAEARiAAAQBWIAABAE4gAAEAXiAAAQBBIAABAFEgAAEASSAAAQBZIAABAEUgAAEAVSAAAQBNIAABAF0gAAEAQOAAEIBg4AABAFDgAAEAcOAAAQBI4AABAGjgAAEAWOAAAQB44AABIC+K4AAdIECxgEFgABcAQWCBUoBFIAABAEMgAAEARyAAASAvlaABEQBBYIGBAEaggXqAQWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let ye,Zt,Ne,In;function Cg(n){if(ye=n,{malloc:Zt,free:Ne,memory:In}=ye,typeof Zt!="function"||typeof Ne!="function"||!In)throw ye=Zt=Ne=In=null,new Error("Invalid WASM module")}function Sa(n,e,t={}){const i=typeof t.level=="number"?t.level:-1,s=typeof t.outBuffer=="number"?t.outBuffer:64*1024,o=typeof t.inBufferSize=="number"?t.inBufferSize:64*1024;return new TransformStream({start(){let r;if(this.out=Zt(s),this.in=Zt(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),n?(this._process=ye.deflate_process,this._last_consumed=ye.deflate_last_consumed,this._end=ye.deflate_end,this.streamHandle=ye.deflate_new(),e==="gzip"?r=ye.deflate_init_gzip(this.streamHandle,i):e==="deflate-raw"?r=ye.deflate_init_raw(this.streamHandle,i):r=ye.deflate_init(this.streamHandle,i)):e==="deflate64-raw"?(this._process=ye.inflate9_process,this._last_consumed=ye.inflate9_last_consumed,this._end=ye.inflate9_end,this.streamHandle=ye.inflate9_new(),r=ye.inflate9_init_raw(this.streamHandle)):(this._process=ye.inflate_process,this._last_consumed=ye.inflate_last_consumed,this._end=ye.inflate_end,this.streamHandle=ye.inflate_new(),e==="deflate-raw"?r=ye.inflate_init_raw(this.streamHandle):e==="gzip"?r=ye.inflate_init_gzip(this.streamHandle):r=ye.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,l){try{const a=r,c=new Uint8Array(In.buffer),u=this._process,h=this._last_consumed,f=this.out,p=this._scratch;let A=0;for(;A<a.length;){const C=Math.min(a.length-A,32768);(!this.in||this.inBufferSize<C)&&(this.in&&Ne&&Ne(this.in),this.in=Zt(C),this.inBufferSize=C),c.set(a.subarray(A,A+C),this.in);const m=u(this.streamHandle,this.in,C,f,s,0),y=m&16777215;if(y&&(p.set(c.subarray(f,f+y),0),l.enqueue(p.slice(0,y))),!n){const x=m>>24&255,M=x&128?x-256:x;if(M<0)throw new Error("process error:"+M)}const E=h(this.streamHandle);if(E===0)break;A+=E}}catch(a){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Ne&&Ne(this.in),this.out&&Ne&&Ne(this.out),l.error(a)}},flush(r){try{const l=new Uint8Array(In.buffer),a=this._process,c=this.out,u=this._scratch;for(;;){const h=a(this.streamHandle,0,0,c,s,4),f=h&16777215,p=h>>24&255;if(!n){const A=p&128?p-256:p;if(A<0)throw new Error("process error:"+A)}if(f&&(u.set(l.subarray(c,c+f),0),r.enqueue(u.slice(0,f))),p===1||f===0)break}}catch(l){r.error(l)}finally{if(this._end&&this.streamHandle){const l=this._end(this.streamHandle);l!==0&&r.error(new Error("end error:"+l))}this.in&&Ne&&Ne(this.in),this.out&&Ne&&Ne(this.out)}}})}class Eg{constructor(e="deflate",t){return Sa(!0,e,t)}}class wg{constructor(e="deflate",t){return Sa(!1,e,t)}}let Ma=!1;async function bg(n,{baseURI:e}){if(!Ma){let t,i;try{try{i=new URL(n,e)}catch{}t=await(await fetch(i)).arrayBuffer()}catch(o){if(n.startsWith("data:application/wasm;base64,"))t=vg(n);else throw o}const s=await WebAssembly.instantiate(t);Cg(s.instance.exports),Ma=!0}}function vg(n){const e=n.split(",")[1],t=atob(e),i=t.length,s=new Uint8Array(i);for(let o=0;o<i;++o)s[o]=t.charCodeAt(o);return s.buffer}let Rs;yg(ai),fp({initModule:n=>{if(!Rs){let{wasmURI:e}=n;typeof e==Dt&&(e=e()),Rs=bg(e,n)}return Rs}}),ai({CompressionStreamZlib:Eg,DecompressionStreamZlib:wg});const Os={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":["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":"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"]}};(()=>{const n={};for(const e of Object.keys(Os))for(const t of Object.keys(Os[e])){const i=Os[e][t];if(typeof i=="string")n[i]=e+"/"+t;else for(let s=0;s<i.length;s++)n[i[s]]=e+"/"+t}return n})(),Rf(ai);const Ee=d.reactive({visible:!1,type:"info",title:"",description:"",closable:!1,showIcon:!0,duration:3});let Te=null,Ta=null,Da=!1,Ls=null,pi=null;function xg(){if(pi||typeof document>"u")return;const n=`
12
+ `});c.isModelAdjustment=!0,a.customShader=c}else{let c="color('white')";e!==1&&(c=`${c} * ${e}`),a.style=new i.Cesium3DTileStyle({color:c})}}}}var Fo=typeof global=="object"&&global&&global.Object===Object&&global,dd=typeof self=="object"&&self&&self.Object===Object&&self,St=Fo||dd||Function("return this")(),ni=St.Symbol,Ro=Object.prototype,ud=Ro.hasOwnProperty,hd=Ro.toString,gn=ni?ni.toStringTag:void 0;function fd(n){var e=ud.call(n,gn),t=n[gn];try{n[gn]=void 0;var i=!0}catch{}var s=hd.call(n);return i&&(e?n[gn]=t:delete n[gn]),s}var pd=Object.prototype,gd=pd.toString;function md(n){return gd.call(n)}var Ad="[object Null]",yd="[object Undefined]",Oo=ni?ni.toStringTag:void 0;function mn(n){return n==null?n===void 0?yd:Ad:Oo&&Oo in Object(n)?fd(n):md(n)}function zt(n){return n!=null&&typeof n=="object"}var Cd="[object Symbol]";function Ed(n){return typeof n=="symbol"||zt(n)&&mn(n)==Cd}var is=Array.isArray,wd=/\s/;function bd(n){for(var e=n.length;e--&&wd.test(n.charAt(e)););return e}var vd=/^\s+/;function Id(n){return n&&n.slice(0,bd(n)+1).replace(vd,"")}function Xe(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Lo=NaN,xd=/^[-+]0x[0-9a-f]+$/i,Bd=/^0b[01]+$/i,Sd=/^0o[0-7]+$/i,Md=parseInt;function No(n){if(typeof n=="number")return n;if(Ed(n))return Lo;if(Xe(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Xe(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Id(n);var t=Bd.test(n);return t||Sd.test(n)?Md(n.slice(2),t?2:8):xd.test(n)?Lo:+n}function Uo(n){return n}var Td="[object AsyncFunction]",Dd="[object Function]",kd="[object GeneratorFunction]",Pd="[object Proxy]";function ss(n){if(!Xe(n))return!1;var e=mn(n);return e==Dd||e==kd||e==Td||e==Pd}var os=St["__core-js_shared__"],_o=(function(){var n=/[^.]+$/.exec(os&&os.keys&&os.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function Fd(n){return!!_o&&_o in n}var Rd=Function.prototype,Od=Rd.toString;function Ld(n){if(n!=null){try{return Od.call(n)}catch{}try{return n+""}catch{}}return""}var Nd=/[\\^$.*+?()[\]{}|]/g,Ud=/^\[object .+?Constructor\]$/,_d=Function.prototype,Qd=Object.prototype,Hd=_d.toString,Gd=Qd.hasOwnProperty,Yd=RegExp("^"+Hd.call(Gd).replace(Nd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vd(n){if(!Xe(n)||Fd(n))return!1;var e=ss(n)?Yd:Ud;return e.test(Ld(n))}function Wd(n,e){return n?.[e]}function rs(n,e){var t=Wd(n,e);return Vd(t)?t:void 0}var Qo=Object.create,zd=(function(){function n(){}return function(e){if(!Xe(e))return{};if(Qo)return Qo(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}})();function jd(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function $d(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var Kd=800,Xd=16,qd=Date.now;function Jd(n){var e=0,t=0;return function(){var i=qd(),s=Xd-(i-t);if(t=i,s>0){if(++e>=Kd)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Zd(n){return function(){return n}}var ii=(function(){try{var n=rs(Object,"defineProperty");return n({},"",{}),n}catch{}})(),eu=ii?function(n,e){return ii(n,"toString",{configurable:!0,enumerable:!1,value:Zd(e),writable:!0})}:Uo,tu=Jd(eu),nu=9007199254740991,iu=/^(?:0|[1-9]\d*)$/;function Ho(n,e){var t=typeof n;return e=e??nu,!!e&&(t=="number"||t!="symbol"&&iu.test(n))&&n>-1&&n%1==0&&n<e}function as(n,e,t){e=="__proto__"&&ii?ii(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function si(n,e){return n===e||n!==n&&e!==e}var su=Object.prototype,ou=su.hasOwnProperty;function ru(n,e,t){var i=n[e];(!(ou.call(n,e)&&si(i,t))||t===void 0&&!(e in n))&&as(n,e,t)}function au(n,e,t,i){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var l=e[o],a=void 0;a===void 0&&(a=n[l]),s?as(t,l,a):ru(t,l,a)}return t}var Go=Math.max;function lu(n,e,t){return e=Go(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Go(i.length-e,0),r=Array(o);++s<o;)r[s]=i[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=i[s];return l[e]=t(r),jd(n,this,l)}}function cu(n,e){return tu(lu(n,e,Uo),n+"")}var du=9007199254740991;function Yo(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=du}function ls(n){return n!=null&&Yo(n.length)&&!ss(n)}function uu(n,e,t){if(!Xe(t))return!1;var i=typeof e;return(i=="number"?ls(t)&&Ho(e,t.length):i=="string"&&e in t)?si(t[e],n):!1}function hu(n){return cu(function(e,t){var i=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=n.length>3&&typeof o=="function"?(s--,o):void 0,r&&uu(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++i<s;){var l=t[i];l&&n(e,l,i,o)}return e})}var fu=Object.prototype;function Vo(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||fu;return n===t}function pu(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var gu="[object Arguments]";function Wo(n){return zt(n)&&mn(n)==gu}var zo=Object.prototype,mu=zo.hasOwnProperty,Au=zo.propertyIsEnumerable,cs=Wo((function(){return arguments})())?Wo:function(n){return zt(n)&&mu.call(n,"callee")&&!Au.call(n,"callee")};function yu(){return!1}var jo=typeof _=="object"&&_&&!_.nodeType&&_,$o=jo&&typeof module=="object"&&module&&!module.nodeType&&module,Cu=$o&&$o.exports===jo,Ko=Cu?St.Buffer:void 0,Eu=Ko?Ko.isBuffer:void 0,Xo=Eu||yu,wu="[object Arguments]",bu="[object Array]",vu="[object Boolean]",Iu="[object Date]",xu="[object Error]",Bu="[object Function]",Su="[object Map]",Mu="[object Number]",Tu="[object Object]",Du="[object RegExp]",ku="[object Set]",Pu="[object String]",Fu="[object WeakMap]",Ru="[object ArrayBuffer]",Ou="[object DataView]",Lu="[object Float32Array]",Nu="[object Float64Array]",Uu="[object Int8Array]",_u="[object Int16Array]",Qu="[object Int32Array]",Hu="[object Uint8Array]",Gu="[object Uint8ClampedArray]",Yu="[object Uint16Array]",Vu="[object Uint32Array]",ue={};ue[Lu]=ue[Nu]=ue[Uu]=ue[_u]=ue[Qu]=ue[Hu]=ue[Gu]=ue[Yu]=ue[Vu]=!0,ue[wu]=ue[bu]=ue[Ru]=ue[vu]=ue[Ou]=ue[Iu]=ue[xu]=ue[Bu]=ue[Su]=ue[Mu]=ue[Tu]=ue[Du]=ue[ku]=ue[Pu]=ue[Fu]=!1;function Wu(n){return zt(n)&&Yo(n.length)&&!!ue[mn(n)]}function zu(n){return function(e){return n(e)}}var qo=typeof _=="object"&&_&&!_.nodeType&&_,An=qo&&typeof module=="object"&&module&&!module.nodeType&&module,ju=An&&An.exports===qo,ds=ju&&Fo.process,Jo=(function(){try{var n=An&&An.require&&An.require("util").types;return n||ds&&ds.binding&&ds.binding("util")}catch{}})(),Zo=Jo&&Jo.isTypedArray,er=Zo?zu(Zo):Wu;function $u(n,e){var t=is(n),i=!t&&cs(n),s=!t&&!i&&Xo(n),o=!t&&!i&&!s&&er(n),r=t||i||s||o,l=r?pu(n.length,String):[],a=l.length;for(var c in n)r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ho(c,a))||l.push(c);return l}function Ku(n,e){return function(t){return n(e(t))}}function Xu(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var qu=Object.prototype,Ju=qu.hasOwnProperty;function Zu(n){if(!Xe(n))return Xu(n);var e=Vo(n),t=[];for(var i in n)i=="constructor"&&(e||!Ju.call(n,i))||t.push(i);return t}function tr(n){return ls(n)?$u(n):Zu(n)}var yn=rs(Object,"create");function eh(){this.__data__=yn?yn(null):{},this.size=0}function th(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var nh="__lodash_hash_undefined__",ih=Object.prototype,sh=ih.hasOwnProperty;function oh(n){var e=this.__data__;if(yn){var t=e[n];return t===nh?void 0:t}return sh.call(e,n)?e[n]:void 0}var rh=Object.prototype,ah=rh.hasOwnProperty;function lh(n){var e=this.__data__;return yn?e[n]!==void 0:ah.call(e,n)}var ch="__lodash_hash_undefined__";function dh(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=yn&&e===void 0?ch:e,this}function Mt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Mt.prototype.clear=eh,Mt.prototype.delete=th,Mt.prototype.get=oh,Mt.prototype.has=lh,Mt.prototype.set=dh;function uh(){this.__data__=[],this.size=0}function oi(n,e){for(var t=n.length;t--;)if(si(n[t][0],e))return t;return-1}var hh=Array.prototype,fh=hh.splice;function ph(n){var e=this.__data__,t=oi(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():fh.call(e,t,1),--this.size,!0}function gh(n){var e=this.__data__,t=oi(e,n);return t<0?void 0:e[t][1]}function mh(n){return oi(this.__data__,n)>-1}function Ah(n,e){var t=this.__data__,i=oi(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function ot(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}ot.prototype.clear=uh,ot.prototype.delete=ph,ot.prototype.get=gh,ot.prototype.has=mh,ot.prototype.set=Ah;var nr=rs(St,"Map");function yh(){this.size=0,this.__data__={hash:new Mt,map:new(nr||ot),string:new Mt}}function Ch(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function ri(n,e){var t=n.__data__;return Ch(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Eh(n){var e=ri(this,n).delete(n);return this.size-=e?1:0,e}function wh(n){return ri(this,n).get(n)}function bh(n){return ri(this,n).has(n)}function vh(n,e){var t=ri(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function jt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}jt.prototype.clear=yh,jt.prototype.delete=Eh,jt.prototype.get=wh,jt.prototype.has=bh,jt.prototype.set=vh;var ir=Ku(Object.getPrototypeOf,Object),Ih="[object Object]",xh=Function.prototype,Bh=Object.prototype,sr=xh.toString,Sh=Bh.hasOwnProperty,Mh=sr.call(Object);function Th(n){if(!zt(n)||mn(n)!=Ih)return!1;var e=ir(n);if(e===null)return!0;var t=Sh.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&sr.call(t)==Mh}function Dh(){this.__data__=new ot,this.size=0}function kh(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function Ph(n){return this.__data__.get(n)}function Fh(n){return this.__data__.has(n)}var Rh=200;function Oh(n,e){var t=this.__data__;if(t instanceof ot){var i=t.__data__;if(!nr||i.length<Rh-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new jt(i)}return t.set(n,e),this.size=t.size,this}function $t(n){var e=this.__data__=new ot(n);this.size=e.size}$t.prototype.clear=Dh,$t.prototype.delete=kh,$t.prototype.get=Ph,$t.prototype.has=Fh,$t.prototype.set=Oh;var or=typeof _=="object"&&_&&!_.nodeType&&_,rr=or&&typeof module=="object"&&module&&!module.nodeType&&module,Lh=rr&&rr.exports===or,ar=Lh?St.Buffer:void 0;ar&&ar.allocUnsafe;function Nh(n,e){return n.slice()}var lr=St.Uint8Array;function Uh(n){var e=new n.constructor(n.byteLength);return new lr(e).set(new lr(n)),e}function _h(n,e){var t=Uh(n.buffer);return new n.constructor(t,n.byteOffset,n.length)}function Qh(n){return typeof n.constructor=="function"&&!Vo(n)?zd(ir(n)):{}}function Hh(n){return function(e,t,i){for(var s=-1,o=Object(e),r=i(e),l=r.length;l--;){var a=r[++s];if(t(o[a],a,o)===!1)break}return e}}var Gh=Hh(),us=function(){return St.Date.now()},Yh="Expected a function",Vh=Math.max,Wh=Math.min;function hs(n,e,t){var i,s,o,r,l,a,c=0,u=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(Yh);e=No(e)||0,Xe(t)&&(u=!!t.leading,h="maxWait"in t,o=h?Vh(No(t.maxWait)||0,e):o,f="trailing"in t?!!t.trailing:f);function p(S){var x=i,g=s;return i=s=void 0,c=S,r=n.apply(g,x),r}function A(S){return c=S,l=setTimeout(y,e),u?p(S):r}function C(S){var x=S-a,g=S-c,F=e-x;return h?Wh(F,o-g):F}function m(S){var x=S-a,g=S-c;return a===void 0||x>=e||x<0||h&&g>=o}function y(){var S=us();if(m(S))return E(S);l=setTimeout(y,C(S))}function E(S){return l=void 0,f&&i?p(S):(i=s=void 0,r)}function I(){l!==void 0&&clearTimeout(l),c=0,i=a=s=l=void 0}function M(){return l===void 0?r:E(us())}function k(){var S=us(),x=m(S);if(i=arguments,s=this,a=S,x){if(l===void 0)return A(a);if(h)return clearTimeout(l),l=setTimeout(y,e),p(a)}return l===void 0&&(l=setTimeout(y,e)),r}return k.cancel=I,k.flush=M,k}function fs(n,e,t){(t!==void 0&&!si(n[e],t)||t===void 0&&!(e in n))&&as(n,e,t)}function zh(n){return zt(n)&&ls(n)}function ps(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function jh(n){return au(n,tr(n))}function $h(n,e,t,i,s,o,r){var l=ps(n,t),a=ps(e,t),c=r.get(a);if(c){fs(n,t,c);return}var u=o?o(l,a,t+"",n,e,r):void 0,h=u===void 0;if(h){var f=is(a),p=!f&&Xo(a),A=!f&&!p&&er(a);u=a,f||p||A?is(l)?u=l:zh(l)?u=$d(l):p?(h=!1,u=Nh(a)):A?(h=!1,u=_h(a)):u=[]:Th(a)||cs(a)?(u=l,cs(l)?u=jh(l):(!Xe(l)||ss(l))&&(u=Qh(a))):h=!1}h&&(r.set(a,u),s(u,a,i,o,r),r.delete(a)),fs(n,t,u)}function cr(n,e,t,i,s){n!==e&&Gh(e,function(o,r){if(s||(s=new $t),Xe(o))$h(n,e,r,t,cr,i,s);else{var l=i?i(ps(n,r),o,r+"",n,e,s):void 0;l===void 0&&(l=o),fs(n,r,l)}},tr)}var Kh=hu(function(n,e,t){cr(n,e,t)});function dr({Cesium:n,tileset:e}){const t=e.leiting;if(!t||!t.model||!t.model.formData)return;const i=t.model.formData,s=t.box,o=n.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,n.Math.toRadians(i.totalRotation||0)),r=n.Matrix4.fromRotationTranslation(n.Matrix3.fromQuaternion(o),n.Cartesian3.ZERO),l=n.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),a=n.Transforms.eastNorthUpToFixedFrame(l),c=n.Matrix4.multiply(a,r,new n.Matrix4);if(e._root){if(!s){e._root.transform=c;return}try{const{center:u}=s,h=e.root.boundingVolume.boundingSphere,f=new n.Cartesian3(u.x,u.y,0),p=n.Matrix4.multiplyByPoint(c,f,new n.Cartesian3),A=n.Cartographic.fromCartesian(p),C=h.center,m=n.Transforms.eastNorthUpToFixedFrame(new n.Cartesian3(C.x,C.y,C.z)),y=new n.Cartesian3(-u.x+(i.X||0),-u.y+(i.Y||0),i.Z||0),E=n.Matrix4.fromTranslation(y),I=n.Matrix4.multiply(r,E,new n.Matrix4),M=n.Cartesian3.fromDegrees(A.longitude/Math.PI*180,A.latitude/Math.PI*180,i.height),k=n.Transforms.eastNorthUpToFixedFrame(M),S=n.Matrix4.multiply(k,I,new n.Matrix4);n.Matrix4.multiply(m,I,m),e._root.transform=S}catch(u){console.error("Update model position failed:",u)}}}const Kt={NotLoaded:0,Loading:1,Loaded:2,Error:3},Tt=4294967295,qe=65535,gs=255,Xh=8,ur=9,qh=0,Jh=99,Zh=67324752,hr=134695760,ef=hr,fr=33639248,tf=101010256,pr=101075792,nf=117853008,Xt=22,ms=20,As=56,sf=12,of=20,gr=4,rf=1,af=39169,lf=10,cf=1,df=21589,uf=28789,hf=25461,ff=6534,pf=30837,gf=30805,mr=1,mf=6,Ar=8,yr=2048,Af=16,yf=1,Cf=2,Ef=4,wf=32,Cr=61440,ys=16384,Cs=73,bf=420,vf=2048,If=1024,xf=512,Bf="/",Es=30,Sf=10,Mf=14,Tf=18,he=void 0,ft="undefined",Dt="function",Df=64;let Er=2;try{typeof navigator!=ft&&navigator.hardwareConcurrency&&(Er=navigator.hardwareConcurrency)}catch{}const kf={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:Er,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=ft&&CompressionStream,DecompressionStream:typeof DecompressionStream!=ft&&DecompressionStream},wr=Object.assign({},kf);function Pf(){return wr}function Ff(n){return Math.max(n.chunkSize,Df)}function ai(n){const{baseURI:e,chunkSize:t,maxWorkers:i,terminateWorkerTimeout:s,useCompressionStream:o,useWebWorkers:r,CompressionStream:l,DecompressionStream:a,CompressionStreamZlib:c,DecompressionStreamZlib:u,workerURI:h,wasmURI:f}=n;_e("baseURI",e),_e("wasmURI",f),_e("workerURI",h),_e("chunkSize",t),_e("maxWorkers",i),_e("terminateWorkerTimeout",s),_e("useCompressionStream",o),_e("useWebWorkers",r),_e("CompressionStream",l),_e("DecompressionStream",a),_e("CompressionStreamZlib",c),_e("DecompressionStreamZlib",u)}function _e(n,e){e!==he&&(wr[n]=e)}function Rf(n){let e;n({workerURI:()=>(e||(e="data:text/javascript,"+encodeURIComponent(`(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:f,Promise:l,TextEncoder:u,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:S}=self,b=void 0,v="undefined",k="function",z=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;z[t]=e}class C{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^z[255&(e^t[n])];this.t=e}get(){return~this.t}}class A extends d{constructor(){let t;const e=new C;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new f(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const x={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=x.o(n);return 32===s?t.concat(e):x.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+x.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=x.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=x.o(r);return s.push(x.u(e+o&31,e+o>32?n:s.pop(),1)),s}},I={bytes:{p(t){const e=x.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(x.u(8*(3&n),s)),e}}},R=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=I.I.m(t));const n=e.C=x.concat(e.C,t),s=e.A,o=e.A=s+x.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=x.concat(e,[x.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+f+o[t]+n.v[s.floor(t/20)]|0;f=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+f|0}},P={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},U={importKey:t=>new U.M(I.bytes.m(t)),_(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,l;const u=new ArrayBuffer(o),w=new f(u);let p=0;const d=x;for(e=I.bytes.m(e),l=1;(o||1)>p;l++){for(i=c=t.encrypt(d.concat(e,[l])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return u.slice(0,s/8)},M:class{constructor(t){const e=this,n=e.B=R,s=[[],[]];e.D=[new n,new n];const r=e.D[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.D[0].update(s[0]),e.D[1].update(s[1]),e.W=new n(e.D[0])}reset(){const t=this;t.W=new t.B(t.D[0]),t.K=!1}update(t){this.K=!0,this.W.update(t)}digest(){const t=this,e=t.W.P(),n=new t.B(t.D[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.K)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},V=typeof w!=v&&typeof w.getRandomValues==k,M="Invalid password",_="Invalid signature",B="zipjs-abort-check-password";function D(t){return V?w.getRandomValues(t):P.getRandomValues(t)}const W=16,K={name:"PBKDF2"},E=e.assign({hash:{name:"HMAC"}},K),L=e.assign({iterations:1e3,hash:{name:"SHA-1"}},K),O=["deriveBits"],T=[8,12,16],j=[16,24,32],H=10,Z=[0,0,0,0],F=typeof w!=v,N=F&&w.subtle,q=F&&typeof N!=v,G=I.bytes,J=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let f=i=0;!n[f];f^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[f]=o,s[o]=f,h=r[a=r[c=r[f]]];let l=16843009*h^65537*a^257*c^16843008*f,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=u=u<<24^u>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],f=i[3],l=i[4];let u,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],S=4;for(let t=0;s>t;t++)u=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^f[255&g]^n[S],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^f[255&d]^n[S+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^f[255&y]^n[S+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^f[255&m]^n[S+3],S+=4,d=u,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&g]^n[S++],u=d,d=y,y=m,m=g,g=u;return o}},Q=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=x.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return x.l(e,r)}},X=U.M;let Y=F&&q&&typeof N.importKey==k,$=F&&q&&typeof N.deriveBits==k;class tt extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await st(t,e,n,it(s,0,T[e])),i=it(s,T[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(M)})(n,i,s,it(t,0,T[i]+2)),t=it(t,T[i]+2),c?e.error(new r(B)):a()):await h;const f=new o(t.length-H-(t.length-H)%W);e.enqueue(nt(n,t,f,0,H,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=it(i,0,i.length-H),h=it(i,i.length-H);let f=new o;if(a.length){const t=at(G,a);s.update(t);const e=n.update(t);f=ct(G,e)}if(e){const t=it(ct(G,s.digest()),0,H);for(let e=0;H>e;e++)if(t[e]!=h[e])throw new r(_)}t.enqueue(f)}}})}}class et extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=D(new o(T[e]));return ot(s,await st(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%W);h.set(a,0),e.enqueue(nt(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(at(G,s));n.update(t),c=ct(G,t)}r.signature=ct(G,n.digest()).slice(0,H),t.enqueue(ot(c,r.signature))}}}),r=this}}function nt(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,f=e.length-r;let l;for(h.length&&(e=ot(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,f-f%W)),l=0;f-W>=l;l+=W){const t=at(G,it(e,l,l+W));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(ct(G,r),l+s)}return t.pending=it(e,l),n}async function st(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!Y)return U.importKey(e);try{return await N.importKey("raw",e,n,!1,r)}catch{return Y=!1,U.importKey(e)}})(0,r,E,0,O),a=await(async(t,e,n)=>{if(!$)return U._(e,t.salt,L.iterations,n);try{return await N.deriveBits(t,e,n)}catch{return $=!1,U._(e,t.salt,L.iterations,n)}})(e.assign({salt:i},L),c,8*(2*j[s]+2)),h=new o(a),f=at(G,it(h,0,j[s])),l=at(G,it(h,j[s],2*j[s])),u=it(h,2*j[s]);return e.assign(n,{keys:{key:f,$:l,passwordVerification:u},X:new Q(new J(f),t.from(Z)),Y:new X(l)}),u}function rt(t,e){return e===b?(t=>{if(typeof u==v){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function ot(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function it(t,e,n){return t.subarray(e,n)}function ct(t,e){return t.p(e)}function at(t,e){return t.m(e)}class ht extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;if(n.password){const e=lt(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(M);t=t.subarray(12)}s?e.error(new r(B)):e.enqueue(lt(n,t))}})}}class ft extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=D(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ut(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ut(n,t),r),e.enqueue(s)}})}}function lt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,n[s]);return n}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,e[s]);return n}function wt(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new C(s[0]),et:new C(s[2])});for(let e=0;e<n.length;e++)pt(t,n.charCodeAt(e))}function pt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=mt(s.imul(mt(r+yt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function dt(t){const e=2|t.keys[2];return yt(s.imul(e,1^e)>>>8)}function yt(t){return 255&t}function mt(t){return 4294967295&t}class gt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,l=this;let u,w,p=super.readable;o&&!c||!a||(u=new A,p=kt(p,u)),r&&(p=vt(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=kt(p,new ft(t)):(w=new et(t),p=kt(p,w))),bt(l,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new f(u.value.buffer).getUint32(0)),l.signature=t})}}class St extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:l,rt:u}=t;let w,p,d=super.readable;i&&(o?d=kt(d,new ht(t)):(p=new tt(t),d=kt(d,p))),h&&(d=vt(d,l,{chunkSize:e,rt:u},s,n,s)),i&&!o||!c||(w=new A,d=kt(d,w)),bt(this,d,()=>{if((!i||o)&&c){const t=new f(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(_)}})}}function bt(t,n,s){n=kt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function vt(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=kt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=kt(t,new r(c,n));else{if(!o)throw s;t=kt(t,new o(c,n))}}return t}function kt(t,e){return t.pipeThrough(e)}const zt="data",Ct="close";class At extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=gt:o.startsWith("inflate")&&(i=St),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,f=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),l=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==b&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(f).pipeThrough(a).pipeThrough(l)})}}class xt extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}const It=new h,Rt=new h;let Pt,Ut,Vt,Mt,_t,Bt=0;async function Dt(t){try{const{options:e,config:s}=t;if(!e.useCompressionStream)try{await self.initModule(t.config)}catch{e.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},o=t.readable||new y({async pull(t){const e=new l(t=>It.set(Bt,t));Wt({type:"pull",messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),i=t.writable||new m({async write(t){let e;const s=new l(t=>e=t);Rt.set(Bt,e),Wt({type:zt,value:t,messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER,await s}},r),c=new At(e,s);Pt=new AbortController;const{signal:a}=Pt;await o.pipeThrough(c).pipeThrough(new xt(s.chunkSize)).pipeTo(i,{signal:a,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:h,inputSize:f,outputSize:u}=c;Wt({type:Ct,result:{signature:h,inputSize:f,outputSize:u}})}catch(t){t.outputSize=0,Kt(t)}}function Wt(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t)}function Kt(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}function Et(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=Vt(c),this.in=Vt(a),this.it=a,this.ht=new o(c),t?(this.ft=Ut.deflate_process,this.lt=Ut.deflate_last_consumed,this.ut=Ut.deflate_end,this.wt=Ut.deflate_new(),n="gzip"===e?Ut.deflate_init_gzip(this.wt,i):"deflate-raw"===e?Ut.deflate_init_raw(this.wt,i):Ut.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.ft=Ut.inflate9_process,this.lt=Ut.inflate9_last_consumed,this.ut=Ut.inflate9_end,this.wt=Ut.inflate9_new(),n=Ut.inflate9_init_raw(this.wt)):(this.ft=Ut.inflate_process,this.lt=Ut.inflate_last_consumed,this.ut=Ut.inflate_end,this.wt=Ut.inflate_new(),n="deflate-raw"===e?Ut.inflate_init_raw(this.wt):"gzip"===e?Ut.inflate_init_gzip(this.wt):Ut.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(_t.buffer),h=this.ft,f=this.lt,l=this.ct,u=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Mt&&Mt(this.in),this.in=Vt(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,l,c,0),p=16777215&o;if(p&&(u.set(a.subarray(l,l+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=f(this.wt);if(0===d)break;w+=d}}catch(t){this.ut&&this.wt&&this.ut(this.wt),this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct),n.error(t)}},flush(e){try{const n=new o(_t.buffer),s=this.ft,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4),h=16777215&o,f=o>>24&255;if(!t){const t=128&f?f-256:f;if(0>t)throw new r("process error:"+t)}if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===f||0===h)break}}catch(t){e.error(t)}finally{if(this.ut&&this.wt){const t=this.ut(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct)}}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Dt(t),e==zt){const t=It.get(n);It.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Rt.get(n);Rt.delete(n),t()}e==Ct&&Pt.abort()}catch(t){Kt(t)}});class Lt{constructor(t="deflate",e){return Et(!0,t,e)}}class Ot{constructor(t="deflate",e){return Et(!1,t,e)}}let Tt=!1;self.initModule=async t=>{try{const e=await(async(t,{baseURI:e})=>{if(!Tt){let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(Ut=t,({malloc:Vt,free:Mt,memory:_t}=Ut),"function"!=typeof Vt||"function"!=typeof Mt||!_t)throw Ut=Vt=Mt=_t=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),Tt=!0}})(t.wasmURI,t);return t.nt=Lt,t.st=Ot,e}catch{}}});
13
+ `)),e)})}const br=[];for(let n=0;n<256;n++){let e=n;for(let t=0;t<8;t++)e&1?e=e>>>1^3988292384:e=e>>>1;br[n]=e}class li{constructor(e){this.crc=e||-1}append(e){let t=this.crc|0;for(let i=0,s=e.length|0;i<s;i++)t=t>>>8^br[(t^e[i])&255];this.crc=t}get(){return~this.crc}}class vr extends TransformStream{constructor(){let e;const t=new li;super({transform(i,s){t.append(i),s.enqueue(i)},flush(){const i=new Uint8Array(4);new DataView(i.buffer).setUint32(0,t.get()),e.value=i}}),e=this}}function Of(n){if(typeof TextEncoder==ft){n=unescape(encodeURIComponent(n));const e=new Uint8Array(n.length);for(let t=0;t<e.length;t++)e[t]=n.charCodeAt(t);return e}else return new TextEncoder().encode(n)}const Fe={concat(n,e){if(n.length===0||e.length===0)return n.concat(e);const t=n[n.length-1],i=Fe.getPartial(t);return i===32?n.concat(e):Fe._shiftRight(e,i,t|0,n.slice(0,n.length-1))},bitLength(n){const e=n.length;if(e===0)return 0;const t=n[e-1];return(e-1)*32+Fe.getPartial(t)},clamp(n,e){if(n.length*32<e)return n;n=n.slice(0,Math.ceil(e/32));const t=n.length;return e=e&31,t>0&&e&&(n[t-1]=Fe.partial(e,n[t-1]&2147483648>>e-1,1)),n},partial(n,e,t){return n===32?e:(t?e|0:e<<32-n)+n*1099511627776},getPartial(n){return Math.round(n/1099511627776)||32},_shiftRight(n,e,t,i){for(i===void 0&&(i=[]);e>=32;e-=32)i.push(t),t=0;if(e===0)return i.concat(n);for(let r=0;r<n.length;r++)i.push(t|n[r]>>>e),t=n[r]<<32-e;const s=n.length?n[n.length-1]:0,o=Fe.getPartial(s);return i.push(Fe.partial(e+o&31,e+o>32?t:i.pop(),1)),i}},ci={bytes:{fromBits(n){const t=Fe.bitLength(n)/8,i=new Uint8Array(t);let s;for(let o=0;o<t;o++)(o&3)===0&&(s=n[o/4]),i[o]=s>>>24,s<<=8;return i},toBits(n){const e=[];let t,i=0;for(t=0;t<n.length;t++)i=i<<8|n[t],(t&3)===3&&(e.push(i),i=0);return t&3&&e.push(Fe.partial(8*(t&3),i)),e}}},Ir={};Ir.sha1=class{constructor(n){const e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],n?(e._h=n._h.slice(0),e._buffer=n._buffer.slice(0),e._length=n._length):e.reset()}reset(){const n=this;return n._h=n._init.slice(0),n._buffer=[],n._length=0,n}update(n){const e=this;typeof n=="string"&&(n=ci.utf8String.toBits(n));const t=e._buffer=Fe.concat(e._buffer,n),i=e._length,s=e._length=i+Fe.bitLength(n);if(s>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(t);let r=0;for(let l=e.blockSize+i-(e.blockSize+i&e.blockSize-1);l<=s;l+=e.blockSize)e._block(o.subarray(16*r,16*(r+1))),r+=1;return t.splice(0,16*r),e}finalize(){const n=this;let e=n._buffer;const t=n._h;e=Fe.concat(e,[Fe.partial(1,1)]);for(let i=e.length+2;i&15;i++)e.push(0);for(e.push(Math.floor(n._length/4294967296)),e.push(n._length|0);e.length;)n._block(e.splice(0,16));return n.reset(),t}_f(n,e,t,i){if(n<=19)return e&t|~e&i;if(n<=39)return e^t^i;if(n<=59)return e&t|e&i|t&i;if(n<=79)return e^t^i}_S(n,e){return e<<n|e>>>32-n}_block(n){const e=this,t=e._h,i=Array(80);for(let c=0;c<16;c++)i[c]=n[c];let s=t[0],o=t[1],r=t[2],l=t[3],a=t[4];for(let c=0;c<=79;c++){c>=16&&(i[c]=e._S(1,i[c-3]^i[c-8]^i[c-14]^i[c-16]));const u=e._S(5,s)+e._f(c,o,r,l)+a+i[c]+e._key[Math.floor(c/20)]|0;a=l,l=r,r=e._S(30,o),o=s,s=u}t[0]=t[0]+s|0,t[1]=t[1]+o|0,t[2]=t[2]+r|0,t[3]=t[3]+l|0,t[4]=t[4]+a|0}};const xr={};xr.aes=class{constructor(n){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const t=e._tables[0][4],i=e._tables[1],s=n.length;let o,r,l,a=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=n.slice(0),l=[]],o=s;o<4*s+28;o++){let c=r[o-1];(o%s===0||s===8&&o%s===4)&&(c=t[c>>>24]<<24^t[c>>16&255]<<16^t[c>>8&255]<<8^t[c&255],o%s===0&&(c=c<<8^c>>>24^a<<24,a=a<<1^(a>>7)*283)),r[o]=r[o-s]^c}for(let c=0;o;c++,o--){const u=r[c&3?o:o-4];o<=4||c<4?l[c]=u:l[c]=i[0][t[u>>>24]]^i[1][t[u>>16&255]]^i[2][t[u>>8&255]]^i[3][t[u&255]]}}encrypt(n){return this._crypt(n,0)}decrypt(n){return this._crypt(n,1)}_precompute(){const n=this._tables[0],e=this._tables[1],t=n[4],i=e[4],s=[],o=[];let r,l,a,c;for(let u=0;u<256;u++)o[(s[u]=u<<1^(u>>7)*283)^u]=u;for(let u=r=0;!t[u];u^=l||1,r=o[r]||1){let h=r^r<<1^r<<2^r<<3^r<<4;h=h>>8^h&255^99,t[u]=h,i[h]=u,c=s[a=s[l=s[u]]];let f=c*16843009^a*65537^l*257^u*16843008,p=s[h]*257^h*16843008;for(let A=0;A<4;A++)n[A][u]=p=p<<24^p>>>8,e[A][h]=f=f<<24^f>>>8}for(let u=0;u<5;u++)n[u]=n[u].slice(0),e[u]=e[u].slice(0)}_crypt(n,e){if(n.length!==4)throw new Error("invalid aes block size");const t=this._key[e],i=t.length/4-2,s=[0,0,0,0],o=this._tables[e],r=o[0],l=o[1],a=o[2],c=o[3],u=o[4];let h=n[0]^t[0],f=n[e?3:1]^t[1],p=n[2]^t[2],A=n[e?1:3]^t[3],C=4,m,y,E;for(let I=0;I<i;I++)m=r[h>>>24]^l[f>>16&255]^a[p>>8&255]^c[A&255]^t[C],y=r[f>>>24]^l[p>>16&255]^a[A>>8&255]^c[h&255]^t[C+1],E=r[p>>>24]^l[A>>16&255]^a[h>>8&255]^c[f&255]^t[C+2],A=r[A>>>24]^l[h>>16&255]^a[f>>8&255]^c[p&255]^t[C+3],C+=4,h=m,f=y,p=E;for(let I=0;I<4;I++)s[e?3&-I:I]=u[h>>>24]<<24^u[f>>16&255]<<16^u[p>>8&255]<<8^u[A&255]^t[C++],m=h,h=f,f=p,p=A,A=m;return s}};const Lf={getRandomValues(n){const e=new Uint32Array(n.buffer),t=i=>{let s=987654321;const o=4294967295;return function(){return s=36969*(s&65535)+(s>>16)&o,i=18e3*(i&65535)+(i>>16)&o,(((s<<16)+i&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let i=0,s;i<n.length;i+=4){const o=t((s||Math.random())*4294967296);s=o()*987654071,e[i/4]=o()*4294967296|0}return n}},Br={};Br.ctrGladman=class{constructor(n,e){this._prf=n,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(n){return this.calculate(this._prf,n,this._iv)}incWord(n){if((n>>24&255)===255){let e=n>>16&255,t=n>>8&255,i=n&255;e===255?(e=0,t===255?(t=0,i===255?i=0:++i):++t):++e,n=0,n+=e<<16,n+=t<<8,n+=i}else n+=1<<24;return n}incCounter(n){(n[0]=this.incWord(n[0]))===0&&(n[1]=this.incWord(n[1]))}calculate(n,e,t){let i;if(!(i=e.length))return[];const s=Fe.bitLength(e);for(let o=0;o<i;o+=4){this.incCounter(t);const r=n.encrypt(t);e[o]^=r[0],e[o+1]^=r[1],e[o+2]^=r[2],e[o+3]^=r[3]}return Fe.clamp(e,s)}};const kt={importKey(n){return new kt.hmacSha1(ci.bytes.toBits(n))},pbkdf2(n,e,t,i){if(t=t||1e4,i<0||t<0)throw new Error("invalid params to pbkdf2");const s=(i>>5)+1<<2;let o,r,l,a,c;const u=new ArrayBuffer(s),h=new DataView(u);let f=0;const p=Fe;for(e=ci.bytes.toBits(e),c=1;f<(s||1);c++){for(o=r=n.encrypt(p.concat(e,[c])),l=1;l<t;l++)for(r=n.encrypt(r),a=0;a<r.length;a++)o[a]^=r[a];for(l=0;f<(s||1)&&l<o.length;l++)h.setInt32(f,o[l]),f+=4}return u.slice(0,i/8)}};kt.hmacSha1=class{constructor(n){const e=this,t=e._hash=Ir.sha1,i=[[],[]];e._baseHash=[new t,new t];const s=e._baseHash[0].blockSize/32;n.length>s&&(n=new t().update(n).finalize());for(let o=0;o<s;o++)i[0][o]=n[o]^909522486,i[1][o]=n[o]^1549556828;e._baseHash[0].update(i[0]),e._baseHash[1].update(i[1]),e._resultHash=new t(e._baseHash[0])}reset(){const n=this;n._resultHash=new n._hash(n._baseHash[0]),n._updated=!1}update(n){const e=this;e._updated=!0,e._resultHash.update(n)}digest(){const n=this,e=n._resultHash.finalize(),t=new n._hash(n._baseHash[1]).update(e).finalize();return n.reset(),t}encrypt(n){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(n),this.digest(n)}};const Nf=typeof crypto!=ft&&typeof crypto.getRandomValues==Dt,Sr="Invalid password",Mr="Invalid signature",ws="zipjs-abort-check-password";function Tr(n){return Nf?crypto.getRandomValues(n):Lf.getRandomValues(n)}const qt=16,Uf="raw",Dr={name:"PBKDF2"},_f={name:"HMAC"},Qf="SHA-1",Hf=Object.assign({hash:_f},Dr),bs=Object.assign({iterations:1e3,hash:{name:Qf}},Dr),Gf=["deriveBits"],Cn=[8,12,16],En=[16,24,32],pt=10,Yf=[0,0,0,0],di=typeof crypto!=ft,wn=di&&crypto.subtle,kr=di&&typeof wn!=ft,Je=ci.bytes,Vf=xr.aes,Wf=Br.ctrGladman,zf=kt.hmacSha1;let Pr=di&&kr&&typeof wn.importKey==Dt,Fr=di&&kr&&typeof wn.deriveBits==Dt;class jf extends TransformStream{constructor({password:e,rawPassword:t,signed:i,encryptionStrength:s,checkPasswordOnly:o}){super({start(){Object.assign(this,{ready:new Promise(r=>this.resolveReady=r),password:Lr(e,t),signed:i,strength:s-1,pending:new Uint8Array})},async transform(r,l){const a=this,{password:c,strength:u,resolveReady:h,ready:f}=a;c?(await Kf(a,u,c,Qe(r,0,Cn[u]+2)),r=Qe(r,Cn[u]+2),o?l.error(new Error(ws)):h()):await f;const p=new Uint8Array(r.length-pt-(r.length-pt)%qt);l.enqueue(Rr(a,r,p,0,pt,!0))},async flush(r){const{signed:l,ctr:a,hmac:c,pending:u,ready:h}=this;if(c&&a){await h;const f=Qe(u,0,u.length-pt),p=Qe(u,u.length-pt);let A=new Uint8Array;if(f.length){const C=vn(Je,f);c.update(C);const m=a.update(C);A=bn(Je,m)}if(l){const C=Qe(bn(Je,c.digest()),0,pt);for(let m=0;m<pt;m++)if(C[m]!=p[m])throw new Error(Mr)}r.enqueue(A)}}})}}class $f extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:i}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:Lr(e,t),strength:i-1,pending:new Uint8Array})},async transform(o,r){const l=this,{password:a,strength:c,resolveReady:u,ready:h}=l;let f=new Uint8Array;a?(f=await Xf(l,c,a),u()):await h;const p=new Uint8Array(f.length+o.length-o.length%qt);p.set(f,0),r.enqueue(Rr(l,o,p,f.length,0))},async flush(o){const{ctr:r,hmac:l,pending:a,ready:c}=this;if(l&&r){await c;let u=new Uint8Array;if(a.length){const h=r.update(vn(Je,a));l.update(h),u=bn(Je,h)}s.signature=bn(Je,l.digest()).slice(0,pt),o.enqueue(vs(u,s.signature))}}}),s=this}}function Rr(n,e,t,i,s,o){const{ctr:r,hmac:l,pending:a}=n,c=e.length-s;a.length&&(e=vs(a,e),t=Zf(t,c-c%qt));let u;for(u=0;u<=c-qt;u+=qt){const h=vn(Je,Qe(e,u,u+qt));o&&l.update(h);const f=r.update(h);o||l.update(f),t.set(bn(Je,f),u+i)}return n.pending=Qe(e,u),t}async function Kf(n,e,t,i){const s=await Or(n,e,t,Qe(i,0,Cn[e])),o=Qe(i,Cn[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error(Sr)}async function Xf(n,e,t){const i=Tr(new Uint8Array(Cn[e])),s=await Or(n,e,t,i);return vs(i,s)}async function Or(n,e,t,i){n.password=null;const s=await qf(Uf,t,Hf,!1,Gf),o=await Jf(Object.assign({salt:i},bs),s,8*(En[e]*2+2)),r=new Uint8Array(o),l=vn(Je,Qe(r,0,En[e])),a=vn(Je,Qe(r,En[e],En[e]*2)),c=Qe(r,En[e]*2);return Object.assign(n,{keys:{key:l,authentication:a,passwordVerification:c},ctr:new Wf(new Vf(l),Array.from(Yf)),hmac:new zf(a)}),c}async function qf(n,e,t,i,s){if(Pr)try{return await wn.importKey(n,e,t,i,s)}catch{return Pr=!1,kt.importKey(e)}else return kt.importKey(e)}async function Jf(n,e,t){if(Fr)try{return await wn.deriveBits(n,e,t)}catch{return Fr=!1,kt.pbkdf2(e,n.salt,bs.iterations,t)}else return kt.pbkdf2(e,n.salt,bs.iterations,t)}function Lr(n,e){return e===he?Of(n):e}function vs(n,e){let t=n;return n.length+e.length&&(t=new Uint8Array(n.length+e.length),t.set(n,0),t.set(e,n.length)),t}function Zf(n,e){if(e&&e>n.length){const t=n;n=new Uint8Array(e),n.set(t,0)}return n}function Qe(n,e,t){return n.subarray(e,t)}function bn(n,e){return n.fromBits(e)}function vn(n,e){return n.toBits(e)}const In=12;class ep extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:i}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),_r(this,e)},transform(s,o){const r=this;if(r.password){const l=Nr(r,s.subarray(0,In));if(r.password=null,l.at(-1)!=r.passwordVerification)throw new Error(Sr);s=s.subarray(In)}i?o.error(new Error(ws)):o.enqueue(Nr(r,s))}})}}class tp extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),_r(this,e)},transform(i,s){const o=this;let r,l;if(o.password){o.password=null;const a=Tr(new Uint8Array(In));a[In-1]=o.passwordVerification,r=new Uint8Array(i.length+a.length),r.set(Ur(o,a),0),l=In}else r=new Uint8Array(i.length),l=0;r.set(Ur(o,i),l),s.enqueue(r)}})}}function Nr(n,e){const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=Qr(n)^e[i],Is(n,t[i]);return t}function Ur(n,e){const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=Qr(n)^e[i],Is(n,e[i]);return t}function _r(n,e){const t=[305419896,591751049,878082192];Object.assign(n,{keys:t,crcKey0:new li(t[0]),crcKey2:new li(t[2])});for(let i=0;i<e.length;i++)Is(n,e.charCodeAt(i))}function Is(n,e){let[t,i,s]=n.keys;n.crcKey0.append([e]),t=~n.crcKey0.get(),i=Gr(Math.imul(Gr(i+Hr(t)),134775813)+1),n.crcKey2.append([i>>>24]),s=~n.crcKey2.get(),n.keys=[t,i,s]}function Qr(n){const e=n.keys[2]|2;return Hr(Math.imul(e,e^1)>>>8)}function Hr(n){return n&255}function Gr(n){return n&4294967295}const Yr="Invalid uncompressed size",np="deflate-raw",ip="deflate64-raw";class sp extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:i,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:l,zipCrypto:a,signed:c,level:u}=e,h=this;let f,p,A=super.readable;(!r||a)&&c&&(f=new vr,A=Ze(A,f)),o&&(A=Wr(A,l,{level:u,chunkSize:t},s,i,s)),r&&(a?A=Ze(A,new tp(e)):(p=new $f(e),A=Ze(A,p))),Vr(h,A,()=>{let C;r&&!a&&(C=p.signature),(!r||a)&&c&&(C=new DataView(f.value.buffer).getUint32(0)),h.signature=C})}}class op extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:i,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:l,signature:a,compressed:c,useCompressionStream:u,deflate64:h}=e;let f,p,A=super.readable;r&&(o?A=Ze(A,new ep(e)):(p=new jf(e),A=Ze(A,p))),c&&(A=Wr(A,u,{chunkSize:t,deflate64:h},s,i,s)),(!r||o)&&l&&(f=new vr,A=Ze(A,f)),Vr(this,A,()=>{if((!r||o)&&l){const C=new DataView(f.value.buffer);if(a!=C.getUint32(0,!1))throw new Error(Mr)}})}}function Vr(n,e,t){e=Ze(e,new TransformStream({flush:t})),Object.defineProperty(n,"readable",{get(){return e}})}function Wr(n,e,t,i,s,o){const r=e&&i?i:s||o,l=t.deflate64?ip:np;try{n=Ze(n,new r(l,t))}catch(a){if(e)if(s)n=Ze(n,new s(l,t));else if(o)n=Ze(n,new o(l,t));else throw a;else throw a}return n}function Ze(n,e){return n.pipeThrough(e)}const rp="message",ap="start",lp="pull",zr="data",cp="ack",jr="close",dp="deflate",$r="inflate";class up extends TransformStream{constructor(e,t){super({});const i=this,{codecType:s}=e;let o;s.startsWith(dp)?o=sp:s.startsWith($r)&&(o=op),i.outputSize=0;let r=0;const l=new o(e,t),a=super.readable,c=new TransformStream({transform(h,f){h&&h.length&&(r+=h.length,f.enqueue(h))},flush(){Object.assign(i,{inputSize:r})}}),u=new TransformStream({transform(h,f){if(h&&h.length&&(f.enqueue(h),i.outputSize+=h.length,e.outputSize!==he&&i.outputSize>e.outputSize))throw new Error(Yr)},flush(){const{signature:h}=l;Object.assign(i,{signature:h,inputSize:r})}});Object.defineProperty(i,"readable",{get(){return a.pipeThrough(c).pipeThrough(l).pipeThrough(u)}})}}class hp extends TransformStream{constructor(e){let t;super({transform:i,flush(s){t&&t.length&&s.enqueue(t)}});function i(s,o){if(t){const r=new Uint8Array(t.length+s.length);r.set(t),r.set(s,t.length),s=r,t=null}s.length>e?(o.enqueue(s.slice(0,e)),i(s.slice(e),o)):t=s}}}let Kr=typeof Worker!=ft,Xr=()=>{};function fp({initModule:n}){Xr=n}class xs{constructor(e,{readable:t,writable:i},{options:s,config:o,streamOptions:r,useWebWorkers:l,transferStreams:a,workerURI:c},u){const{signal:h}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new hp(o.chunkSize)).pipeThrough(new pp(r),{signal:h}),writable:i,options:Object.assign({},s),workerURI:c,transferStreams:a,terminate(){return new Promise(f=>{const{worker:p,busy:A}=e;p?(A?e.resolveTerminated=f:(p.terminate(),f()),e.interface=null):f()})},onTaskFinished(){const{resolveTerminated:f}=e;f&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),f()),e.busy=!1,u(e)}}),(l&&Kr?gp:qr)(e,o)}}class pp extends TransformStream{constructor({onstart:e,onprogress:t,size:i,onend:s}){let o=0;super({async start(){e&&await Bs(e,i)},async transform(r,l){o+=r.length,t&&await Bs(t,o,i),l.enqueue(r)},async flush(){s&&await Bs(s,o)}})}}async function Bs(n,...e){try{await n(...e)}catch{}}function qr(n,e){return{run:()=>mp(n,e)}}function gp(n,e){const{baseURI:t,chunkSize:i}=e;let{wasmURI:s}=e;if(!n.interface){typeof s==Dt&&(s=s());let o;try{o=Cp(n.workerURI,t,n)}catch{return Kr=!1,qr(n,e)}Object.assign(n,{worker:o,interface:{run:()=>Ap(n,{chunkSize:i,wasmURI:s,baseURI:t})}})}return n.interface}async function mp({options:n,readable:e,writable:t,onTaskFinished:i},s){let o;try{if(!n.useCompressionStream)try{await Xr(s)}catch{n.useCompressionStream=!0}o=new up(n,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:l,outputSize:a}=o;return{signature:r,inputSize:l,outputSize:a}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{i()}}async function Ap(n,e){let t,i;const s=new Promise((h,f)=>{t=h,i=f});Object.assign(n,{reader:null,writer:null,resolveResult:t,rejectResult:i,result:s});const{readable:o,options:r}=n,{writable:l,closed:a}=yp(n.writable),c=ui({type:ap,options:r,config:e,readable:o,writable:l},n);c||Object.assign(n,{reader:o.getReader(),writer:l.getWriter()});const u=await s;return c||await l.getWriter().close(),await a,u}function yp(n){let e;const t=new Promise(s=>e=s);return{writable:new WritableStream({async write(s){const o=n.getWriter();await o.ready,await o.write(s),o.releaseLock()},close(){e()},abort(s){return n.getWriter().abort(s)}}),closed:t}}let Jr=!0;function Cp(n,e,t){const i={type:"module"};let s,o;if(typeof n==Dt&&(n=n()),n.startsWith("data:")||n.startsWith("blob:"))try{o=new Worker(n)}catch{o=new Worker(n,i)}else{try{s=new URL(n,e)}catch{s=n}o=new Worker(s,i)}return o.addEventListener(rp,r=>Ep(r,t)),o}function ui(n,{worker:e,writer:t,onTaskFinished:i,transferStreams:s}){try{const{value:o,readable:r,writable:l}=n,a=[];if(o&&(n.value=o,a.push(n.value.buffer)),s&&Jr?(r&&a.push(r),l&&a.push(l)):n.readable=n.writable=null,a.length)try{return e.postMessage(n,a),!0}catch{Jr=!1,n.readable=n.writable=null,e.postMessage(n)}else e.postMessage(n)}catch(o){throw t&&t.releaseLock(),i(),o}}async function Ep({data:n},e){const{type:t,value:i,messageId:s,result:o,error:r}=n,{reader:l,writer:a,resolveResult:c,rejectResult:u,onTaskFinished:h}=e;try{if(r){const{message:p,stack:A,code:C,name:m,outputSize:y}=r,E=new Error(p);Object.assign(E,{stack:A,code:C,name:m,outputSize:y}),f(E)}else{if(t==lp){const{value:p,done:A}=await l.read();ui({type:zr,value:p,done:A,messageId:s},e)}t==zr&&(await a.ready,await a.write(new Uint8Array(i)),ui({type:cp,messageId:s},e)),t==jr&&f(null,o)}}catch(p){ui({type:jr,messageId:s},e),f(p)}function f(p,A){p?u(p):c(A),a&&a.releaseLock(),h()}}let Pt=[];const Ss=[];let Zr=0;async function wp(n,e){const{options:t,config:i}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:l,signed:a,encrypted:c}=t,{workerURI:u,maxWorkers:h}=i;e.transferStreams=s||s===he;const f=!l&&!a&&!c&&!e.transferStreams;return e.useWebWorkers=!f&&(o||o===he&&i.useWebWorkers),e.workerURI=e.useWebWorkers&&u?u:he,t.useCompressionStream=r||r===he&&i.useCompressionStream,(await p()).run();async function p(){const C=Pt.find(m=>!m.busy);if(C)return ea(C),new xs(C,n,e,A);if(Pt.length<h){const m={indexWorker:Zr};return Zr++,Pt.push(m),new xs(m,n,e,A)}else return new Promise(m=>Ss.push({resolve:m,stream:n,workerOptions:e}))}function A(C){if(Ss.length){const[{resolve:m,stream:y,workerOptions:E}]=Ss.splice(0,1);m(new xs(C,y,E,A))}else C.worker?(ea(C),bp(C,e)):Pt=Pt.filter(m=>m!=C)}}function bp(n,e){const{config:t}=e,{terminateWorkerTimeout:i}=t;Number.isFinite(i)&&i>=0&&(n.terminated?n.terminated=!1:n.terminateTimeout=setTimeout(async()=>{Pt=Pt.filter(s=>s!=n);try{await n.terminate()}catch{}},i))}function ea(n){const{terminateTimeout:e}=n;e&&(clearTimeout(e),n.terminateTimeout=null)}const vp="Writer iterator completed too soon",Ip="Content-Type",xp=64*1024,ta="writable";class Ms{constructor(){this.size=0}init(){this.initialized=!0}}class na extends Ms{get readable(){const e=this,{chunkSize:t=xp}=e,i=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:l}=i,{chunkOffset:a}=this,c=r===he?t:Math.min(t,r-a),u=await Se(e,o+a,c,l);s.enqueue(u),a+t>r||r===he&&!u.length&&c?s.close():this.chunkOffset+=t}});return i}}class Ts extends na{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,t){const i=this,s=e+t;let r=await(e||s<i.size?i.blob.slice(e,s):i.blob).arrayBuffer();return r.byteLength>t&&(r=r.slice(e,s)),new Uint8Array(r)}}class Bp extends Ms{constructor(e){super();const t=this,i=new TransformStream,s=[];e&&s.push([Ip,e]),Object.defineProperty(t,ta,{get(){return i.writable}}),t.blob=new Response(i.readable,{headers:s}).blob()}getData(){return this.blob}}class Sp extends Bp{constructor(e){super(e),Object.assign(this,{encoding:e,utf8:!e||e.toLowerCase()=="utf-8"})}async getData(){const{encoding:e,utf8:t}=this,i=await super.getData();if(i.text&&t)return i.text();{const s=new FileReader;return new Promise((o,r)=>{Object.assign(s,{onload:({target:l})=>o(l.result),onerror:()=>r(s.error)}),s.readAsText(i,e)})}}}class Mp extends na{constructor(e){super(),this.readers=e}async init(){const e=this,{readers:t}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(t.map(async(i,s)=>{await i.init(),s!=t.length-1&&(e.lastDiskOffset+=i.size),e.size+=i.size})),super.init()}async readUint8Array(e,t,i=0){const s=this,{readers:o}=this;let r,l=i;l==-1&&(l=o.length-1);let a=e;for(;o[l]&&a>=o[l].size;)a-=o[l].size,l++;const c=o[l];if(c){const u=c.size;if(a+t<=u)r=await Se(c,a,t);else{const h=u-a;r=new Uint8Array(t);const f=await Se(c,a,h);r.set(f,0);const p=await s.readUint8Array(e+h,t-h,i);r.set(p,h),f.length+p.length<t&&(r=r.subarray(0,f.length+p.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(l,s.lastDiskNumber),r}}class ia extends Ms{constructor(e,t=4294967295){super();const i=this;Object.assign(i,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});let s,o,r;const l=new WritableStream({async write(u){const{availableSize:h}=i;if(r)u.length>=h?(await a(u.subarray(0,h)),await c(),i.diskOffset+=s.size,i.diskNumber++,r=null,await this.write(u.subarray(h))):await a(u);else{const{value:f,done:p}=await e.next();if(p&&!f)throw new Error(vp);s=f,s.size=0,s.maxSize&&(i.maxSize=s.maxSize),i.availableSize=i.maxSize,await hi(s),o=f.writable,r=o.getWriter(),await this.write(u)}},async close(){await r.ready,await c()}});Object.defineProperty(i,ta,{get(){return l}});async function a(u){const h=u.length;h&&(await r.ready,await r.write(u),s.size+=h,i.size+=h,i.availableSize-=h)}async function c(){await r.close()}}}class Tp{constructor(e){return Array.isArray(e)&&(e=new Mp(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class Dp{constructor(e){return e.writable===he&&typeof e.next==Dt&&(e=new ia(e)),e instanceof WritableStream&&(e={writable:e}),e.size===he&&(e.size=0),e instanceof ia||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function hi(n,e){if(n.init&&!n.initialized)await n.init(e);else return Promise.resolve()}function Se(n,e,t,i){return n.readUint8Array(e,t,i)}const sa="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),kp=sa.length==256;function Pp(n){if(kp){let e="";for(let t=0;t<n.length;t++)e+=sa[n[t]];return e}else return new TextDecoder().decode(n)}function fi(n,e){return e&&e.trim().toLowerCase()=="cp437"?Pp(n):new TextDecoder(e).decode(n)}const oa="filename",ra="rawFilename",aa="comment",la="rawComment",ca="uncompressedSize",da="compressedSize",ua="offset",ha="diskNumberStart",Ds="lastModDate",ks="rawLastModDate",fa="lastAccessDate",Fp="rawLastAccessDate",pa="creationDate",ga="rawCreationDate",Rp=[oa,ra,ca,da,Ds,ks,aa,la,fa,pa,ga,ua,ha,"internalFileAttributes","externalFileAttributes","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","compressionMethod","signature","extraField","extraFieldUnix","extraFieldInfoZip","uid","gid","unixMode","setuid","setgid","sticky","bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class ma{constructor(e){Rp.forEach(t=>this[t]=e[t])}}const Op="filenameEncoding",Lp="commentEncoding",Np="decodeText",Up="extractPrependedData",_p="extractAppendedData",Qp="password",Hp="rawPassword",Gp="passThrough",Yp="signal",Vp="checkPasswordOnly",Wp="checkOverlappingEntryOnly",zp="checkOverlappingEntry",jp="checkSignature",$p="useWebWorkers",Kp="useCompressionStream",Xp="transferStreams",qp="preventClose",Ps="File format is not recognized",Jp="End of central directory not found",Zp="End of Zip64 central directory locator not found",eg="Central directory header not found",tg="Local file header not found",ng="Zip64 extra field not found",ig="File contains encrypted entry",sg="Encryption method not supported",Aa="Compression method not supported",ya="Split zip file",og="Overlapping entry found",Ca="utf-8",rg="UTF8",Ea="cp437",ag=[[ca,Tt],[da,Tt],[ua,Tt],[ha,qe]],lg={[qe]:{getValue:fe,bytes:4},[Tt]:{getValue:Jt,bytes:8}};class wa{constructor(e,t={}){Object.assign(this,{reader:new Tp(e),options:t,config:Pf(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:i}=t;const{config:s}=t;if(await hi(i),(i.size===he||!i.readUint8Array)&&(i=new Ts(await new Response(i.readable).blob()),await hi(i)),i.size<Xt)throw new Error(Ps);i.chunkSize=Ff(s);const o=await gg(i,tf,i.size,Xt,qe*16);if(!o){const D=await Se(i,0,4),P=pe(D);throw fe(P)==hr?new Error(ya):new Error(Jp)}const r=pe(o);let l=fe(r,12),a=fe(r,16);const c=o.offset,u=xe(r,20),h=c+Xt+u;let f=xe(r,4);const p=i.lastDiskNumber||0;let A=xe(r,6),C=xe(r,8),m=0,y=0;if(a==Tt||l==Tt||C==qe||A==qe){const D=await Se(i,o.offset-ms,ms),P=pe(D);if(fe(P,0)==nf){a=Jt(P,8);let L=await Se(i,a,As,-1),G=pe(L);const N=o.offset-ms-As;if(fe(G,0)!=pr&&a!=N){const b=a;a=N,a>b&&(m=a-b),L=await Se(i,a,As,-1),G=pe(L)}if(fe(G,0)!=pr)throw new Error(Zp);f==qe&&(f=fe(G,16)),A==qe&&(A=fe(G,20)),C==qe&&(C=Jt(G,32)),l==Tt&&(l=Jt(G,40)),a-=l}}if(a>=i.size&&(m=i.size-a-l-Xt,a=i.size-l-Xt),p!=f)throw new Error(ya);if(a<0)throw new Error(Ps);let E=0,I=await Se(i,a,l,A),M=pe(I);if(l){const D=o.offset-l;if(fe(M,E)!=fr&&a!=D){const P=a;a=D,a>P&&(m+=a-P),I=await Se(i,a,l,A),M=pe(I)}}const k=o.offset-a-(i.lastDiskOffset||0);if(l!=k&&k>=0&&(l=k,I=await Se(i,a,l,A),M=pe(I)),a<0||a>=i.size)throw new Error(Ps);const S=Me(t,e,Op),x=Me(t,e,Lp);for(let D=0;D<C;D++){const P=new cg(i,s,t.options);if(fe(M,E)!=fr)throw new Error(eg);ba(P,M,E+6);const L=!!P.bitFlag.languageEncodingFlag,G=E+46,N=G+P.filenameLength,b=N+P.extraFieldLength,w=xe(M,E+4),v=w>>8==0,B=w>>8==3,R=I.subarray(G,N),U=xe(M,E+32),O=b+U,T=I.subarray(b,O),Q=L,V=L,$=fe(M,E+38),J=$&gs,ne={readOnly:!!(J&yf),hidden:!!(J&Cf),system:!!(J&Ef),directory:!!(J&Af),archive:!!(J&wf)},re=fe(M,E+42)+m,Y=Me(t,e,Np)||fi,j=Q?Ca:S||Ea,X=V?Ca:x||Ea;let se=Y(R,j);se===he&&(se=fi(R,j));let oe=Y(T,X);oe===he&&(oe=fi(T,X)),Object.assign(P,{versionMadeBy:w,msDosCompatible:v,compressedSize:0,uncompressedSize:0,commentLength:U,offset:re,diskNumberStart:xe(M,E+34),internalFileAttributes:xe(M,E+36),externalFileAttributes:$,msdosAttributesRaw:J,msdosAttributes:ne,rawFilename:R,filenameUTF8:Q,commentUTF8:V,rawExtraField:I.subarray(N,b),rawComment:T,filename:se,comment:oe}),y=Math.max(re,y),va(P,P,M,E+6);const ae=P.externalFileAttributes>>16&qe;P.unixMode===he&&(ae&(bf|Cs|ys))!=0&&(P.unixMode=ae);const Ce=!!(P.unixMode&vf),le=!!(P.unixMode&If),Pe=!!(P.unixMode&xf),ct=P.unixMode!==he?(P.unixMode&Cs)!=0:B&&(ae&Cs)!=0,$e=P.unixMode!==he&&(P.unixMode&Cr)==ys,vt=(ae&Cr)==ys;Object.assign(P,{setuid:Ce,setgid:le,sticky:Pe,unixExternalUpper:ae,internalFileAttribute:P.internalFileAttributes,externalFileAttribute:P.externalFileAttributes,executable:ct,directory:$e||vt||v&&ne.directory||se.endsWith(Bf)&&!P.uncompressedSize,zipCrypto:P.encrypted&&!P.extraFieldAES});const it=new ma(P);it.getData=(Ut,_t)=>P.getData(Ut,it,t.readRanges,_t),it.arrayBuffer=async Ut=>{const _t=new TransformStream,[Xi]=await Promise.all([new Response(_t.readable).arrayBuffer(),P.getData(_t,it,t.readRanges,Ut)]);return Xi},E=O;const{onprogress:dn}=e;if(dn)try{await dn(D+1,C,new ma(P))}catch{}yield it}const g=Me(t,e,Up),F=Me(t,e,_p);return g&&(t.prependedData=y>0?await Se(i,0,y):new Uint8Array),t.comment=u?await Se(i,c+Xt,u):new Uint8Array,F&&(t.appendedData=h<i.size?await Se(i,h,i.size-h):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const i of this.getEntriesGenerator(e))t.push(i);return t}async close(){}}class cg{constructor(e,t,i){Object.assign(this,{reader:e,config:t,options:i})}async getData(e,t,i,s={}){const o=this,{reader:r,offset:l,diskNumberStart:a,extraFieldAES:c,extraFieldZip64:u,compressionMethod:h,config:f,bitFlag:p,signature:A,rawLastModDate:C,uncompressedSize:m,compressedSize:y}=o,{dataDescriptor:E}=p,I=t.localDirectory={},M=await Se(r,l,Es,a),k=pe(M);let S=Me(o,s,Qp),x=Me(o,s,Hp);const g=Me(o,s,Gp);if(S=S&&S.length&&S,x=x&&x.length&&x,c&&c.originalCompressionMethod!=Jh)throw new Error(Aa);if(h!=qh&&h!=Xh&&h!=ur&&!g)throw new Error(Aa);if(fe(k,0)!=Zh)throw new Error(tg);ba(I,k,4);const{extraFieldLength:F,filenameLength:D,lastAccessDate:P,creationDate:L}=I;I.rawExtraField=F?await Se(r,l+Es+D,F,a):new Uint8Array,va(o,I,k,4,!0),Object.assign(t,{lastAccessDate:P,creationDate:L});const G=o.encrypted&&I.encrypted&&!g,N=G&&!c;if(g||(t.zipCrypto=N),G){if(!N&&c.strength===he)throw new Error(sg);if(!S&&!x)throw new Error(ig)}const b=l+Es+D+F,w=y,v=r.readable;Object.assign(v,{diskNumberStart:a,offset:b,size:w});const B=Me(o,s,Yp),R=Me(o,s,Vp);let U=Me(o,s,zp);const O=Me(o,s,Wp);O&&(U=!0);const{onstart:T,onprogress:Q,onend:V}=s,$=h==ur;let J=Me(o,s,Kp);$&&(J=!1);const ne={options:{codecType:$r,password:S,rawPassword:x,zipCrypto:N,encryptionStrength:c&&c.strength,signed:Me(o,s,jp)&&!g,passwordVerification:N&&(E?C>>>8&gs:A>>>24&gs),outputSize:g?y:m,signature:A,compressed:h!=0&&!g,encrypted:o.encrypted&&!g,useWebWorkers:Me(o,s,$p),useCompressionStream:J,transferStreams:Me(o,s,Xp),deflate64:$,checkPasswordOnly:R},config:f,streamOptions:{signal:B,size:w,onstart:T,onprogress:Q,onend:V}};U&&await pg({reader:r,fileEntry:t,offset:l,diskNumberStart:a,signature:A,compressedSize:y,uncompressedSize:m,dataOffset:b,dataDescriptor:E||I.bitFlag.dataDescriptor,extraFieldZip64:u||I.extraFieldZip64,readRanges:i});let re;try{if(!O){R&&(e=new WritableStream),e=new Dp(e),await hi(e,g?y:m),{writable:re}=e;const{outputSize:Y}=await wp({readable:v,writable:re},ne);if(e.size+=Y,Y!=(g?y:m))throw new Error(Yr)}}catch(Y){if(Y.outputSize!==he&&(e.size+=Y.outputSize),!R||Y.message!=ws)throw Y}finally{!Me(o,s,qp)&&re&&!re.locked&&await re.getWriter().close()}return R||O?he:e.getData?e.getData():re}}function ba(n,e,t){const i=n.rawBitFlag=xe(e,t+2),s=(i&mr)==mr,o=fe(e,t+6);Object.assign(n,{encrypted:s,version:xe(e,t),bitFlag:{level:(i&mf)>>1,dataDescriptor:(i&Ar)==Ar,languageEncodingFlag:(i&yr)==yr},rawLastModDate:o,lastModDate:mg(o),filenameLength:xe(e,t+22),extraFieldLength:xe(e,t+24)})}function va(n,e,t,i,s){const{rawExtraField:o}=e,r=e.extraField=new Map,l=pe(new Uint8Array(o));let a=0;try{for(;a<o.length;){const E=xe(l,a),I=xe(l,a+2);r.set(E,{type:E,data:o.slice(a+4,a+4+I)}),a+=4+I}}catch{}const c=xe(t,i+4);Object.assign(e,{signature:fe(t,i+Sf),compressedSize:fe(t,i+Mf),uncompressedSize:fe(t,i+Tf)});const u=r.get(rf);u&&(dg(u,e),e.extraFieldZip64=u);const h=r.get(uf);h&&(Ia(h,oa,ra,e,n),e.extraFieldUnicodePath=h);const f=r.get(hf);f&&(Ia(f,aa,la,e,n),e.extraFieldUnicodeComment=f);const p=r.get(af);p?(ug(p,e,c),e.extraFieldAES=p):e.compressionMethod=c;const A=r.get(lf);A&&(hg(A,e),e.extraFieldNTFS=A);const C=r.get(gf);if(C)xa(C,e,!1),e.extraFieldUnix=C;else{const E=r.get(pf);E&&(xa(E,e,!0),e.extraFieldInfoZip=E)}const m=r.get(df);m&&(fg(m,e,s),e.extraFieldExtendedTimestamp=m);const y=r.get(ff);y&&(e.extraFieldUSDZ=y)}function dg(n,e){e.zip64=!0;const t=pe(n.data),i=ag.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<i.length;s++){const[r,l]=i[s];if(e[r]==l){const a=lg[l];e[r]=n[r]=a.getValue(t,o),o+=a.bytes}else if(n[r])throw new Error(ng)}}function Ia(n,e,t,i,s){const o=pe(n.data),r=new li;r.append(s[t]);const l=pe(new Uint8Array(4));l.setUint32(0,r.get(),!0);const a=fe(o,1);Object.assign(n,{version:gt(o,0),[e]:fi(n.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&a==fe(l,0)}),n.valid&&(i[e]=n[e],i[e+rg]=!0)}function ug(n,e,t){const i=pe(n.data),s=gt(i,4);Object.assign(n,{vendorVersion:gt(i,0),vendorId:gt(i,2),strength:s,originalCompressionMethod:t,compressionMethod:xe(i,5)}),e.compressionMethod=n.compressionMethod}function hg(n,e){const t=pe(n.data);let i=4,s;try{for(;i<n.data.length&&!s;){const o=xe(t,i),r=xe(t,i+2);o==cf&&(s=n.data.slice(i+4,i+4+r)),i+=4+r}}catch{}try{if(s&&s.length==24){const o=pe(s),r=o.getBigUint64(0,!0),l=o.getBigUint64(8,!0),a=o.getBigUint64(16,!0);Object.assign(n,{rawLastModDate:r,rawLastAccessDate:l,rawCreationDate:a});const c=Fs(r),u=Fs(l),h=Fs(a),f={lastModDate:c,lastAccessDate:u,creationDate:h};Object.assign(n,f),Object.assign(e,f)}}catch{}}function xa(n,e,t){try{const i=pe(new Uint8Array(n.data));let s=0;const o=gt(i,s++),r=gt(i,s++),l=n.data.subarray(s,s+r);s+=r;const a=Ba(l),c=gt(i,s++),u=n.data.subarray(s,s+c);s+=c;const h=Ba(u);let f=he;if(!t&&s+2<=n.data.length){const p=n.data;f=new DataView(p.buffer,p.byteOffset+s,2).getUint16(0,!0)}Object.assign(n,{version:o,uid:a,gid:h,unixMode:f}),a!==he&&(e.uid=a),h!==he&&(e.gid=h),f!==he&&(e.unixMode=f)}catch{}}function Ba(n){const e=new Uint8Array(4);return e.set(n,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function fg(n,e,t){const i=pe(n.data),s=gt(i,0),o=[],r=[];t?((s&1)==1&&(o.push(Ds),r.push(ks)),(s&2)==2&&(o.push(fa),r.push(Fp)),(s&4)==4&&(o.push(pa),r.push(ga))):n.data.length>=5&&(o.push(Ds),r.push(ks));let l=1;o.forEach((a,c)=>{if(n.data.length>=l+4){const u=fe(i,l);e[a]=n[a]=new Date(u*1e3);const h=r[c];n[h]=u}l+=4})}async function pg({reader:n,fileEntry:e,offset:t,diskNumberStart:i,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:l,dataDescriptor:a,extraFieldZip64:c,readRanges:u}){let h=0;if(i)for(let A=0;A<i;A++){const C=n.readers[A];h+=C.size}let f=0;if(a&&(c?f=of:f=sf),f){const A=await Se(n,l+o,f+gr,i);if(fe(pe(A),0)==ef){const m=fe(pe(A),4);let y,E;c?(y=Jt(pe(A),8),E=Jt(pe(A),16)):(y=fe(pe(A),8),E=fe(pe(A),12)),(e.encrypted&&!e.zipCrypto||m==s)&&y==o&&E==r&&(f+=gr)}}const p={start:h+t,end:h+l+o+f,fileEntry:e};for(const A of u)if(A.fileEntry!=e&&p.start>=A.start&&p.start<A.end){const C=new Error(og);throw C.overlappingEntry=A.fileEntry,C}u.push(p)}async function gg(n,e,t,i,s){const o=new Uint8Array(4),r=pe(o);Ag(r,0,e);const l=i+s;return await a(i)||await a(Math.min(l,t));async function a(c){const u=t-c,h=await Se(n,u,c);for(let f=h.length-i;f>=0;f--)if(h[f]==o[0]&&h[f+1]==o[1]&&h[f+2]==o[2]&&h[f+3]==o[3])return{offset:u+f,buffer:h.slice(f,f+i).buffer}}}function Me(n,e,t){return e[t]===he?n.options[t]:e[t]}function mg(n){const e=(n&4294901760)>>16,t=n&qe;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(t&63488)>>11,(t&2016)>>5,(t&31)*2,0)}catch{}}function Fs(n){return new Date(Number(n/BigInt(1e4)-BigInt(116444736e5)))}function gt(n,e){return n.getUint8(e)}function xe(n,e){return n.getUint16(e,!0)}function fe(n,e){return n.getUint32(e,!0)}function Jt(n,e){return Number(n.getBigUint64(e,!0))}function Ag(n,e,t){n.setUint32(e,t,!0)}function pe(n){return new DataView(n.buffer)}try{ai({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:es&&es.tagName.toUpperCase()==="SCRIPT"&&es.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function yg(n){let e;n({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const l=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,a=[];for(let c=0;l>c;c+=4){const u=Le.indexOf(r[c])<<18|Le.indexOf(r[c+1])<<12|(63&Le.indexOf(r[c+2]))<<6|63&Le.indexOf(r[c+3]);a.push(u>>16&255),r[c+2]!=="="&&a.push(u>>8&255),r[c+3]!=="="&&a.push(255&u)}return new Uint8Array(a)})(t);let i=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const l=t[r++];if(128&l){const a=3+(127&l),c=t[r++]<<8|t[r++],u=s-c;o(s+a);for(let h=0;a>h;h++)i[s++]=i[u+h]}else{const a=l;o(s+a);for(let c=0;a>c&&r<t.length;c++)i[s++]=t[r++]}}return(r=>{let l="";const a=r.length;let c=0;for(;a>c+2;c+=3){const h=r[c]<<16|r[c+1]<<8|r[c+2];l+=Le[h>>18&63]+Le[h>>12&63]+Le[h>>6&63]+Le[63&h]}const u=a-c;if(u===1){const h=r[c]<<16;l+=Le[h>>18&63]+Le[h>>12&63]+"=="}else if(u===2){const h=r[c]<<16|r[c+1]<<8;l+=Le[h>>18&63]+Le[h>>12&63]+Le[h>>6&63]+"="}return l})(new Uint8Array(i.buffer.slice(0,s)));function o(r){if(i.length<r){let l=2*i.length;for(;r>l;)l*=2;const a=new Uint8Array(l);a.set(i.subarray(0,s)),i=a}}})("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BAGZgAAEAVmAAAQB2YAABAE5gAAEAbmAAAQBeYAABAH5gAAEAQWAAAQBhYAABAFFgAAEAcWAAAQBJYAABAGlgAAEAWWAAAQB5YAABAEVgAAEAZWAAAQBVYAABAHVgAAEATWAAAQBtYAABAF1gAAEAfWAAAQBDYAABAGNgAAEAU2AAAQBzYAABIARMwIArYAABAFtgAAEAe2AAAQBHYAABAGdgAAEAV2AAAQB3YAABAE9gAAEAb2AAAQBfYAABAH9gAAEAROAAMIFEwEJAJOAAAgBk4AACAFTgAAIAVOAAAgB04AACAHTgAAIATOAAAgBM4AACAGzgAAIAbOAAAgBc4AACAFzgAAIAfOAAAgB84AACAELgAAIgBDagAQCgAAEgAAIAUuAAAgBS4AACAHLgAAIAcuAAAgBK4AACAErgAAIAauAAAgBq4AACAFrgAAIAWuAAAgB64AACAHrgAAIARuAAAgBG4AACAGbgAAIAZuAAAgBW4AACAFbgAAIAduAAAgB24AACAE7gAAIATuAAAgBu4AACAG7gAAIAXuAAAgBe4AACAH7gAAIAfuAAAiBA7YBB4AACAGHgAAIAYeAAAgBR4AACAFHgAAIAceAAAgBx4AACAEngAAIASeAAAgBp4AACAGngAAIAWeAAAgBZ4AACAHngAAIAeeAAAgBF4AACAEXgAAIAZeAAAgBl4AACAFXgAAIAVeAAAgB14AACAHXgAAIATeAAAgBN4AACAG3gAAIAbeAAAgBd4AACAF3gAAIAfeAAAgB94AACAEPgAAIAQ+AAAgBj4AACAGPgAAIAU+AAAgBT4AACAHPgAAIAc+AAAgBL4AACAEvgAAIAa+AAAgBr4AACAFvgAAIAW+AAAgB74AACAHvgAAIAR+AAAgBH4AACAGfgAAIAZ+AAAgBX4AACAFfgAAIAd+AAAgB34AACAE/gAAIAT+AAAgBv4AACAG/gAAIAX+AAAgBf4AACAH/gAAIAf+AAAiBBAoBQIAABAEggAAEAWCAAAQBEIAABAFQgAAEATCAAAQBcIIFVgMHAEiAAAQBKIAABAFogAAEARiAAAQBWIAABAE4gAAEAXiAAAQBBIAABAFEgAAEASSAAAQBZIAABAEUgAAEAVSAAAQBNIAABAF0gAAEAQOAAEIBg4AABAFDgAAEAcOAAAQBI4AABAGjgAAEAWOAAAQB44AABIC+K4AAdIECxgEFgABcAQWCBUoBFIAABAEMgAAEARyAAASAvlaABEQBBYIGBAEaggXqAQWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let ye,Zt,Ne,xn;function Cg(n){if(ye=n,{malloc:Zt,free:Ne,memory:xn}=ye,typeof Zt!="function"||typeof Ne!="function"||!xn)throw ye=Zt=Ne=xn=null,new Error("Invalid WASM module")}function Sa(n,e,t={}){const i=typeof t.level=="number"?t.level:-1,s=typeof t.outBuffer=="number"?t.outBuffer:64*1024,o=typeof t.inBufferSize=="number"?t.inBufferSize:64*1024;return new TransformStream({start(){let r;if(this.out=Zt(s),this.in=Zt(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),n?(this._process=ye.deflate_process,this._last_consumed=ye.deflate_last_consumed,this._end=ye.deflate_end,this.streamHandle=ye.deflate_new(),e==="gzip"?r=ye.deflate_init_gzip(this.streamHandle,i):e==="deflate-raw"?r=ye.deflate_init_raw(this.streamHandle,i):r=ye.deflate_init(this.streamHandle,i)):e==="deflate64-raw"?(this._process=ye.inflate9_process,this._last_consumed=ye.inflate9_last_consumed,this._end=ye.inflate9_end,this.streamHandle=ye.inflate9_new(),r=ye.inflate9_init_raw(this.streamHandle)):(this._process=ye.inflate_process,this._last_consumed=ye.inflate_last_consumed,this._end=ye.inflate_end,this.streamHandle=ye.inflate_new(),e==="deflate-raw"?r=ye.inflate_init_raw(this.streamHandle):e==="gzip"?r=ye.inflate_init_gzip(this.streamHandle):r=ye.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,l){try{const a=r,c=new Uint8Array(xn.buffer),u=this._process,h=this._last_consumed,f=this.out,p=this._scratch;let A=0;for(;A<a.length;){const C=Math.min(a.length-A,32768);(!this.in||this.inBufferSize<C)&&(this.in&&Ne&&Ne(this.in),this.in=Zt(C),this.inBufferSize=C),c.set(a.subarray(A,A+C),this.in);const m=u(this.streamHandle,this.in,C,f,s,0),y=m&16777215;if(y&&(p.set(c.subarray(f,f+y),0),l.enqueue(p.slice(0,y))),!n){const I=m>>24&255,M=I&128?I-256:I;if(M<0)throw new Error("process error:"+M)}const E=h(this.streamHandle);if(E===0)break;A+=E}}catch(a){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Ne&&Ne(this.in),this.out&&Ne&&Ne(this.out),l.error(a)}},flush(r){try{const l=new Uint8Array(xn.buffer),a=this._process,c=this.out,u=this._scratch;for(;;){const h=a(this.streamHandle,0,0,c,s,4),f=h&16777215,p=h>>24&255;if(!n){const A=p&128?p-256:p;if(A<0)throw new Error("process error:"+A)}if(f&&(u.set(l.subarray(c,c+f),0),r.enqueue(u.slice(0,f))),p===1||f===0)break}}catch(l){r.error(l)}finally{if(this._end&&this.streamHandle){const l=this._end(this.streamHandle);l!==0&&r.error(new Error("end error:"+l))}this.in&&Ne&&Ne(this.in),this.out&&Ne&&Ne(this.out)}}})}class Eg{constructor(e="deflate",t){return Sa(!0,e,t)}}class wg{constructor(e="deflate",t){return Sa(!1,e,t)}}let Ma=!1;async function bg(n,{baseURI:e}){if(!Ma){let t,i;try{try{i=new URL(n,e)}catch{}t=await(await fetch(i)).arrayBuffer()}catch(o){if(n.startsWith("data:application/wasm;base64,"))t=vg(n);else throw o}const s=await WebAssembly.instantiate(t);Cg(s.instance.exports),Ma=!0}}function vg(n){const e=n.split(",")[1],t=atob(e),i=t.length,s=new Uint8Array(i);for(let o=0;o<i;++o)s[o]=t.charCodeAt(o);return s.buffer}let Rs;yg(ai),fp({initModule:n=>{if(!Rs){let{wasmURI:e}=n;typeof e==Dt&&(e=e()),Rs=bg(e,n)}return Rs}}),ai({CompressionStreamZlib:Eg,DecompressionStreamZlib:wg});const Os={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":["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":"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"]}};(()=>{const n={};for(const e of Object.keys(Os))for(const t of Object.keys(Os[e])){const i=Os[e][t];if(typeof i=="string")n[i]=e+"/"+t;else for(let s=0;s<i.length;s++)n[i[s]]=e+"/"+t}return n})(),Rf(ai);const Ee=d.reactive({visible:!1,type:"info",title:"",description:"",closable:!1,showIcon:!0,duration:3});let Te=null,Ta=null,Da=!1,Ls=null,pi=null;function Ig(){if(pi||typeof document>"u")return;const n=`
14
14
  .tech-alert-wrapper {
15
15
  position: fixed;
16
16
  top: 20px;
@@ -78,7 +78,7 @@
78
78
  from { transform: rotate(0deg); }
79
79
  to { transform: rotate(360deg); }
80
80
  }
81
- `;pi=document.createElement("style"),pi.textContent=n,document.head.appendChild(pi)}function Ig(){if(Da)return;xg(),Te=document.createElement("div"),Te.className="tech-alert-wrapper",document.body.appendChild(Te);const n={setup(){return()=>Ee.visible?d.h(me.Alert,{class:`tech-alert tech-alert-${Ee.type}`,message:Ee.title,description:Ee.description,showIcon:Ee.showIcon,closable:Ee.closable,onClose:()=>{Ee.visible=!1}},{icon:()=>Ee.type==="loading"?d.h(pn.LoadingOutlined):Ee.type==="success"?d.h(pn.CheckCircleOutlined):Ee.type==="error"?d.h(pn.CloseCircleOutlined):Ee.type==="warning"?d.h(pn.ExclamationCircleOutlined):d.h(pn.InfoCircleOutlined)}):null}};Ta=d.createVNode(n),d.render(Ta,Te),Da=!0}function Bn(n){Ig(),Ls&&clearTimeout(Ls),Ee.type=n.type||"info",Ee.title=n.title||"",Ee.description=n.description||"",Ee.closable=n.closable??!1,Ee.showIcon=n.showIcon??!0,Ee.visible=!0,Te&&(n.container?(Te.parentNode!==n.container&&n.container.appendChild(Te),Te.style.position="absolute",Te.style.top="20px",Te.style.left="50%",Te.style.transform="translateX(-50%)"):(Te.parentNode!==document.body&&document.body.appendChild(Te),Te.style.position="fixed",Te.style.top="20px",Te.style.left="50%",Te.style.transform="translateX(-50%)"));const e=n.duration??(Ee.type==="loading"?0:3);e>0&&(Ls=setTimeout(()=>{Ee.visible=!1},e*1e3))}const ge={info:(n,e,t,i)=>Bn({type:"info",title:n,description:e,duration:t,container:i}),success:(n,e,t,i)=>Bn({type:"success",title:n,description:e,duration:t,container:i}),error:(n,e,t,i)=>Bn({type:"error",title:n,description:e,duration:t,container:i}),warning:(n,e,t,i)=>Bn({type:"warning",title:n,description:e,duration:t,container:i}),loading:(n,e,t)=>Bn({type:"loading",title:n,description:e,duration:0,container:t}),close:()=>{Ee.visible=!1}},Bg="E84#E3C4!8C4&A1";async function mt(n){try{const e=await fetch(n);if(!e.ok)return ge.error("[loadModelFile] 加载失败",`${n} ${e.status}`),!1;const t=await e.blob();try{const i=new wa(new Ts(t),{password:Bg}),o=(await i.getEntries()).find(l=>!l.directory&&l.filename.endsWith(".json"));if(!o)return await i.close(),!1;const r=await o.getData(new Sp);return await i.close(),JSON.parse(r.trim())}catch{const i=await t.text();try{return JSON.parse(i.trim())}catch(s){throw console.error(`[loadModelFile] JSON parse error: ${n}`,s),s}}}catch(e){return ge.error("[loadModelFile] 加载失败",`${n} ${e}`),!1}}function Sg(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}class gi{events={};on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}emit(e,...t){this.events[e]&&this.events[e].forEach(i=>i(...t))}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(i=>i!==t))}}class ka{cesium;viewer;modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new gi;options={flyTo:!0,flyToDuration:0,loadTreeNodeDetails:!0,loadTreeNodeDetailsUrl:"/elementInfo.zip",loadTree:!0,loadTreeUrl:"/allElementsInfo.zip",boxRegionUrl:"/BoundingBoxInfo.zip",regionUrl:"/region.zip",batchIDInfoUrl:"/batchIDInfo.zip",enabledSection:!0,delay:0,tilesetOptions:{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:32,skipLevelOfDetail:!0,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:128,skipLevels:5,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*10,preloadWhenHidden:!0,preferLeaves:!0,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.options.tilesetOptions&&(this.options.tilesetOptions.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE)}deleteAllModels(){const e=[];return Object.keys(this.mapTileset).forEach(t=>{const i=this.mapTileset[t];i&&(this.viewer.scene.primitives.remove(i),e.push(t)),delete this.mapTileset[t],delete this.hasLoaded3dTiles[t],delete this.mapRecordModelId[t]}),this.modelList=[],this.viewer.scene.requestRender(),this.events.emit("mountAll3Dtiles",{modelList:[],mapTileset:{}}),e}deleteModels(e){const t=[];return e.forEach(({modelId:i})=>{const s=this.mapTileset[i];s&&(this.viewer.scene.primitives.remove(s),t.push(i)),delete this.mapTileset[i],delete this.hasLoaded3dTiles[i],delete this.mapRecordModelId[i]}),this.modelList=this.modelList.filter(i=>!t.includes(i.modelId)),this.viewer.scene.requestRender(),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset}),t}showModels(e){const t=[];return e.forEach(i=>{const s=`${i.modelId}`,o=this.mapTileset[s];o&&(o.show=!!i.show,t.push(s))}),t.length&&this.viewer.scene.requestRender(),t}async addModels({files:e,fileNames:t,options:i}){const s=e||t||[];s.length>0&&await this.add3DTilesModel(s,i)}async add3DTilesModel(e,t){const i=t?Kh({},this.options,t):{...this.options};if(e?.length){for(const s of e){const o=`${s.modelId}`;if(this.mapRecordModelId[o])continue;const r=`${s.outPutPath}${s.dbName}/tileset.json`;this.modelList.push({...s,url:r,state:Kt.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(i)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===Kt.NotLoaded);if(!t.length)return;const i=t.length;this.events.emit("loadingStatus",`正在加载 ${i} 个模型`);let s=0,o=!1;for(const r of t){s++;try{r.state=Kt.Loading;const l=r.url,a=this.getBaseUrlPath(l);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}构件信息`);let c=e.loadTreeNodeDetails?await mt(`${a}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}目录树`);const u=e.loadTree?await mt(`${a}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}模型数据`);const h=e.boxRegionUrl?await mt(`${a}${e.boxRegionUrl}`):!1,f=e.batchIDInfoUrl?await mt(`${a}${e.batchIDInfoUrl}`):!1;f&&(c||(c=f));const p=await this.loadTilesetWithZipSupport(l,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(p),await p.readyPromise;const A=`${p?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=p;const C={versionId:A,selectedFn:e.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:r.url,treeUrl:`${a}${e.loadTreeUrl}`,nodeUrl:`${a}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:c||null,tree:u||null,box:null};if(h?.min&&h?.max){const m={x:h.min.X,y:h.min.Y,z:h.min.Z},y={x:h.max.X,y:h.max.Y,z:h.max.Z},E={x:(m.x+y.x)/2,y:(m.y+y.y)/2,z:(m.z+y.z)/2};C.box={min:m,max:y,center:E}}if(!r.formData){const m=await mt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(m)r.formData={modelId:r.modelId.toString(),longitude:m.Longitude,latitude:m.Latitude,distance:1e-6,rotation:30,totalRotation:m.DAngle||0,height:m.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:m?.X||0,Y:m?.Y||0,Z:m?.Z||0};else{const y=t.indexOf(r);r.formData={modelId:r.modelId.toString(),longitude:118.12548706388897,latitude:24.596796919444404,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:0,lonlat:1e-5,modelOptions:[{value:y+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,C.model.formData=r.formData),p.leiting=C,dr({Cesium:this.cesium,tileset:p}),r.state=Kt.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",p),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(p),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(m=>setTimeout(m,e.delay))}catch(l){console.error(`模型 ${r.modelName} 加载失败:`,l),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=Kt.Error}}e.mountAll3Dtiles&&e.mountAll3Dtiles(this.modelList),e.onMountAll3Dtiles&&e.onMountAll3Dtiles(this.modelList),this.events.emit("loadingStatus",""),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}async addOSGB({files:e,options:t}){const i=this.cesium;if(!e?.length)return;this.events.emit("loadingStatus",`正在加载 ${e.length} 个倾斜摄影模型`);let s=!1,o=0;for(const r of e){o++,this.events.emit("loadingStatus",`正在加载第 ${o}/${e.length} 个模型: 加载${r.modelName}`);try{const{outPutPath:l,dbName:a,modelId:c}=r,u=`${l}${a}/tileset.json`,h=await i.Cesium3DTileset.fromUrl(u,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(this.viewer.scene.primitives.add(h),await h.readyPromise,this.mapTileset[`${c}`]=h,this.hasLoaded3dTiles[`${c}`]=(this.hasLoaded3dTiles[`${c}`]||0)+1,this.mapRecordModelId[`${c}`]=!0,!r?.formData){const f=h.root.computedTransform;if(f){const p=i.Matrix4.fromColumnMajorArray(f),A=i.Matrix4.getTranslation(p,new i.Cartesian3),C=i.Ellipsoid.WGS84.cartesianToCartographic(A),m=i.Math.toDegrees(C.longitude),y=i.Math.toDegrees(C.latitude),E=C.height;r.formData={modelId:r.modelId.toString(),longitude:m,latitude:y,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:E,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${c} 无法获取初始位置信息`)}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),h.leiting={versionId:`${h?.asset?.tilesetVersion??c}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:u,formData:r.formData,type:"OSGB"},box:null},this.modelList.push({...r,url:u,state:Kt.Loaded}),!s&&t?.flyTo&&(this.viewer.zoomTo(h),s=!0)}catch(l){console.error(`OSGB模型 ${r.dbName} 加载失败:`,l);continue}}this.events.emit("loadingStatus",""),this.events.emit("onMountAllOsgb3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}updateOSGBMatrix(e){const{X:t,Y:i,Z:s,modelId:o}=e,r=this.cesium,l=this.mapTileset[o];if(!l){console.warn("tileSet not found for modelId:",o);return}let a=t||0,c=i||0,u=s||0;const h=l.boundingSphere.center,f=r.Transforms.eastNorthUpToFixedFrame(h),p=new r.Cartesian3(a,c,u),A=r.Matrix4.multiplyByPoint(f,p,new r.Cartesian3(0,0,0)),C=r.Cartesian3.subtract(A,h,new r.Cartesian3);l.modelMatrix=r.Matrix4.fromTranslation(C)}flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...l}=t,a={duration:0,...l};this.viewer.flyTo(s,a).then(c=>{c?o&&o():r&&r()}).catch(c=>{r&&r(),console.error("FlyTo error",c)})}getMapTileset(){return this.mapTileset}getBIMmodelId(){return this.BIMmodelId}getModelList(){return this.modelList}setMapTileset(e){this.mapTileset=e}setBIMmodelId(e){this.BIMmodelId=e}setModelList(e){this.modelList=e}getBaseUrlPath(e){const t=e.lastIndexOf("/");return t===-1?".":e.substr(0,t)}async loadTilesetWithZipSupport(e,t,i,s){const o=`${this.getBaseUrlPath(e)}/tileset.zip`;if((await fetch(o)).status===200){const a=await mt(o);if(a){const c=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(c),h=s.Proxy,f=this.getBaseUrlPath(e);h.getURL=A=>A.includes("blob://")?A.replace(/blob:\/\//g,f):A;const p=new s.Resource({url:u,proxy:h});try{return await s.Cesium3DTileset.fromUrl(p,{id:t,...i})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...i})}}}return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...i})}async loadTreeForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting.tree)return t.leiting.tree;const i=t.leiting.model?.treeUrl,s=t.leiting.model?.modelName||e;if(!i)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 目录树...`);try{const o=await mt(i);if(o)return t.leiting.tree=o,o}catch(o){console.error(`Failed to load tree for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const i=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!i)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await mt(i);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}}const Pa={normal:0,process:2},Mg={color:1};function Fa(n){return n===1||n==="exist"?1:n===2||n==="process"?2:0}function en(n){return Number.isNaN(n)?0:n<=1?Math.min(Math.max(n,0),1):Math.min(Math.max(n/255,0),1)}function Ra(n){return Number.isNaN(n)?1:n<=1?Math.min(Math.max(n,0),1):1}function Ns(n){if(!n)return null;const e=Number(n.r),t=Number(n.g),i=Number(n.b),s=n.a===void 0?1:Number(n.a);if([e,t,i,s].some(a=>Number.isNaN(a)))return null;const o=Math.round(e*255),r=Math.round(t*255),l=Math.round(i*255);return`rgba(${o},${r},${l},${s})`}function Tg(n){if(!n||typeof n!="string")return null;const t=n.replace(/\s+/g,"").match(/^rgba?\((\d+),(\d+),(\d+)(?:,([0-9.]+))?\)$/i);if(!t)return null;const i=Number(t[1]),s=Number(t[2]),o=Number(t[3]),r=t[4]===void 0?1:Number(t[4]);return[i,s,o,r].some(l=>Number.isNaN(l))?null:{r:Math.min(Math.max(i/255,0),1),g:Math.min(Math.max(s/255,0),1),b:Math.min(Math.max(o/255,0),1),a:Math.min(Math.max(r,0),1)}}function Dg(n){if(n==null)return null;const e=Number(n);return Number.isNaN(e)?null:e}function kg(n){const e=n.lastIndexOf("-"),t=n.substring(0,e),i=n.substring(e+1);return[t,i]}function Us(n){if(!n)return null;const e=n.Min??n.min,t=n.Max??n.max;if(!e||!t)return null;const i=Number(e.x??e.X),s=Number(e.y??e.Y),o=Number(e.z??e.Z),r=Number(t.x??t.X),l=Number(t.y??t.Y),a=Number(t.z??t.Z);return[i,s,o,r,l,a].some(c=>Number.isNaN(c))?null:{min:{x:i,y:s,z:o},max:{x:r,y:l,z:a}}}function Sn(n,e){if(e)return`${e}`;const t=n?.leiting?.model?.modelId??n?.modelId??n?.id;return t==null?null:`${t}`}function Pg(n,e){if(e==null)return null;const t=n?.leiting?.node;if(!t)return null;const i=`${e}`,s=t?.[i],o=Us(s?.box3??s?.box);if(o)return o;const r=t?.element?.[i]??t?.elements?.[i]??t?.nodeExtras?.element?.[i]??t?.nodeExtras?.elements?.[i];return Us(r?.box3??r?.box)}function Fg(n){const e=n?.leiting?.box;return e?Us({min:e.min,max:e.max}):null}class Rg{base;constructor(e){this.base=e}initTime(){const t=this.base.cesium.JulianDate.fromDate(new Date(2023,3,21,10,0));this.base.viewer.clock.currentTime=t,this.base.start=this.base.viewer.clock.currentTime.secondsOfDay*1e3}processAnimation(e,t,i,s=null){if(this.base.start==null)return;const o=this.base.start+(e?.delay??0),r=this.base.start+(e?.playtime??0)+(e?.delay??0);t<=o&&(e.cash=!0,e.groupData.forEach(l=>{const{batchIds:a,modelId:c,rgba:u}=l;if(Array.isArray(a)&&a[0]){a[0][1]=u;const h=i[c];h?h.push(a[0]):i[c]=[a[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(l=>{const{batchIds:a,playTimeColor:c,modelId:u}=l;if(Array.isArray(a)&&a[0]){a[0][1]=c;const h=i[u];h?h.push(a[0]):i[u]=[a[0]]}})),t>=r&&(e.finished=!0)}onTick=e=>{if(!this.base.cesium||!this.base.viewer)return;const t=e?.currentTime?.secondsOfDay?e.currentTime.secondsOfDay*1e3:this.base.viewer.clock.currentTime.secondsOfDay*1e3,i={};Array.isArray(this.base.data)&&this.base.data.forEach(o=>{this.processAnimation(o,t,i,.1)});const s=Object.entries(i);if(s.forEach(([o,r])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:r})}),Object.keys(this.base.mapAnimations).forEach(o=>{const r=this.base.mapAnimations[o];r.length&&r.every(l=>l.finished)&&!this.base.clearedModelIds.has(o)&&(this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:[]}),this.base.clearedModelIds.add(o))}),this.base.recoverStaus){s.length&&(this.base.recoverStaus=!1);return}s.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(o=>{o.groupData.forEach(r=>{const{modelId:l}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:l,batchIds:[]})}),this.base.recoverStaus=!0})};enableConstructionProgressTracking(){this.base.clearedModelIds.clear(),this.initTime(),this.base.groupBatchIds={},Array.isArray(this.base.data)&&(this.base.data.forEach(e=>{e.cash=!1,e.playCash=!1,e.groupData.forEach(t=>{const{batchIds:i,modelId:s,rgba:o}=t;if(Array.isArray(i)&&i[0]){i[0][1]=o;const r=this.base.groupBatchIds[s];r?r.push(i[0]):this.base.groupBatchIds[s]=[i[0]]}})}),Object.entries(this.base.groupBatchIds).forEach(([e,t])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t})})),this.base.viewer.clock.onTick.addEventListener(this.onTick)}disableConstructionProgressTracking(){this.base.viewer.clock.onTick.removeEventListener(this.onTick),this.base.viewer.scene.ambientLightIntensity=1,Array.isArray(this.base.data)&&this.base.data.forEach(e=>{e.cash=!0,e.playCash=!0,e.groupData.forEach(t=>{const{modelId:i}=t,s=[];this.base.setTileSyltByConstructionProcessTracking({modelId:i,batchIds:s})})}),this.base.start=null}freshConstructionProgressTracking(){const e=this.base.viewer.clock.currentTime.secondsOfDay*1e3,t={};Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.playCash=!1,this.processAnimation(s,e,t)});const i=Object.entries(t);i.forEach(([s,o])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:s,batchIds:o})}),i.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.groupData.forEach(o=>{const{modelId:r}=o;this.base.setTileSyltByConstructionProcessTracking({modelId:r,batchIds:[]})})})}reStartAnimation(){let e={};this.base.clearedModelIds.clear(),Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData.forEach(i=>{const{batchIds:s,modelId:o,rgba:r}=i;if(Array.isArray(s)&&s[0]){s[0][1]=r;const l=e[o];l?l.push(s[0]):e[o]=[s[0]]}})}),Object.entries(e).forEach(([t,i])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:t,batchIds:i})}),this.initTime()}setAllConstructionProgressTracking(e){this.base.data=e,Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData=[],t.finished=!1,t.mergeCpts.forEach(i=>{const s=[];i.cpts.forEach(a=>{s.push({dbName:i.linkModelId,modelId:i.modelId,elementId:`${a}`,show:!0,rgba:t.rgba??{r:.4,g:.4,b:.4,a:.1}})});const o=Pa.process,r=Mg.color,{allElements:l}=this.base.groupByModelId(s);this.base.mapAnimations[i.modelId]=this.base.mapAnimations[i.modelId]||[],this.base.mapAnimations[i.modelId].push(t),Object.entries(l).forEach(([a,c])=>{const[u,h]=kg(a),f=this.base.getTileSyltByConstructionProcessTracking({elementIds:c,modelId:u,color:h,colorRank:o,show:!0,selectionRank:r}),p=t?.playTimeColor?.r??1,A=t?.playTimeColor?.g??1,C=t?.playTimeColor?.b??0,m=t?.playTimeColor?.a??.1,y=this.base.setColor({r:p,g:A,b:C,a:m}),E=this.base.setColor(t.rgba??{r:.4,g:.4,b:.4,a:.1});t.groupData.push({modelId:u,batchIds:f,playTimeColor:y,rgba:E})})})})}}class Og{base;constructor(e){this.base=e}attachTileset(e,t,i){const s=this.base.cesium;this.base.handler||(this.base.handler=new s.ScreenSpaceEventHandler(this.base.viewer.scene.canvas));const o=Sn(e,i);o&&(this.base.tilesetMap[o]=e),t&&(this.base.selectedColor=t),this.bindInputs()}bindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.setInputAction(t=>{let i;try{i=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(i)&&i instanceof e.Cesium3DTileFeature){this.base.clearSelection();const s=Sn(i.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(i);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const u=e.Cartographic.fromCartesian(l),h=e.Math.toDegrees(u.longitude),f=e.Math.toDegrees(u.latitude),p=u.height;r=[h,f,p]}const c=(this.base.hasSelectedFeaturesMap[s]||[]).filter(u=>u.rank!==0);this.base.hasSelectedFeaturesMap[s]=[...c,{batchId:o,selectedColor:this.base.selectedColor,rank:0,point:r}],this.base.setBaseStyle(s),this.base.triggerSelectionChange(),i.tileset.leiting?.selectedFn&&i.tileset.leiting.selectedFn(i.tileset)}else this.base.clearSelection()},e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.setInputAction(t=>{let i;try{i=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(i)&&i instanceof e.Cesium3DTileFeature){const s=Sn(i.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(i);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const a=e.Cartographic.fromCartesian(l),c=e.Math.toDegrees(a.longitude),u=e.Math.toDegrees(a.latitude),h=a.height;r=[c,u,h]}this.base.toggleMultiSelect(s,o,this.base.selectedColor,r)}},e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{this.base.ensureSelectionDiv();const i=this.base.viewer?.scene?.screenSpaceCameraController;i&&this.base.cameraControllerState===null&&(this.base.cameraControllerState={enableRotate:i.enableRotate,enableTilt:i.enableTilt,enableLook:i.enableLook},i.enableRotate=!1,i.enableTilt=!1,i.enableLook=!1),this.base.selectStart=this.base.cesium.Cartesian2.clone(t.position),this.base.selectEnd=null,this.base.selectionDiv&&this.base.selectStart&&(this.base.selectionDiv.style.left=`${this.base.selectStart.x}px`,this.base.selectionDiv.style.top=`${this.base.selectStart.y}px`,this.base.selectionDiv.style.width="0px",this.base.selectionDiv.style.height="0px",this.base.selectionDiv.style.display="block")},e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{if(!this.base.selectStart||!this.base.selectionDiv)return;const i=performance.now();if(i-this.base.lastDrawTime<20)return;this.base.lastDrawTime=i,this.base.selectEnd=this.base.cesium.Cartesian2.clone(t.endPosition);const s=Math.min(this.base.selectStart.x,this.base.selectEnd.x),o=Math.min(this.base.selectStart.y,this.base.selectEnd.y),r=Math.abs(this.base.selectStart.x-this.base.selectEnd.x),l=Math.abs(this.base.selectStart.y-this.base.selectEnd.y);this.base.selectionDiv.style.left=`${s}px`,this.base.selectionDiv.style.top=`${o}px`,this.base.selectionDiv.style.width=`${r}px`,this.base.selectionDiv.style.height=`${l}px`,this.base.selectionDiv.style.backgroundColor="rgba(0, 255, 255, 0.5)",this.base.selectionDiv.style.position="absolute",this.base.selectionDiv.style.zIndex="2"},e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(()=>{if(!this.base.selectStart||!this.base.selectionDiv)return;if(!this.base.selectStart||!this.base.selectEnd){this.base.selectionDiv.style.display="none";const i=this.base.viewer?.scene?.screenSpaceCameraController;i&&this.base.cameraControllerState!==null&&(i.enableRotate=this.base.cameraControllerState.enableRotate,i.enableTilt=this.base.cameraControllerState.enableTilt,i.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null);return}this.base.selectionDiv.style.display="none",this.base.selectTilesInRectangle(this.base.selectStart,this.base.selectEnd,this.base.selectedColor),this.base.viewer.scene.requestRender(),this.base.selectStart=null,this.base.selectEnd=null;const t=this.base.viewer?.scene?.screenSpaceCameraController;t&&this.base.cameraControllerState!==null&&(t.enableRotate=this.base.cameraControllerState.enableRotate,t.enableTilt=this.base.cameraControllerState.enableTilt,t.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null)},e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}unbindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}}class Lg{cesium;viewer;data;handler;selectedColor="rgba(255,0,0,1.0)";tilesetMap={};hasSelectedFeaturesMap={};colorRankColor=[];showStateMap={};selectedPosition={x:null,y:null};selectionDiv=null;lastDrawTime=0;selectStart=null;selectEnd=null;cameraControllerState=null;start=null;groupBatchIds={};recoverStaus=!1;mapAnimations={};clearedModelIds=new Set;eidToBatchIdMap={};batchIdToElementIdMap={};animationModule;selectionModule;onSelectionChangeCallbacks=[];loadNodeDetailsForModel;loadNodeDetailsCallback;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new Rg(this),this.selectionModule=new Og(this)}attachTileset(e,t,i){this.selectionModule.attachTileset(e,t,i)}setLoadNodeDetailsCallback(e){this.loadNodeDetailsCallback=e}selectionChange(e){e&&typeof e=="function"&&this.onSelectionChangeCallbacks.push(e)}removeSelectionChange(e){this.onSelectionChangeCallbacks=this.onSelectionChangeCallbacks.filter(t=>t!==e)}triggerSelectionChange(){if(this.onSelectionChangeCallbacks.length>0){const e=this.getSelected({rank:0});this.onSelectionChangeCallbacks.forEach(t=>{try{t(e)}catch(i){console.error("Selection callback error:",i)}})}}enableSelection(){this.selectionModule.bindInputs()}disableSelection(){this.selectionModule.unbindInputs()}clearSelection(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==0);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender(),this.triggerSelectionChange()}clearExist(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==1);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender()}clearProcess(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==2);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender()}clearAllHaveSelected(){this.getTargetModelIds().forEach(t=>{this.hasSelectedFeaturesMap[t]&&(delete this.hasSelectedFeaturesMap[t],this.applyShowStyleOnly(t))}),this.viewer.scene.requestRender(),this.triggerSelectionChange()}getSelected(e){const t=e&&typeof e=="object"&&"rank"in e?e.rank:e,i=Fa(t),s=[];return Object.keys(this.hasSelectedFeaturesMap).forEach(o=>{(this.hasSelectedFeaturesMap[o]||[]).forEach(async l=>{if(l.rank!==i)return;const a=Tg(l.selectedColor);let c=await this.getElementId(l.batchId,o);c===null&&(c=l.batchId),s.push({elementId:c,modelId:o,rgba:a||void 0,point:l?.point||void 0})})}),s}setAllConstructionProgressTracking(e){this.animationModule.setAllConstructionProgressTracking(e)}initTime(){this.animationModule.initTime()}processAnimation(e,t,i,s=null){this.animationModule.processAnimation(e,t,i,s)}onTick=e=>{this.animationModule.onTick(e)};enableConstructionProgressTracking(){this.animationModule.enableConstructionProgressTracking()}disableConstructionProgressTracking(){this.animationModule.disableConstructionProgressTracking()}freshConstructionProgressTracking(){this.animationModule.freshConstructionProgressTracking()}reStartAnimation(){this.animationModule.reStartAnimation()}setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t}){const i=this.tilesetMap[e];if(!i)return;const s=i?.style?.show?.conditionsExpression?.conditions;Array.isArray(t)&&t.length?s?i.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s},color:{conditions:t}}):i.style=new this.cesium.Cesium3DTileStyle({color:{conditions:t}}):this.applyShowStyleOnly(e),this.viewer.scene.requestRender()}resumeFlyTo(){this.viewer.clock.shouldAnimate=!0}pauseFlyTo(){this.viewer.clock.shouldAnimate=!1}flyToObjects({selectCpts:e,options:t}){if(!Array.isArray(e)||e.length===0)return;this.clearSelection(),this.setSelectColorUserModelCpt(e,{rank:0});const i=this.cesium,s=t?.scale??1,o=[];if(e.forEach(r=>{const l=r?.modelId,a=r?.elementId;if(l==null)return;const c=this.tilesetMap[`${l}`];if(!c)return;const h=Pg(c,a)||Fg(c);if(!h)return;const f=new i.Cartesian3(h.min.x,h.min.y,h.min.z),p=new i.Cartesian3(h.max.x,h.max.y,h.max.z),A=c?.root?.computedTransform??c?.modelMatrix;if(A){const C=i.Matrix4.multiplyByPoint(A,f,new i.Cartesian3),m=i.Matrix4.multiplyByPoint(A,p,new i.Cartesian3);o.push(C,m)}else o.push(f,p)}),o.length){const r=i.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const l=this.viewer.scene.camera,a=new i.HeadingPitchRange(l.heading,l.pitch,0);l.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:a})}else{const r=e[0]?.modelId,l=r?this.tilesetMap[`${r}`]:null;l&&this.viewer.flyTo(l,{duration:t?.duration??0,complete:t?.complete})}}setBaseStyle(e){this.getTargetModelIds(e).forEach(i=>{this.setColorStyle(i)})}setColorStyle(e){this.updateTilesetStyle(e)}buildColorConditions(e){const t=this.tilesetMap[e],i=this.hasSelectedFeaturesMap[e];if(!t||!i?.length)return;const s=new Map;i.forEach(a=>{const c=s.get(a.batchId);(!c||a.rank>=c.rank)&&s.set(a.batchId,a)});const o=new Map;if(s.forEach(({batchId:a,selectedColor:c})=>{o.has(c)||o.set(c,new Set),o.get(c)?.add(a)}),this.colorRankColor.length){const a=new Set;this.colorRankColor.forEach(c=>{const u=o.get(c);u&&u.forEach(h=>a.add(h))}),o.forEach((c,u)=>{if(this.colorRankColor.includes(u))return;const h=new Set;c.forEach(f=>{a.has(f)||h.add(f)}),o.set(u,h)})}const r=[...this.colorRankColor.filter(a=>o.has(a)),...Array.from(o.keys()).filter(a=>!this.colorRankColor.includes(a))],l=[];return r.forEach(a=>{const c=o.get(a);if(!c||!c.size)return;const u=Array.from(c).join("|");u&&l.push([`(regExp('^(${u})$').test(\${id}))`,a])}),l.length?l:void 0}updateTilesetStyle(e){const t=this.tilesetMap[e];if(!t)return;const i=this.showStateMap[e],s=i?this.buildShowConditions(i.batchIds,i.mode):void 0,o=this.buildColorConditions(e);s||o?t.style=new this.cesium.Cesium3DTileStyle({show:s?{conditions:s}:void 0,color:o?{conditions:o}:void 0}):t.style=void 0,this.viewer.scene.requestRender()}setShowStyle(e){this.getTargetModelIds(e?.modelId).forEach(i=>{const s=this.showStateMap[i]||{batchIds:[],mode:"include"};this.showStateMap[i]={batchIds:e?.batchIds??s.batchIds,mode:e?.mode??s.mode},this.updateTilesetStyle(i)})}setColor(e){if(!e)return this.selectedColor;if(typeof e=="string")return e;const t=en(Number(e.r)),i=en(Number(e.g)),s=en(Number(e.b)),o=Ra(e.a===void 0?1:Number(e.a));return Ns({r:t,g:i,b:s,a:o})||this.selectedColor}groupByModelId(e){const t={};return e.forEach(i=>{const s=i?.modelId,o=i?.elementId;if(s==null||o===void 0||o===null)return;const r=i?.color??i?.rgba,l=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),a=`${s}-${l}`;t[a]||(t[a]=[]),t[a].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchId(e,t){const i=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[i]){const a=this.eidToBatchIdMap[i].get(s);if(a!==void 0)return a}const r=this.tilesetMap[i]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const a=new Map;r.forEach(u=>{a.set(`${u.elementID}`,`${u.batchId}`)}),this.eidToBatchIdMap[i]=a;const c=a.get(s);if(c!==void 0)return c}const l=Dg(e);return l!=null?String(l):null}loadingModels=new Set;async getElementId(e,t){if(this.batchIdToElementIdMap[t]){const o=this.batchIdToElementIdMap[t].get(e);if(o!==void 0)return o}const i=this.tilesetMap[t];i.leiting?.node?.batchIdEIDInfos||await this.loadNodeDetailsForModel(t);const s=i?.leiting?.node?.batchIdEIDInfos;if(s&&Array.isArray(s)){const o=new Map;s.forEach(l=>{l&&l.elementID&&o.set(`${l.batchId}`,`${l.elementID}`)}),this.batchIdToElementIdMap[t]=o;const r=o.get(e);if(r!==void 0)return r}return i&&i.leiting&&!i.leiting.node&&i.leiting.model?.nodeUrl&&(this.loadingModels.has(t)||(this.loadingModels.add(t),this.loadNodeDetailsCallback&&this.loadNodeDetailsCallback(t).then(()=>{this.loadingModels.delete(t),this.triggerSelectionChange()}).catch(()=>{this.loadingModels.delete(t)}))),null}setComponentVisibility(e){if(!Array.isArray(e))return;const t=new Set;e.forEach(i=>{const s=`${i.modelId}`,o=this.getBatchId(i.elementId,s);if(o===null)return;t.add(s);const r=this.showStateMap[s]||{batchIds:[],mode:"exclude"},l=new Set(r.batchIds);r.mode==="exclude"?i.show?l.delete(o):l.add(o):i.show?l.add(o):l.delete(o),r.batchIds=Array.from(l),this.showStateMap[s]=r}),t.forEach(i=>this.updateTilesetStyle(i))}setAllComponentsVisibility(e){this.getTargetModelIds().forEach(i=>{e?this.setShowStyle({modelId:i,batchIds:[],mode:"exclude"}):this.setShowStyle({modelId:i,batchIds:[],mode:"include"})})}getComponentsByVisibility(e){const t=[];return Object.keys(this.showStateMap).forEach(i=>{const s=this.showStateMap[i],o=this.tilesetMap[i];if(!o?.leiting?.node?.batchIdEIDInfos)return;const r=o.leiting.node.batchIdEIDInfos,l=new Set(s?.batchIds??[]);r.forEach(a=>{const c=l.has(`${a.batchId}`);(s?.mode==="include"?c:!c)===e&&t.push({elementId:`${a.elementID}`,modelId:i})})}),t}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:i,colorRank:s,show:o,selectionRank:r}){const l=this.tilesetMap[t];if(!Array.isArray(e))return[];const a=l.leiting.node,c=new Set(e),u=a.batchIdEIDInfos.filter(f=>c.has(`${f.elementID}`)).map(f=>String(f.batchId));return u.length?(s===Pa.normal&&!this.colorRankColor.includes(i)&&(this.colorRankColor=[i]),[[`(regExp('^(${u.join("|")})$').test(\${id}))`,i]]):[]}setSelectColorUserModelCpt(e,t){if(!Array.isArray(e))return;const i=new Map,s=t?.rank===void 0?"exist":t?.rank,o=Fa(s);e.forEach(r=>{const l=r?.modelId;if(l==null)return;const a=`${l}`,c=Array.isArray(r?.elementIds)?r.elementIds:r?.elementId?[r.elementId]:[];if(!c.length)return;const u=Ns(r?.rgba)||this.selectedColor;c.forEach(h=>{const f=this.getBatchId(h,a);f!==null&&(i.has(a)||i.set(a,[]),i.get(a)?.push({batchId:f,selectedColor:u,rank:o}))})}),i.forEach((r,l)=>{const a=this.mergeSelections(l,r);this.hasSelectedFeaturesMap[l]=a,this.setBaseStyle(l)}),this.triggerSelectionChange()}setAllSelectColorUserModelCpt({modelId:e,rgba:t}){if(!e)return;const i=String(e),s=this.tilesetMap[i];if(!s)return;const o=s?.leiting?.node?.batchIdEIDInfos;if(!o||!Array.isArray(o))return;const r=[];o.forEach(l=>{l&&l.elementID!==void 0&&r.push(l.elementID)}),r.length!==0&&this.setSelectColorUserModelCpt([{modelId:i,elementIds:r,rgba:t}],{rank:0})}getFeatureId(e){if(this.cesium.defined(e)&&this.cesium.defined(e.getProperty)){const t=e.getProperty("id");return t!=null?String(t):"-1"}return"-1"}getTargetModelIds(e){return e?[e]:Object.keys(this.tilesetMap)}buildShowConditions(e,t){const i=e.join("|");return i?t==="include"?[[`(regExp('^(${i})$').test(\${id}))`,"true"],["true","false"]]:[[`(regExp('^(${i})$').test(\${id}))`,"false"],["true","true"]]:t==="include"?[["true","false"]]:void 0}applyShowStyleOnly(e){const t=this.tilesetMap[e];if(!t)return;const i=this.showStateMap[e],s=i?this.buildShowConditions(i.batchIds,i.mode):void 0;s?t.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s}}):t.style=void 0}setSelectedColorRgba(e,t,i,s=1){const o=en(e),r=en(t),l=en(i),a=Ra(s),c=Ns({r:o,g:r,b:l,a});c&&(this.selectedColor=c)}mergeSelections(e,t){const i=new Map;return(this.hasSelectedFeaturesMap[e]||[]).forEach(o=>i.set(o.batchId,o)),t.forEach(o=>{const r=i.get(o.batchId);(!r||o.rank>r.rank||o.rank===r.rank)&&i.set(o.batchId,o)}),Array.from(i.values())}toggleMultiSelect(e,t,i,s){const o=this.hasSelectedFeaturesMap[e]||[],r=o.filter(h=>h.rank!==0),l=o.filter(h=>h.rank===0),c=l.some(h=>h.batchId===t)?l.filter(h=>h.batchId!==t):[...l,{batchId:t,selectedColor:i,rank:0,point:s}],u=[...r,...c];u.length?(this.hasSelectedFeaturesMap[e]=u,this.setBaseStyle(e)):(delete this.hasSelectedFeaturesMap[e],this.applyShowStyleOnly(e)),this.triggerSelectionChange()}ensureSelectionDiv(){if(this.selectionDiv)return;const e=document.createElement("div");e.style.display="none",e.style.pointerEvents="none",e.style.border="1px solid rgba(0, 255, 255, 0.8)",this.viewer.container.appendChild(e),this.selectionDiv=e}isRepeatedClick(e){const t=e?.position;return!t||typeof t.x!="number"||typeof t.y!="number"?!1:this.selectedPosition.x===t.x&&this.selectedPosition.y===t.y?!0:(this.selectedPosition.x=t.x,this.selectedPosition.y=t.y,!1)}selectTilesInRectangle(e,t,i){const s=Math.min(e.x,t.x),o=Math.max(e.x,t.x),r=Math.min(e.y,t.y),l=Math.max(e.y,t.y),a=o-s,c=l-r;if(Math.abs(a)<15||Math.abs(c)<15)return;const u=s+a/2,h=r+c/2,f=new this.cesium.Cartesian2(u,h),p=this.viewer.scene.drillPick(f,void 0,a,c);if(!Array.isArray(p))return;const A=new Map;p.forEach(C=>{if(!(C instanceof this.cesium.Cesium3DTileFeature))return;const m=Sn(C.tileset);if(!m||!this.tilesetMap[m])return;const y=this.getFeatureId(C);y!=="-1"&&(A.has(m)||A.set(m,new Set),A.get(m)?.add(y))}),A.forEach((C,m)=>{const y=this.hasSelectedFeaturesMap[m]||[],E=y.filter(S=>S.rank!==0),x=new Set(y.filter(S=>S.rank===0).map(S=>S.batchId)),M=[];C.forEach(S=>{x.has(S)||M.push({batchId:S,selectedColor:i,rank:0})});const T=y.filter(S=>S.rank===0);this.hasSelectedFeaturesMap[m]=[...E,...T,...M],this.setBaseStyle(m)}),this.triggerSelectionChange()}}class Ng{cesium;viewer;tilesetMap={};planeEntities=[];clippingPlanesMap={};activeModelIds=new Set;boxMatrix=null;boxInverseMatrix=null;boxCenter=null;boxOrientation=null;targetZPlus=0;targetZMinus=0;targetXPlus=0;targetXMinus=0;targetYPlus=0;targetYMinus=0;currentPlaneType="";selectedPlane=null;hoveredPlane=null;dragStartPoint=null;moveCallBack=null;downHandler=null;upHandler=null;moveHandler=null;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}attachTileset(e,t){this.tilesetMap[t]=e}open(e,t){!this.tilesetMap[e]||this.activeModelIds.has(e)||(this.activeModelIds.add(e),this.moveCallBack=t?.moveCallBack,this.fitToModels(),this.activeModelIds.size===1&&(this.createPlaneEntities(),this.initEventHandlers()))}setupClippingPlanes(e){const t=this.cesium,i=this.tilesetMap[e];if(!i||!this.boxMatrix)return;const s=new t.ClippingPlaneCollection({planes:[new t.ClippingPlane(new t.Cartesian3(1,0,0),this.targetXMinus),new t.ClippingPlane(new t.Cartesian3(-1,0,0),this.targetXPlus),new t.ClippingPlane(new t.Cartesian3(0,1,0),this.targetYMinus),new t.ClippingPlane(new t.Cartesian3(0,-1,0),this.targetYPlus),new t.ClippingPlane(new t.Cartesian3(0,0,1),this.targetZMinus),new t.ClippingPlane(new t.Cartesian3(0,0,-1),this.targetZPlus)],edgeWidth:2,edgeColor:t.Color.WHITE,enabled:!0,unionClippingRegions:!0}),o=t.Matrix4.inverse(i.root.transform,new t.Matrix4);s.modelMatrix=t.Matrix4.multiply(o,this.boxMatrix,new t.Matrix4),i.clippingPlanes=s,this.clippingPlanesMap[e]=s}createPlaneEntities(){const e=this.cesium,t=this.viewer;this.planeEntities.forEach(s=>t.entities.remove(s)),this.planeEntities=[];const i=["left","right","behind","front","top","down"];for(const s of i){const o=t.entities.add({name:s,position:new e.CallbackProperty(()=>{if(!this.boxMatrix)return e.Cartesian3.ZERO;const r=this.getPlaneOffsetCartesian(s);return e.Matrix4.multiplyByPoint(this.boxMatrix,r,new e.Cartesian3)},!1),orientation:new e.CallbackProperty(()=>this.boxOrientation||e.Quaternion.IDENTITY,!1),plane:{dimensions:new e.CallbackProperty(()=>{if(this.activeModelIds.size===0)return new e.Cartesian2(0,0);const r=.1,l=Math.max(r,this.targetXMinus+this.targetXPlus),a=Math.max(r,this.targetYPlus+this.targetYMinus),c=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(l,a):s==="left"||s==="right"?new e.Cartesian2(a,c):new e.Cartesian2(l,c)},!1),material:e.Color.WHITE.withAlpha(.1),outline:!0,outlineColor:e.Color.YELLOW,plane:new e.CallbackProperty(()=>new e.Plane(this.getNormalByType(s),0),!1)}});this.planeEntities.push(o)}}getPlaneOffsetCartesian(e){const t=(this.targetXPlus-this.targetXMinus)/2,i=(this.targetYPlus-this.targetYMinus)/2,s=(this.targetZPlus-this.targetZMinus)/2;switch(e){case"left":return new this.cesium.Cartesian3(-this.targetXMinus,i,s);case"right":return new this.cesium.Cartesian3(this.targetXPlus,i,s);case"behind":return new this.cesium.Cartesian3(t,-this.targetYMinus,s);case"front":return new this.cesium.Cartesian3(t,this.targetYPlus,s);case"top":return new this.cesium.Cartesian3(t,i,this.targetZPlus);case"down":return new this.cesium.Cartesian3(t,i,-this.targetZMinus);default:return this.cesium.Cartesian3.ZERO}}getNormalByType(e){const t=this.cesium;switch(e){case"left":return new t.Cartesian3(1,0,0);case"right":return new t.Cartesian3(-1,0,0);case"behind":return new t.Cartesian3(0,1,0);case"front":return new t.Cartesian3(0,-1,0);case"top":return new t.Cartesian3(0,0,-1);case"down":return new t.Cartesian3(0,0,1);default:return t.Cartesian3.UNIT_X}}getPlaneByType(e){const t=this.cesium,i=this.getNormalByType(e),s=t.Cartesian3.negate(i,new t.Cartesian3);let o=0;switch(e){case"left":o=this.targetXMinus;break;case"right":o=this.targetXPlus;break;case"behind":o=this.targetYMinus;break;case"front":o=this.targetYPlus;break;case"top":o=this.targetZPlus;break;case"down":o=this.targetZMinus;break}return new t.Plane(s,-o)}initEventHandlers(){const e=this.cesium,t=this.viewer.scene.canvas,i=this.viewer.scene;this.downHandler=new e.ScreenSpaceEventHandler(t),this.upHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler.setInputAction(s=>{if(this.selectedPlane)return;let o;try{o=i.pick(s.endPosition)}catch{}e.defined(o)&&o.id&&o.id.plane?this.hoveredPlane!==o.id.plane&&(this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1)),this.hoveredPlane=o.id.plane,this.hoveredPlane.material=e.Color.YELLOW.withAlpha(.3),t.style.cursor="pointer"):this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1),this.hoveredPlane=null,t.style.cursor="default")},e.ScreenSpaceEventType.MOUSE_MOVE),this.downHandler.setInputAction(s=>{let o;try{o=i.pick(s.position)}catch{}if(e.defined(o)&&o.id&&o.id.plane){this.currentPlaneType=o.id.name,this.selectedPlane=o.id.plane,this.selectedPlane.material=e.Color.RED.withAlpha(.4),i.screenSpaceCameraController.enableInputs=!1;const r=i.camera.getPickRay(s.position),l=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(l,r.origin,new e.Cartesian3),c=e.Matrix4.multiplyByPointAsVector(l,r.direction,new e.Cartesian3);e.Cartesian3.normalize(c,c);const u=new e.Ray(a,c),h=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(u,h,new e.Cartesian3),this.dragStartPoint||(this.dragStartPoint=this.getPlaneOffsetCartesian(this.currentPlaneType))}},e.ScreenSpaceEventType.LEFT_DOWN),this.moveHandler.setInputAction(s=>{if(!this.selectedPlane||!this.dragStartPoint)return;const o=i.camera.getPickRay(s.endPosition),r=this.boxInverseMatrix,l=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),a=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(a,a);const c=new e.Ray(l,a);let u=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?u=Math.abs(a.x)>Math.abs(a.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?u=Math.abs(a.y)>Math.abs(a.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:u=Math.abs(a.x)>Math.abs(a.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const h=-e.Cartesian3.dot(this.dragStartPoint,u),f=new e.Plane(u,h);let p=e.IntersectionTests.rayPlane(c,f,new e.Cartesian3);if(!p){const C=u===e.Cartesian3.UNIT_X?e.Cartesian3.UNIT_Y:u===e.Cartesian3.UNIT_Y&&(this.currentPlaneType==="top"||this.currentPlaneType==="down")?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z,m=-e.Cartesian3.dot(this.dragStartPoint,C);p=e.IntersectionTests.rayPlane(c,new e.Plane(C,m),new e.Cartesian3)}if(!p)return;const A=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+A,-p.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+A,p.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+A,-p.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+A,p.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+A,p.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+A,-p.z);break}this.syncClippingPlanes(),this.moveCallBack&&this.moveCallBack(this.getRangeParams())},e.ScreenSpaceEventType.MOUSE_MOVE),this.upHandler.setInputAction(()=>{this.selectedPlane&&(this.selectedPlane.material=e.Color.WHITE.withAlpha(.1),this.selectedPlane=null,this.currentPlaneType="",this.dragStartPoint=null),i.screenSpaceCameraController.enableInputs=!0,t.style.cursor="default"},e.ScreenSpaceEventType.LEFT_UP)}syncClippingPlanes(){this.activeModelIds.size!==0&&Object.keys(this.clippingPlanesMap).forEach(e=>{const t=this.clippingPlanesMap[e],i=this.tilesetMap[e];if(t&&i&&!t.isDestroyed()){const s=this.cesium;t.get(0).distance=this.targetXMinus,t.get(1).distance=this.targetXPlus,t.get(2).distance=this.targetYMinus,t.get(3).distance=this.targetYPlus,t.get(4).distance=this.targetZMinus,t.get(5).distance=this.targetZPlus;const o=s.Matrix4.inverse(i.root.transform,new s.Matrix4);t.modelMatrix=s.Matrix4.multiply(o,this.boxMatrix,new s.Matrix4)}})}fitToModels(){const e=this.cesium;if(this.activeModelIds.size===0)return;let t=[];if(this.activeModelIds.forEach(h=>{const f=this.tilesetMap[h];f&&f.boundingSphere&&t.push(f.boundingSphere.center)}),t.length===0)return;const i=new e.Cartesian3;t.forEach(h=>e.Cartesian3.add(i,h,i)),this.boxCenter=e.Cartesian3.divideByScalar(i,t.length,new e.Cartesian3),this.boxMatrix=e.Transforms.eastNorthUpToFixedFrame(this.boxCenter),this.boxInverseMatrix=e.Matrix4.inverse(this.boxMatrix,new e.Matrix4),this.boxOrientation=e.Quaternion.fromRotationMatrix(e.Matrix4.getMatrix3(this.boxMatrix,new e.Matrix3));let s=1/0,o=-1/0,r=1/0,l=-1/0,a=1/0,c=-1/0;this.activeModelIds.forEach(h=>{const f=this.tilesetMap[h];if(!f)return;const p=[],A=f.leiting?.box,C=f.root?.boundingVolume?.boundingVolume;if(A&&A.min&&A.max){const{min:m,max:y}=A,E=[new e.Cartesian3(m.x,m.y,m.z),new e.Cartesian3(y.x,m.y,m.z),new e.Cartesian3(m.x,y.y,m.z),new e.Cartesian3(y.x,y.y,m.z),new e.Cartesian3(m.x,m.y,y.z),new e.Cartesian3(y.x,m.y,y.z),new e.Cartesian3(m.x,y.y,y.z),new e.Cartesian3(y.x,y.y,y.z)],x=f.root.transform;E.forEach(M=>{p.push(e.Matrix4.multiplyByPoint(x,M,new e.Cartesian3))})}else if(C&&C.halfAxes){const m=C.center,y=C.halfAxes,E=e.Matrix3.getColumn(y,0,new e.Cartesian3),x=e.Matrix3.getColumn(y,1,new e.Cartesian3),M=e.Matrix3.getColumn(y,2,new e.Cartesian3);for(let T=0;T<8;T++){const S=e.Cartesian3.clone(m,new e.Cartesian3);e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(E,T&1?1:-1,new e.Cartesian3),S),e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(x,T&2?1:-1,new e.Cartesian3),S),e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(M,T&4?1:-1,new e.Cartesian3),S),p.push(S)}}else if(f.boundingSphere){const m=f.boundingSphere,y=m.center,E=m.radius,x=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,y,new e.Cartesian3);s=Math.min(s,x.x-E),o=Math.max(o,x.x+E),r=Math.min(r,x.y-E),l=Math.max(l,x.y+E),a=Math.min(a,x.z-E),c=Math.max(c,x.z+E)}p.forEach(m=>{const y=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,m,new e.Cartesian3);s=Math.min(s,y.x),o=Math.max(o,y.x),r=Math.min(r,y.y),l=Math.max(l,y.y),a=Math.min(a,y.z),c=Math.max(c,y.z)})});const u=1.01;this.targetXMinus=Math.abs(s)*u,this.targetXPlus=Math.abs(o)*u,this.targetYMinus=Math.abs(r)*u,this.targetYPlus=Math.abs(l)*u,this.targetZMinus=Math.abs(a)*u,this.targetZPlus=Math.abs(c)*u,this.activeModelIds.forEach(h=>{this.setupClippingPlanes(h)}),this.viewer.scene.requestRender()}getRangeParams(){const e=this.cesium;return{targetZPlus:this.targetZPlus,targetZMinus:this.targetZMinus,targetXPlus:this.targetXPlus,targetXMinus:this.targetXMinus,targetYPlus:this.targetYPlus,targetYMinus:this.targetYMinus,maxBox:new e.Cartesian3(this.targetXPlus,this.targetYPlus,this.targetZPlus),minBox:new e.Cartesian3(-this.targetXMinus,-this.targetYMinus,-this.targetZMinus)}}updateRange(e){if(!this.boxMatrix)return;e.targetXMinus!==void 0&&(this.targetXMinus=e.targetXMinus),e.targetXPlus!==void 0&&(this.targetXPlus=e.targetXPlus),e.targetYMinus!==void 0&&(this.targetYMinus=e.targetYMinus),e.targetYPlus!==void 0&&(this.targetYPlus=e.targetYPlus),e.targetZPlus!==void 0&&(this.targetZPlus=e.targetZPlus),e.targetZMinus!==void 0&&(this.targetZMinus=e.targetZMinus);const t=.1;this.targetXMinus+this.targetXPlus<t&&(this.targetXPlus=t-this.targetXMinus),this.targetYPlus+this.targetYMinus<t&&(this.targetYPlus=t-this.targetYMinus),this.targetZPlus+this.targetZMinus<t&&(this.targetZPlus=t-this.targetZMinus),this.syncClippingPlanes(),this.viewer.scene.requestRender()}getRange(){return this.getRangeParams()}setBoxVisibility(e){this.planeEntities.forEach(t=>{t.show=e}),this.viewer.scene.requestRender()}close(e){if(e){const t=this.tilesetMap[e];t&&(t.clippingPlanes&&(t.clippingPlanes.enabled=!1),t.clippingPlanes=void 0),delete this.clippingPlanesMap[e],this.activeModelIds.delete(e),this.activeModelIds.size>0&&this.fitToModels()}else Object.keys(this.clippingPlanesMap).forEach(t=>{const i=this.tilesetMap[t];i&&(i.clippingPlanes&&(i.clippingPlanes.enabled=!1),i.clippingPlanes=void 0)}),this.clippingPlanesMap={},this.activeModelIds.clear();this.activeModelIds.size===0&&(this.planeEntities.forEach(t=>{this.viewer.entities.remove(t)}),this.planeEntities=[],this.destroyEventHandlers(),this.boxMatrix=null,this.boxInverseMatrix=null),this.viewer.scene.requestRender()}destroyEventHandlers(){this.downHandler?.destroy(),this.upHandler?.destroy(),this.moveHandler?.destroy(),this.downHandler=this.upHandler=this.moveHandler=null}}let _s=performance.now();const Ug=10;class _g{cesium;viewer;modelInfo={modelName:"Person",modelId:"player_111",url:"person/model.glb",scale:.0032};startTime=0;radian=0;speed=.1;speedVector;position;hpRoll;cameralHpRoll;fixedFrameTransforms;model;transparentTest=!0;gravityTestByMove=!1;gravityTest=!0;lastMoveTime=0;moveInterval=.01;collisionTest=!0;wheelCount=2;isLeftDragging=!1;lastScreenY=0;lastScreenX=0;pauseAnimationFn;resumeAnimationFn;selectedColor;selectedColorRecover;handler;moveState={moveFront:!1,moveBack:!1,moveLeft:!1,moveRight:!1,moveUp:!1,moveDown:!1};onLoading=null;onSuccess=null;onError=null;constructor({cesium:e,viewer:t,modelInfo:i,callbacks:s}){this.cesium=e,this.viewer=t,this.radian=this.cesium.Math.toRadians(4),this.speedVector=new this.cesium.Cartesian3,this.position=new this.cesium.Cartesian3,this.hpRoll=new this.cesium.HeadingPitchRoll,this.cameralHpRoll=new this.cesium.HeadingPitchRoll,this.fixedFrameTransforms=new this.cesium.Transforms.localFrameToFixedFrameGenerator("north","west"),i&&(this.modelInfo=Object.assign(this.modelInfo,i)),s&&(this.onLoading=s.onLoading||null,this.onSuccess=s.onSuccess||null,this.onError=s.onError||null),this.selectedColor=new this.cesium.Color(1,1,1,.4),this.selectedColorRecover=new this.cesium.Color(1,1,1,1);const o=this.viewer.scene.canvas;this.handler=new this.cesium.ScreenSpaceEventHandler(o)}getModel(){return this.model}setPauseAnimation(e){this.pauseAnimationFn=e}setResumeAnimationFn(e){this.resumeAnimationFn=e}async setPersonPosition(e){e&&(this.position=e),this.getModel()?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(e,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.model.show=!0,this.initKeyBoard()):await this.openPlayer(),this.setCameralDefault(!1)}setModelInfo(e){e&&(this.modelInfo=Object.assign(this.modelInfo,e))}async openPlayer(){if(this.enablePositionSelection(),this.model){this.model.show=!0,this.initKeyBoard(),this.setCameralDefault(!1);return}this.position&&!(this.position.x===0&&this.position.y===0&&this.position.z===0)?(await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)):this.onLoading&&this.onLoading("请按住 Ctrl + 左键点击场景选择初始位置...")}enablePositionSelection(){this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null);const e=new this.cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);e.setInputAction(async t=>{const i=this.viewer.scene;let s;try{s=i.pickPosition(t.position)}catch(o){console.warn("pickPosition failed:",o)}s&&(this.position=s,this.model?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.updatedCamera(),this.onSuccess&&this.onSuccess("已更新漫游位置")):(this.onSuccess&&this.onSuccess("位置已选择,正在加载模型..."),await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)))},this.cesium.ScreenSpaceEventType.LEFT_CLICK,this.cesium.KeyboardEventModifier.CTRL),this._positionHandler=e}_positionHandler;setDefaultPosition(){const e=this.viewer.scene,t=this.viewer.camera,i=new this.cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2);let s;try{s=e.pickPosition(i)}catch(o){console.warn("pickPosition failed:",o)}if(s)this.position=s;else{const o=t.direction,l=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=l}}async loadModel(){let e;try{this.onLoading&&this.onLoading("正在加载漫游人物...");const t=await this.cesium.Model.fromGltfAsync({id:this.modelInfo.modelId,url:this.modelInfo.url,modelMatrix:this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),scale:this.modelInfo.scale,allowPicking:!1,debugShowBoundingVolume:!1,debugWireframe:!1,cull:!1,gltfCallback:s=>{e=s.animations},backFaceCulling:!1}),i=()=>{if(e&&e.length>0){console.log("Model has animations:",e.length);try{t.activeAnimations.add({index:0,loop:this.cesium.ModelAnimationLoop.REPEAT,multiplier:1})}catch(s){console.error("Failed to add animation:",s)}this.pauseAnimationFn=()=>{this.viewer.clock.shouldAnimate=!1},this.resumeAnimationFn=()=>{this.viewer.clock.shouldAnimate=!0},this.viewer.clock.shouldAnimate=!1}else console.warn("No animations found in the model.")};t.ready?i():t.readyEvent.addEventListener(i),this.model=await this.viewer.scene.primitives.add(t),this.updatedCamera(),this.onLoading&&this.onLoading(""),this.onSuccess&&this.onSuccess("漫游模型加载完成")}catch(t){console.error("Failed to load model:",t),this.onLoading&&this.onLoading(""),this.onError&&this.onError("漫游模型加载失败")}}initKeyBoard(){const e=this.handler,t=this.cesium;_s=performance.now();const i=(o,r)=>{const l=o.code,a=o.keyCode;l==="KeyA"||a===65?this.moveState.moveLeft=r:l==="KeyW"||a===87?this.moveState.moveFront=r:l==="KeyD"||a===68?this.moveState.moveRight=r:l==="KeyS"||a===83?this.moveState.moveBack=r:l==="KeyQ"||a===81?this.moveState.moveUp=r:(l==="KeyE"||a===69)&&(this.moveState.moveDown=r)};e.setInputAction(o=>{this.wheelCount-=o*.001,this.wheelCount<.1&&(this.wheelCount=.1),this.updatedCamera()},t.ScreenSpaceEventType.WHEEL),this._keydownHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(i(o,!0),this.resumeAnimationFn&&this.resumeAnimationFn())},this._keyupHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(i(o,!1),Object.keys(this.moveState).every(r=>this.moveState[r]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())},document.addEventListener("keydown",this._keydownHandler),document.addEventListener("keyup",this._keyupHandler),e.setInputAction(o=>{this.isLeftDragging=!0,this.lastScreenY=o.position.y,this.lastScreenX=o.position.x},this.cesium.ScreenSpaceEventType.LEFT_DOWN),e.setInputAction(o=>{if(!this.isLeftDragging)return;const r=o.endPosition.x,l=o.endPosition.y,a=l-this.lastScreenY,c=r-this.lastScreenX;Math.abs(a)<Math.abs(c)&&(c>0?(this.cameralHpRoll.heading+=this.radian,this.hpRoll.heading+=this.radian):(this.cameralHpRoll.heading-=this.radian,this.hpRoll.heading-=this.radian),s(0),this.lastScreenX=r),this.lastScreenY=l;const u=this.viewer.camera;this.cameralHpRoll.pitch=u.pitch+this.cesium.Math.toRadians(-a*.1),this.updatedCamera()},t.ScreenSpaceEventType.MOUSE_MOVE),e.setInputAction(()=>{this.isLeftDragging&&(this.isLeftDragging=!1)},t.ScreenSpaceEventType.LEFT_UP);const s=o=>{const r=performance.now();if(r-_s<Ug)return;_s=r;const l=1.75;if(o===1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,-this.speed,this.speedVector),this.gravityTestByMove=!0):o===0?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,0,this.speedVector),this.gravityTestByMove=!1):o===2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,.05,this.speedVector),this.gravityTestByMove=!1):o===-2&&(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,-.05,this.speedVector),this.gravityTestByMove=!1),!this.viewer||!this.model)return;const a=(u,h)=>new this.cesium.Ray(u,h),c=new this.cesium.Cartesian3;if(this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,c),this.cesium.Cartesian3.normalize(c,c),Math.abs(o)!=2&&this.collisionTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,l),u),f=a(h,c),p=this.viewer.scene.pickFromRay(f,[this.model],1);if(p&&p.position&&this.cesium.Cartesian3.distance(h,p.position)<.9&&o===1)return}if(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,this.speedVector,this.position),this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.gravityTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=.5,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,h),u),p=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,f,p),this.cesium.Cartesian3.normalize(p,p);const A=a(f,p),C=this.viewer.scene.pickFromRay(A,[this.model],1),m=l,y=this.cesium.Cartesian3.add(f,this.cesium.Cartesian3.multiplyByScalar(c,m,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(C)){const E=t.Cartesian3.distance(f,C.position);E-h>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),E-h<-.1&&E<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!C&&this.gravityTestByMove){const E=a(this.position,p),x=this.viewer.scene.pickFromRay(E,[this.model],1);if(x){const M=this.cesium.Cartesian3.distance(this.position,x.position);Math.abs(M-1)>.05&&M<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(C&&this.gravityTestByMove&&this.gravityTest){const E=this.cesium.Cartesian3.distance(y,C.position);Math.abs(E-l)>.1&&(this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,(l-E)/Math.abs(l-E)*.05),this.position))}}if(this.transparentTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=1.75,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,h),u),p=this.viewer.camera.positionWC,A=f,C=t.Cartesian3.subtract(A,p,new t.Cartesian3),m=t.Cartesian3.distance(f,p),y=t.Cartesian3.normalize(C,new t.Cartesian3),E=new t.Ray(p,y);let x;try{x=this.viewer.scene.pickFromRay(E,void 0,1)}catch{}t.defined(x)&&x.primitive!==this.model&&x.position&&t.Cartesian3.distance(p,x.position)<m&&(this.wheelCount-=.1,this.wheelCount<.1&&(this.wheelCount=.1))}this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.updatedCamera()};this._tickHandler=()=>{const o=performance.now()/1e3;(o-this.lastMoveTime>=this.moveInterval||this.lastMoveTime==0)&&(this.moveState.moveFront?(this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian),s(1)):this.moveState.moveBack?(this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian),s(-1)):(this.moveState.moveUp&&s(2),this.moveState.moveDown&&s(-2),this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian,s(0)),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian,s(0))),this.lastMoveTime=o)},this.viewer.clock.onTick.addEventListener(this._tickHandler)}updatedCamera(){if(!this.model)return;const e=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),t=1.75,i=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,t),e);this.viewer.camera.viewBoundingSphere(new this.cesium.BoundingSphere(i,this.wheelCount),this.cameralHpRoll)}_keydownHandler;_keyupHandler;_tickHandler;_uiEventListeners=[];bindUiKeys(e){this.unbindUiKeys(),Object.entries(e).forEach(([t,i])=>{if(!i)return;const s=()=>this.setMoveState(t,!0),o=()=>this.setMoveState(t,!1);i.addEventListener("mousedown",s),i.addEventListener("mouseup",o),i.addEventListener("mouseleave",o),i.addEventListener("touchstart",r=>{r.preventDefault(),s()}),i.addEventListener("touchend",r=>{r.preventDefault(),o()}),this._uiEventListeners.push(()=>{i.removeEventListener("mousedown",s),i.removeEventListener("mouseup",o),i.removeEventListener("mouseleave",o),i.removeEventListener("touchstart",s),i.removeEventListener("touchend",o)})})}unbindUiKeys(){this._uiEventListeners.forEach(e=>e()),this._uiEventListeners=[]}closePlayer(){const e=this.cesium;this.model&&(this.model.show=!1),this.setCameralDefault(!0),this.handler&&(this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN),this.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP),this.handler.removeInputAction(e.ScreenSpaceEventType.WHEEL)),this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null),this._keydownHandler&&document.removeEventListener("keydown",this._keydownHandler),this._keyupHandler&&document.removeEventListener("keyup",this._keyupHandler),this._tickHandler&&this.viewer.clock.onTick.removeEventListener(this._tickHandler),this.unbindUiKeys(),this.viewer.camera.lookAtTransform(e.Matrix4.IDENTITY),this.onLoading&&this.onLoading("")}setSpeed({speed:e}){this.speed=e}setParams({gravityTest:e,collisionTest:t,transparentTest:i}){e!==void 0&&(this.gravityTest=e),t!==void 0&&(this.collisionTest=t),i!==void 0&&(this.transparentTest=i)}setMoveState(e,t){this.moveState.hasOwnProperty(e)&&(this.moveState[e]=t,t?this.resumeAnimationFn&&this.resumeAnimationFn():Object.keys(this.moveState).every(i=>this.moveState[i]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())}setCameralDefault(e){const t=this.viewer;t.scene.screenSpaceCameraController.enableRotate=e,t.scene.screenSpaceCameraController.enableTranslate=e,t.scene.screenSpaceCameraController.enableZoom=e,t.scene.screenSpaceCameraController.enableLook=e,t.scene.screenSpaceCameraController.enableTilt=e}}class Qg{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new cd(e),this.baseTiles=new ka(e),this.baseCompt=new Lg(e),this.baseSection=new Ng(e),this.basePlayer=new _g({cesium:e.cesium,viewer:e.viewer,modelInfo:{url:e.options?.playerUrl,modelName:e.options?.playerModelName,modelId:e.options?.playerModelId,scale:e.options?.playerScale},callbacks:e.callbacks})}getCesium(){return this.cesium}getViewer(){return this.viewer}setSceneOptions(...e){this.baseCesium.setSceneOptions(...e)}getSnapDomSImageBase64(...e){return this.baseCesium.getSnapDomSImageBase64(...e)}clearBackground(){this.baseCesium.clearBackground()}enableTestLabel(){this.baseCesium.enableTestLabel()}enableCesiumFXAA(e){this.baseCesium.enableCesiumFXAA(e)}updateModelEffect(e){this.baseCesium.updateModelEffect(e)}addModels(...e){return this.baseTiles.addModels(...e)}}class Hg{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new gi;showGlobal=!0;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}flyToCadModel(e={}){const t=e.modelId||this.modelId,i=this.dxfModelsList.find(s=>s.modelId===t);i&&this.flyToBounds(i)}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.dxfModelsList}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.dxfModelsList.find(i=>i.modelId===t):this.dxfModelsList}showJson({modelId:e,show:t}){this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})});const i=this.dxfModelsList.find(s=>s.modelId===e);i&&(i.show=t)}showJsonByLayer({modelId:e,show:t,layers:i}){const s=this.dxfModelsList.find(r=>r.modelId===e);if(!s){console.error("Tileset not found for modelId:",e);return}s.hiddenBatchIds||(s.hiddenBatchIds=new Set),s.layerMap&&Array.isArray(i)&&i.forEach(r=>{const l=s.layerMap[r];l!==void 0&&(t?s.hiddenBatchIds.delete(l):s.hiddenBatchIds.add(l))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(l=>`\${_BATCHID} !== ${l}`).join(" && ");s.style=new this.cesium.Cesium3DTileStyle({show:r})}else s.style=new this.cesium.Cesium3DTileStyle({show:!0});s.hasVisibilityListener||(s.hasVisibilityListener=!0,s.tileVisible.addEventListener(r=>{const l=r.content,a=l.featuresLength;if(a>0&&s.hiddenBatchIds)for(let c=0;c<a;c++)s.hiddenBatchIds.has(c)?l.getFeature(c).show=!1:l.getFeature(c).show=!0}))}flyToBounds(e,t){const i=this.cesium,s=e.boundingSphere?.radius||1e3,o={offset:new i.HeadingPitchRange(0,i.Math.toRadians(-90),s*.5),...t},r=o.duration??0;this.viewer.flyTo(e,{duration:r,offset:o.offset})}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const i=await t.blob(),s=new wa(new Ts(i),{password:"abc!?123",useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const l=await r.arrayBuffer({useWebWorkers:!1});await s.close();const a=new TextDecoder().decode(l);return JSON.parse(a.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}async addDxfModel({fileNames:e,options:t}){const i=this.renderGenAll;if(e?.length){for(const s of e){if(this.renderGenAll!==i)return;const o=this.renderGenByModel[s.modelId]||0;if((this.renderGenByModel[s.modelId]||0)!==o)return;const r=`${s.outPutPath}${s.dbName}/tileset.json`,l={...this.options,...t};try{const a=`${s.outPutPath}${s.dbName}/layerInfo.zip`,c=await this.loadModelFile(a);if(this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;const u=await this.cesium.Cesium3DTileset.fromUrl(r);if(u.maximumScreenSpaceError=0,this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(u,{modelId:s.modelId,modelName:s.modelName,deltaLatitude:s.deltaLatitude||0,deltaLongitude:s.deltaLongitude||0,relocated:!0,dbName:s.dbName,outPutPath:s.outPutPath,totalRotation:s.totalRotation||0,layerInfo:c}),s.formData?u.formData=s.formData:u.formData={modelId:u.modelId,longitude:u.deltaLongitude,latitude:u.deltaLatitude,distance:1e-6,rotation:0,totalRotation:u.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:u.modelId,label:u.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...u.formData,tileset:u}),Array.isArray(c)){const h=c;u.layerMap={};let f=this.mapLayers[s.modelId];f||(f={},this.mapLayers[s.modelId]=f),h.forEach(p=>{u.layerMap[p.layerName]=p.batchId,f[p.layerName]||(f[p.layerName]=[]),f[p.layerName].push({batchId:p.batchId,color:p.layerColor})})}if(this.dxfModelsList.push(u),this.setModelId(s.modelId),this.viewer.scene.primitives.add(u),this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;l.flyTo&&this.flyToBounds(u),l.onSuccess&&l.onSuccess(u)}catch(a){console.error(`Failed to load tileset or layer info: ${r}`,a)}}this.events.emit("mountAllCad",this.dxfModelsList)}}adjustingModelByCad(e){const t=this.cesium,i=t.Quaternion.fromAxisAngle(t.Cartesian3.UNIT_Z,t.Math.toRadians(e.totalRotation)),s=t.Matrix4.fromRotationTranslation(t.Matrix3.fromQuaternion(i),new t.Cartesian3(0,0,0)),o=t.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),r=t.Transforms.eastNorthUpToFixedFrame(o);t.Matrix4.multiply(r,s,r),e.tileset?._root&&(e.tileset._root.transform=r)}deleteCad({modelId:e}){this.mapLayers[e]&&(Object.values(this.mapLayers[e]).forEach(i=>{i.forEach(s=>{this.viewer.scene.primitives.remove(s.primitive),s.primitive?.destroy()})}),delete this.mapLayers[e]),this.renderGen[e]=(this.renderGen[e]||0)+1,this.renderGenByModel[e]=(this.renderGenByModel[e]||0)+1;const t=this.dxfModelsList.findIndex(i=>i.modelId===e);if(t>-1){const i=this.dxfModelsList[t];this.viewer.scene.primitives.remove(i),i.destroy&&!i.isDestroyed()&&i.destroy(),this.dxfModelsList.splice(t,1)}}deleteAllCad(){Object.keys(this.mapLayers).forEach(e=>{this.deleteCad({modelId:e})}),[...this.dxfModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}class At{constructor(e,t){if(this.viewer=e,!this.viewer)return;this.type="prompt",t=t||{};const i=t.type==null?1:t.type;let s={id:new Date().getTime()+""+Math.floor(Math.random()*1e4),type:i,anchor:i==2,closeBtn:i==2,offset:i==2?{x:0,y:-20}:{x:10,y:10},content:"",show:!0,style:{background:"rgba(0,0,0,0.5)",color:"white"}};this.opt=Object.assign(s,t),this.attr=this.opt;const o=this.viewer.container.id;this.isShow=this.opt.show==null?!0:this.opt.show;let r="",l="";const a=this.opt.style.background,c=this.opt.style.color;this.opt.anchor&&(r+=`
81
+ `;pi=document.createElement("style"),pi.textContent=n,document.head.appendChild(pi)}function xg(){if(Da)return;Ig(),Te=document.createElement("div"),Te.className="tech-alert-wrapper",document.body.appendChild(Te);const n={setup(){return()=>Ee.visible?d.h(me.Alert,{class:`tech-alert tech-alert-${Ee.type}`,message:Ee.title,description:Ee.description,showIcon:Ee.showIcon,closable:Ee.closable,onClose:()=>{Ee.visible=!1}},{icon:()=>Ee.type==="loading"?d.h(pn.LoadingOutlined):Ee.type==="success"?d.h(pn.CheckCircleOutlined):Ee.type==="error"?d.h(pn.CloseCircleOutlined):Ee.type==="warning"?d.h(pn.ExclamationCircleOutlined):d.h(pn.InfoCircleOutlined)}):null}};Ta=d.createVNode(n),d.render(Ta,Te),Da=!0}function Bn(n){xg(),Ls&&clearTimeout(Ls),Ee.type=n.type||"info",Ee.title=n.title||"",Ee.description=n.description||"",Ee.closable=n.closable??!1,Ee.showIcon=n.showIcon??!0,Ee.visible=!0,Te&&(n.container?(Te.parentNode!==n.container&&n.container.appendChild(Te),Te.style.position="absolute",Te.style.top="20px",Te.style.left="50%",Te.style.transform="translateX(-50%)"):(Te.parentNode!==document.body&&document.body.appendChild(Te),Te.style.position="fixed",Te.style.top="20px",Te.style.left="50%",Te.style.transform="translateX(-50%)"));const e=n.duration??(Ee.type==="loading"?0:3);e>0&&(Ls=setTimeout(()=>{Ee.visible=!1},e*1e3))}const ge={info:(n,e,t,i)=>Bn({type:"info",title:n,description:e,duration:t,container:i}),success:(n,e,t,i)=>Bn({type:"success",title:n,description:e,duration:t,container:i}),error:(n,e,t,i)=>Bn({type:"error",title:n,description:e,duration:t,container:i}),warning:(n,e,t,i)=>Bn({type:"warning",title:n,description:e,duration:t,container:i}),loading:(n,e,t)=>Bn({type:"loading",title:n,description:e,duration:0,container:t}),close:()=>{Ee.visible=!1}},Bg="E84#E3C4!8C4&A1";async function mt(n){try{const e=await fetch(n);if(!e.ok)return ge.error("[loadModelFile] 加载失败",`${n} ${e.status}`),!1;const t=await e.blob();try{const i=new wa(new Ts(t),{password:Bg}),o=(await i.getEntries()).find(l=>!l.directory&&l.filename.endsWith(".json"));if(!o)return await i.close(),!1;const r=await o.getData(new Sp);return await i.close(),JSON.parse(r.trim())}catch{const i=await t.text();try{return JSON.parse(i.trim())}catch(s){throw console.error(`[loadModelFile] JSON parse error: ${n}`,s),s}}}catch(e){return ge.error("[loadModelFile] 加载失败",`${n} ${e}`),!1}}async function Sg(n){if(!n)return null;try{const e=`/st/modelComponentTree/list?dbName=${encodeURIComponent(n)}`,t=await fetch(e);if(!t.ok)return console.warn(`[loadTreeFromApi] API 请求失败: ${e} ${t.status}`),null;const i=await t.json();return Array.isArray(i)?Mg(i):(console.warn("[loadTreeFromApi] API 返回格式错误: 期望数组",i),null)}catch(e){return console.error("[loadTreeFromApi] 加载异常:",e),null}}function Mg(n){const e={},t=[];return n.forEach(i=>{i.id&&(e[i.id]={...i,children:[]})}),n.forEach(i=>{if(!i.id)return;const s=e[i.id];if(!s)return;const o=i.parentId;o&&e[o]?e[o].children?.push(s):t.push(s)}),t}async function Tg(n){if(!n||n.length===0)return null;try{const e=await fetch("/bim/modelComponent/listByDbNameAndElementId",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return e.ok?await e.json():(console.warn(`[fetchComponentDetails] API 请求失败: ${e.status}`),null)}catch(e){return console.error("[fetchComponentDetails] 加载异常:",e),null}}function Dg(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}class gi{events={};on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}emit(e,...t){this.events[e]&&this.events[e].forEach(i=>i(...t))}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(i=>i!==t))}}class ka{cesium;viewer;modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new gi;options={flyTo:!0,flyToDuration:0,loadTreeNodeDetails:!0,loadTreeNodeDetailsUrl:"/elementInfo.zip",loadTree:!0,loadTreeUrl:"/allElementsInfo.zip",boxRegionUrl:"/BoundingBoxInfo.zip",regionUrl:"/region.zip",batchIDInfoUrl:"/batchIDInfo.zip",enabledSection:!0,delay:0,tilesetOptions:{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:32,skipLevelOfDetail:!0,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:128,skipLevels:5,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*10,preloadWhenHidden:!0,preferLeaves:!0,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.options.tilesetOptions&&(this.options.tilesetOptions.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE)}deleteAllModels(){const e=[];return Object.keys(this.mapTileset).forEach(t=>{const i=this.mapTileset[t];i&&(this.viewer.scene.primitives.remove(i),e.push(t)),delete this.mapTileset[t],delete this.hasLoaded3dTiles[t],delete this.mapRecordModelId[t]}),this.modelList=[],this.viewer.scene.requestRender(),this.events.emit("mountAll3Dtiles",{modelList:[],mapTileset:{}}),e}deleteModels(e){const t=[];return e.forEach(({modelId:i})=>{const s=this.mapTileset[i];s&&(this.viewer.scene.primitives.remove(s),t.push(i)),delete this.mapTileset[i],delete this.hasLoaded3dTiles[i],delete this.mapRecordModelId[i]}),this.modelList=this.modelList.filter(i=>!t.includes(i.modelId)),this.viewer.scene.requestRender(),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset}),t}showModels(e){const t=[];return e.forEach(i=>{const s=`${i.modelId}`,o=this.mapTileset[s];o&&(o.show=!!i.show,t.push(s))}),t.length&&this.viewer.scene.requestRender(),t}async addModels({files:e,fileNames:t,options:i}){const s=e||t||[];s.length>0&&await this.add3DTilesModel(s,i)}async add3DTilesModel(e,t){const i=t?Kh({},this.options,t):{...this.options};if(e?.length){for(const s of e){const o=`${s.modelId}`;if(this.mapRecordModelId[o])continue;const r=`${s.outPutPath}${s.dbName}/tileset.json`;this.modelList.push({...s,url:r,state:Kt.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(i)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===Kt.NotLoaded);if(!t.length)return;const i=t.length;this.events.emit("loadingStatus",`正在加载 ${i} 个模型`);let s=0,o=!1;for(const r of t){s++;try{r.state=Kt.Loading;const l=r.url,a=this.getBaseUrlPath(l);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}构件信息`);let c=e.loadTreeNodeDetails?await mt(`${a}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}目录树`);const u=e.loadTree?await mt(`${a}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${i} 个模型: 加载${r.modelName}模型数据`);const h=e.boxRegionUrl?await mt(`${a}${e.boxRegionUrl}`):!1,f=e.batchIDInfoUrl?await mt(`${a}${e.batchIDInfoUrl}`):!1;f&&(c||(c=f));const p=await this.loadTilesetWithZipSupport(l,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(p),await p.readyPromise;const A=`${p?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=p;const C={versionId:A,selectedFn:e.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:r.url,treeUrl:`${a}${e.loadTreeUrl}`,nodeUrl:`${a}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:c||null,tree:u||null,box:null};if(h?.min&&h?.max){const m={x:h.min.X,y:h.min.Y,z:h.min.Z},y={x:h.max.X,y:h.max.Y,z:h.max.Z},E={x:(m.x+y.x)/2,y:(m.y+y.y)/2,z:(m.z+y.z)/2};C.box={min:m,max:y,center:E}}if(!r.formData){const m=await mt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(m)r.formData={modelId:r.modelId.toString(),longitude:m.Longitude,latitude:m.Latitude,distance:1e-6,rotation:30,totalRotation:m.DAngle||0,height:m.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:m?.X||0,Y:m?.Y||0,Z:m?.Z||0};else{const y=t.indexOf(r);r.formData={modelId:r.modelId.toString(),longitude:118.12548706388897,latitude:24.596796919444404,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:0,lonlat:1e-5,modelOptions:[{value:y+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,C.model.formData=r.formData),p.leiting=C,dr({Cesium:this.cesium,tileset:p}),r.state=Kt.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",p),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(p),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(m=>setTimeout(m,e.delay))}catch(l){console.error(`模型 ${r.modelName} 加载失败:`,l),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=Kt.Error}}e.mountAll3Dtiles&&e.mountAll3Dtiles(this.modelList),e.onMountAll3Dtiles&&e.onMountAll3Dtiles(this.modelList),this.events.emit("loadingStatus",""),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}async addOSGB({files:e,options:t}){const i=this.cesium;if(!e?.length)return;this.events.emit("loadingStatus",`正在加载 ${e.length} 个倾斜摄影模型`);let s=!1,o=0;for(const r of e){o++,this.events.emit("loadingStatus",`正在加载第 ${o}/${e.length} 个模型: 加载${r.modelName}`);try{const{outPutPath:l,dbName:a,modelId:c}=r,u=`${l}${a}/tileset.json`,h=await i.Cesium3DTileset.fromUrl(u,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(this.viewer.scene.primitives.add(h),await h.readyPromise,this.mapTileset[`${c}`]=h,this.hasLoaded3dTiles[`${c}`]=(this.hasLoaded3dTiles[`${c}`]||0)+1,this.mapRecordModelId[`${c}`]=!0,!r?.formData){const f=h.root.computedTransform;if(f){const p=i.Matrix4.fromColumnMajorArray(f),A=i.Matrix4.getTranslation(p,new i.Cartesian3),C=i.Ellipsoid.WGS84.cartesianToCartographic(A),m=i.Math.toDegrees(C.longitude),y=i.Math.toDegrees(C.latitude),E=C.height;r.formData={modelId:r.modelId.toString(),longitude:m,latitude:y,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:E,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${c} 无法获取初始位置信息`)}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),h.leiting={versionId:`${h?.asset?.tilesetVersion??c}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:u,formData:r.formData,type:"OSGB"},box:null},this.modelList.push({...r,url:u,state:Kt.Loaded}),!s&&t?.flyTo&&(this.viewer.zoomTo(h),s=!0)}catch(l){console.error(`OSGB模型 ${r.dbName} 加载失败:`,l);continue}}this.events.emit("loadingStatus",""),this.events.emit("onMountAllOsgb3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}updateOSGBMatrix(e){const{X:t,Y:i,Z:s,modelId:o}=e,r=this.cesium,l=this.mapTileset[o];if(!l){console.warn("tileSet not found for modelId:",o);return}let a=t||0,c=i||0,u=s||0;const h=l.boundingSphere.center,f=r.Transforms.eastNorthUpToFixedFrame(h),p=new r.Cartesian3(a,c,u),A=r.Matrix4.multiplyByPoint(f,p,new r.Cartesian3(0,0,0)),C=r.Cartesian3.subtract(A,h,new r.Cartesian3);l.modelMatrix=r.Matrix4.fromTranslation(C)}flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...l}=t,a={duration:0,...l};this.viewer.flyTo(s,a).then(c=>{c?o&&o():r&&r()}).catch(c=>{r&&r(),console.error("FlyTo error",c)})}getMapTileset(){return this.mapTileset}getBIMmodelId(){return this.BIMmodelId}getModelList(){return this.modelList}setMapTileset(e){this.mapTileset=e}setBIMmodelId(e){this.BIMmodelId=e}setModelList(e){this.modelList=e}getBaseUrlPath(e){const t=e.lastIndexOf("/");return t===-1?".":e.substr(0,t)}async loadTilesetWithZipSupport(e,t,i,s){const o=`${this.getBaseUrlPath(e)}/tileset.zip`;if((await fetch(o)).status===200){const a=await mt(o);if(a){const c=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(c),h=s.Proxy,f=this.getBaseUrlPath(e);h.getURL=A=>A.includes("blob://")?A.replace(/blob:\/\//g,f):A;const p=new s.Resource({url:u,proxy:h});try{return await s.Cesium3DTileset.fromUrl(p,{id:t,...i})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...i})}}}return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...i})}async loadTreeForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting.tree)return t.leiting.tree;const i=t.leiting.model?.modelName||e,s=t.leiting.model?.treeUrl,o=t.leiting.model?.dbName;if(!o&&!s)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${i} 目录树...`);try{if(o){const r=await Sg(o);if(r&&r.length>0)return t.leiting.tree=r,r}if(s){const r=await mt(s);if(r)return t.leiting.tree=r,r}}catch(r){console.error(`Failed to load tree for model ${e}:`,r)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const i=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!i)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await mt(i);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}}const Pa={normal:0,process:2},kg={color:1};function Fa(n){return n===1||n==="exist"?1:n===2||n==="process"?2:0}function en(n){return Number.isNaN(n)?0:n<=1?Math.min(Math.max(n,0),1):Math.min(Math.max(n/255,0),1)}function Ra(n){return Number.isNaN(n)?1:n<=1?Math.min(Math.max(n,0),1):1}function Ns(n){if(!n)return null;const e=Number(n.r),t=Number(n.g),i=Number(n.b),s=n.a===void 0?1:Number(n.a);if([e,t,i,s].some(a=>Number.isNaN(a)))return null;const o=Math.round(e*255),r=Math.round(t*255),l=Math.round(i*255);return`rgba(${o},${r},${l},${s})`}function Pg(n){if(!n||typeof n!="string")return null;const t=n.replace(/\s+/g,"").match(/^rgba?\((\d+),(\d+),(\d+)(?:,([0-9.]+))?\)$/i);if(!t)return null;const i=Number(t[1]),s=Number(t[2]),o=Number(t[3]),r=t[4]===void 0?1:Number(t[4]);return[i,s,o,r].some(l=>Number.isNaN(l))?null:{r:Math.min(Math.max(i/255,0),1),g:Math.min(Math.max(s/255,0),1),b:Math.min(Math.max(o/255,0),1),a:Math.min(Math.max(r,0),1)}}function Fg(n){if(n==null)return null;const e=Number(n);return Number.isNaN(e)?null:e}function Rg(n){const e=n.lastIndexOf("-"),t=n.substring(0,e),i=n.substring(e+1);return[t,i]}function Us(n){if(!n)return null;const e=n.Min??n.min,t=n.Max??n.max;if(!e||!t)return null;const i=Number(e.x??e.X),s=Number(e.y??e.Y),o=Number(e.z??e.Z),r=Number(t.x??t.X),l=Number(t.y??t.Y),a=Number(t.z??t.Z);return[i,s,o,r,l,a].some(c=>Number.isNaN(c))?null:{min:{x:i,y:s,z:o},max:{x:r,y:l,z:a}}}function Sn(n,e){if(e)return`${e}`;const t=n?.leiting?.model?.modelId??n?.modelId??n?.id;return t==null?null:`${t}`}function Og(n,e){if(e==null)return null;const t=n?.leiting?.node;if(!t)return null;const i=`${e}`,s=t?.[i],o=Us(s?.box3??s?.box);if(o)return o;const r=t?.element?.[i]??t?.elements?.[i]??t?.nodeExtras?.element?.[i]??t?.nodeExtras?.elements?.[i];return Us(r?.box3??r?.box)}function Lg(n){const e=n?.leiting?.box;return e?Us({min:e.min,max:e.max}):null}class Ng{base;constructor(e){this.base=e}initTime(){const t=this.base.cesium.JulianDate.fromDate(new Date(2023,3,21,10,0));this.base.viewer.clock.currentTime=t,this.base.start=this.base.viewer.clock.currentTime.secondsOfDay*1e3}processAnimation(e,t,i,s=null){if(this.base.start==null)return;const o=this.base.start+(e?.delay??0),r=this.base.start+(e?.playtime??0)+(e?.delay??0);t<=o&&(e.cash=!0,e.groupData.forEach(l=>{const{batchIds:a,modelId:c,rgba:u}=l;if(Array.isArray(a)&&a[0]){a[0][1]=u;const h=i[c];h?h.push(a[0]):i[c]=[a[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(l=>{const{batchIds:a,playTimeColor:c,modelId:u}=l;if(Array.isArray(a)&&a[0]){a[0][1]=c;const h=i[u];h?h.push(a[0]):i[u]=[a[0]]}})),t>=r&&(e.finished=!0)}onTick=e=>{if(!this.base.cesium||!this.base.viewer)return;const t=e?.currentTime?.secondsOfDay?e.currentTime.secondsOfDay*1e3:this.base.viewer.clock.currentTime.secondsOfDay*1e3,i={};Array.isArray(this.base.data)&&this.base.data.forEach(o=>{this.processAnimation(o,t,i,.1)});const s=Object.entries(i);if(s.forEach(([o,r])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:r})}),Object.keys(this.base.mapAnimations).forEach(o=>{const r=this.base.mapAnimations[o];r.length&&r.every(l=>l.finished)&&!this.base.clearedModelIds.has(o)&&(this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:[]}),this.base.clearedModelIds.add(o))}),this.base.recoverStaus){s.length&&(this.base.recoverStaus=!1);return}s.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(o=>{o.groupData.forEach(r=>{const{modelId:l}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:l,batchIds:[]})}),this.base.recoverStaus=!0})};enableConstructionProgressTracking(){this.base.clearedModelIds.clear(),this.initTime(),this.base.groupBatchIds={},Array.isArray(this.base.data)&&(this.base.data.forEach(e=>{e.cash=!1,e.playCash=!1,e.groupData.forEach(t=>{const{batchIds:i,modelId:s,rgba:o}=t;if(Array.isArray(i)&&i[0]){i[0][1]=o;const r=this.base.groupBatchIds[s];r?r.push(i[0]):this.base.groupBatchIds[s]=[i[0]]}})}),Object.entries(this.base.groupBatchIds).forEach(([e,t])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t})})),this.base.viewer.clock.onTick.addEventListener(this.onTick)}disableConstructionProgressTracking(){this.base.viewer.clock.onTick.removeEventListener(this.onTick),this.base.viewer.scene.ambientLightIntensity=1,Array.isArray(this.base.data)&&this.base.data.forEach(e=>{e.cash=!0,e.playCash=!0,e.groupData.forEach(t=>{const{modelId:i}=t,s=[];this.base.setTileSyltByConstructionProcessTracking({modelId:i,batchIds:s})})}),this.base.start=null}freshConstructionProgressTracking(){const e=this.base.viewer.clock.currentTime.secondsOfDay*1e3,t={};Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.playCash=!1,this.processAnimation(s,e,t)});const i=Object.entries(t);i.forEach(([s,o])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:s,batchIds:o})}),i.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.groupData.forEach(o=>{const{modelId:r}=o;this.base.setTileSyltByConstructionProcessTracking({modelId:r,batchIds:[]})})})}reStartAnimation(){let e={};this.base.clearedModelIds.clear(),Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData.forEach(i=>{const{batchIds:s,modelId:o,rgba:r}=i;if(Array.isArray(s)&&s[0]){s[0][1]=r;const l=e[o];l?l.push(s[0]):e[o]=[s[0]]}})}),Object.entries(e).forEach(([t,i])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:t,batchIds:i})}),this.initTime()}setAllConstructionProgressTracking(e){this.base.data=e,Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData=[],t.finished=!1,t.mergeCpts.forEach(i=>{const s=[];i.cpts.forEach(a=>{s.push({dbName:i.linkModelId,modelId:i.modelId,elementId:`${a}`,show:!0,rgba:t.rgba??{r:.4,g:.4,b:.4,a:.1}})});const o=Pa.process,r=kg.color,{allElements:l}=this.base.groupByModelId(s);this.base.mapAnimations[i.modelId]=this.base.mapAnimations[i.modelId]||[],this.base.mapAnimations[i.modelId].push(t),Object.entries(l).forEach(([a,c])=>{const[u,h]=Rg(a),f=this.base.getTileSyltByConstructionProcessTracking({elementIds:c,modelId:u,color:h,colorRank:o,show:!0,selectionRank:r}),p=t?.playTimeColor?.r??1,A=t?.playTimeColor?.g??1,C=t?.playTimeColor?.b??0,m=t?.playTimeColor?.a??.1,y=this.base.setColor({r:p,g:A,b:C,a:m}),E=this.base.setColor(t.rgba??{r:.4,g:.4,b:.4,a:.1});t.groupData.push({modelId:u,batchIds:f,playTimeColor:y,rgba:E})})})})}}class Ug{base;constructor(e){this.base=e}attachTileset(e,t,i){const s=this.base.cesium;this.base.handler||(this.base.handler=new s.ScreenSpaceEventHandler(this.base.viewer.scene.canvas));const o=Sn(e,i);o&&(this.base.tilesetMap[o]=e),t&&(this.base.selectedColor=t),this.bindInputs()}bindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.setInputAction(t=>{let i;try{i=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(i)&&i instanceof e.Cesium3DTileFeature){this.base.clearSelection();const s=Sn(i.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(i);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const u=e.Cartographic.fromCartesian(l),h=e.Math.toDegrees(u.longitude),f=e.Math.toDegrees(u.latitude),p=u.height;r=[h,f,p]}const c=(this.base.hasSelectedFeaturesMap[s]||[]).filter(u=>u.rank!==0);this.base.hasSelectedFeaturesMap[s]=[...c,{batchId:o,selectedColor:this.base.selectedColor,rank:0,point:r}],this.base.setBaseStyle(s),this.base.triggerSelectionChange(),i.tileset.leiting?.selectedFn&&i.tileset.leiting.selectedFn(i.tileset)}else this.base.clearSelection()},e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.setInputAction(t=>{let i;try{i=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(i)&&i instanceof e.Cesium3DTileFeature){const s=Sn(i.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(i);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const a=e.Cartographic.fromCartesian(l),c=e.Math.toDegrees(a.longitude),u=e.Math.toDegrees(a.latitude),h=a.height;r=[c,u,h]}this.base.toggleMultiSelect(s,o,this.base.selectedColor,r)}},e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{this.base.ensureSelectionDiv();const i=this.base.viewer?.scene?.screenSpaceCameraController;i&&this.base.cameraControllerState===null&&(this.base.cameraControllerState={enableRotate:i.enableRotate,enableTilt:i.enableTilt,enableLook:i.enableLook},i.enableRotate=!1,i.enableTilt=!1,i.enableLook=!1),this.base.selectStart=this.base.cesium.Cartesian2.clone(t.position),this.base.selectEnd=null,this.base.selectionDiv&&this.base.selectStart&&(this.base.selectionDiv.style.left=`${this.base.selectStart.x}px`,this.base.selectionDiv.style.top=`${this.base.selectStart.y}px`,this.base.selectionDiv.style.width="0px",this.base.selectionDiv.style.height="0px",this.base.selectionDiv.style.display="block")},e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{if(!this.base.selectStart||!this.base.selectionDiv)return;const i=performance.now();if(i-this.base.lastDrawTime<20)return;this.base.lastDrawTime=i,this.base.selectEnd=this.base.cesium.Cartesian2.clone(t.endPosition);const s=Math.min(this.base.selectStart.x,this.base.selectEnd.x),o=Math.min(this.base.selectStart.y,this.base.selectEnd.y),r=Math.abs(this.base.selectStart.x-this.base.selectEnd.x),l=Math.abs(this.base.selectStart.y-this.base.selectEnd.y);this.base.selectionDiv.style.left=`${s}px`,this.base.selectionDiv.style.top=`${o}px`,this.base.selectionDiv.style.width=`${r}px`,this.base.selectionDiv.style.height=`${l}px`,this.base.selectionDiv.style.backgroundColor="rgba(0, 255, 255, 0.5)",this.base.selectionDiv.style.position="absolute",this.base.selectionDiv.style.zIndex="2"},e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(()=>{if(!this.base.selectStart||!this.base.selectionDiv)return;if(!this.base.selectStart||!this.base.selectEnd){this.base.selectionDiv.style.display="none";const i=this.base.viewer?.scene?.screenSpaceCameraController;i&&this.base.cameraControllerState!==null&&(i.enableRotate=this.base.cameraControllerState.enableRotate,i.enableTilt=this.base.cameraControllerState.enableTilt,i.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null);return}this.base.selectionDiv.style.display="none",this.base.selectTilesInRectangle(this.base.selectStart,this.base.selectEnd,this.base.selectedColor),this.base.viewer.scene.requestRender(),this.base.selectStart=null,this.base.selectEnd=null;const t=this.base.viewer?.scene?.screenSpaceCameraController;t&&this.base.cameraControllerState!==null&&(t.enableRotate=this.base.cameraControllerState.enableRotate,t.enableTilt=this.base.cameraControllerState.enableTilt,t.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null)},e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}unbindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}}class _g{cesium;viewer;data;handler;selectedColor="rgba(255,0,0,1.0)";tilesetMap={};hasSelectedFeaturesMap={};colorRankColor=[];showStateMap={};selectedPosition={x:null,y:null};selectionDiv=null;lastDrawTime=0;selectStart=null;selectEnd=null;cameraControllerState=null;start=null;groupBatchIds={};recoverStaus=!1;mapAnimations={};clearedModelIds=new Set;eidToBatchIdMap={};batchIdToElementIdMap={};animationModule;selectionModule;onSelectionChangeCallbacks=[];loadNodeDetailsForModel;loadNodeDetailsCallback;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new Ng(this),this.selectionModule=new Ug(this)}attachTileset(e,t,i){this.selectionModule.attachTileset(e,t,i)}setLoadNodeDetailsCallback(e){this.loadNodeDetailsCallback=e}selectionChange(e){e&&typeof e=="function"&&this.onSelectionChangeCallbacks.push(e)}removeSelectionChange(e){this.onSelectionChangeCallbacks=this.onSelectionChangeCallbacks.filter(t=>t!==e)}triggerSelectionChange(){if(this.onSelectionChangeCallbacks.length>0){const e=this.getSelected({rank:0});this.onSelectionChangeCallbacks.forEach(t=>{try{t(e)}catch(i){console.error("Selection callback error:",i)}})}}enableSelection(){this.selectionModule.bindInputs()}disableSelection(){this.selectionModule.unbindInputs()}clearSelection(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==0);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender(),this.triggerSelectionChange()}clearExist(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==1);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender()}clearProcess(e){this.getTargetModelIds(e).forEach(i=>{const s=this.hasSelectedFeaturesMap[i];if(!s?.length)return;const o=s.filter(r=>r.rank!==2);o.length?(this.hasSelectedFeaturesMap[i]=o,this.setBaseStyle(i)):(delete this.hasSelectedFeaturesMap[i],this.applyShowStyleOnly(i))}),this.viewer.scene.requestRender()}clearAllHaveSelected(){this.getTargetModelIds().forEach(t=>{this.hasSelectedFeaturesMap[t]&&(delete this.hasSelectedFeaturesMap[t],this.applyShowStyleOnly(t))}),this.viewer.scene.requestRender(),this.triggerSelectionChange()}getSelected(e){const t=e&&typeof e=="object"&&"rank"in e?e.rank:e,i=Fa(t),s=[];return Object.keys(this.hasSelectedFeaturesMap).forEach(o=>{(this.hasSelectedFeaturesMap[o]||[]).forEach(async l=>{if(l.rank!==i)return;const a=Pg(l.selectedColor);let c=await this.getElementId(l.batchId,o);c===null&&(c=l.batchId),s.push({elementId:c,modelId:o,rgba:a||void 0,point:l?.point||void 0})})}),s}setAllConstructionProgressTracking(e){this.animationModule.setAllConstructionProgressTracking(e)}initTime(){this.animationModule.initTime()}processAnimation(e,t,i,s=null){this.animationModule.processAnimation(e,t,i,s)}onTick=e=>{this.animationModule.onTick(e)};enableConstructionProgressTracking(){this.animationModule.enableConstructionProgressTracking()}disableConstructionProgressTracking(){this.animationModule.disableConstructionProgressTracking()}freshConstructionProgressTracking(){this.animationModule.freshConstructionProgressTracking()}reStartAnimation(){this.animationModule.reStartAnimation()}setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t}){const i=this.tilesetMap[e];if(!i)return;const s=i?.style?.show?.conditionsExpression?.conditions;Array.isArray(t)&&t.length?s?i.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s},color:{conditions:t}}):i.style=new this.cesium.Cesium3DTileStyle({color:{conditions:t}}):this.applyShowStyleOnly(e),this.viewer.scene.requestRender()}resumeFlyTo(){this.viewer.clock.shouldAnimate=!0}pauseFlyTo(){this.viewer.clock.shouldAnimate=!1}flyToObjects({selectCpts:e,options:t}){if(!Array.isArray(e)||e.length===0)return;this.clearSelection(),this.setSelectColorUserModelCpt(e,{rank:0});const i=this.cesium,s=t?.scale??1,o=[];if(e.forEach(r=>{const l=r?.modelId,a=r?.elementId;if(l==null)return;const c=this.tilesetMap[`${l}`];if(!c)return;const h=Og(c,a)||Lg(c);if(!h)return;const f=new i.Cartesian3(h.min.x,h.min.y,h.min.z),p=new i.Cartesian3(h.max.x,h.max.y,h.max.z),A=c?.root?.computedTransform??c?.modelMatrix;if(A){const C=i.Matrix4.multiplyByPoint(A,f,new i.Cartesian3),m=i.Matrix4.multiplyByPoint(A,p,new i.Cartesian3);o.push(C,m)}else o.push(f,p)}),o.length){const r=i.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const l=this.viewer.scene.camera,a=new i.HeadingPitchRange(l.heading,l.pitch,0);l.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:a})}else{const r=e[0]?.modelId,l=r?this.tilesetMap[`${r}`]:null;l&&this.viewer.flyTo(l,{duration:t?.duration??0,complete:t?.complete})}}setBaseStyle(e){this.getTargetModelIds(e).forEach(i=>{this.setColorStyle(i)})}setColorStyle(e){this.updateTilesetStyle(e)}buildColorConditions(e){const t=this.tilesetMap[e],i=this.hasSelectedFeaturesMap[e];if(!t||!i?.length)return;const s=new Map;i.forEach(a=>{const c=s.get(a.batchId);(!c||a.rank>=c.rank)&&s.set(a.batchId,a)});const o=new Map;if(s.forEach(({batchId:a,selectedColor:c})=>{o.has(c)||o.set(c,new Set),o.get(c)?.add(a)}),this.colorRankColor.length){const a=new Set;this.colorRankColor.forEach(c=>{const u=o.get(c);u&&u.forEach(h=>a.add(h))}),o.forEach((c,u)=>{if(this.colorRankColor.includes(u))return;const h=new Set;c.forEach(f=>{a.has(f)||h.add(f)}),o.set(u,h)})}const r=[...this.colorRankColor.filter(a=>o.has(a)),...Array.from(o.keys()).filter(a=>!this.colorRankColor.includes(a))],l=[];return r.forEach(a=>{const c=o.get(a);if(!c||!c.size)return;const u=Array.from(c).join("|");u&&l.push([`(regExp('^(${u})$').test(\${id}))`,a])}),l.length?l:void 0}updateTilesetStyle(e){const t=this.tilesetMap[e];if(!t)return;const i=this.showStateMap[e],s=i?this.buildShowConditions(i.batchIds,i.mode):void 0,o=this.buildColorConditions(e);s||o?t.style=new this.cesium.Cesium3DTileStyle({show:s?{conditions:s}:void 0,color:o?{conditions:o}:void 0}):t.style=void 0,this.viewer.scene.requestRender()}setShowStyle(e){this.getTargetModelIds(e?.modelId).forEach(i=>{const s=this.showStateMap[i]||{batchIds:[],mode:"include"};this.showStateMap[i]={batchIds:e?.batchIds??s.batchIds,mode:e?.mode??s.mode},this.updateTilesetStyle(i)})}setColor(e){if(!e)return this.selectedColor;if(typeof e=="string")return e;const t=en(Number(e.r)),i=en(Number(e.g)),s=en(Number(e.b)),o=Ra(e.a===void 0?1:Number(e.a));return Ns({r:t,g:i,b:s,a:o})||this.selectedColor}groupByModelId(e){const t={};return e.forEach(i=>{const s=i?.modelId,o=i?.elementId;if(s==null||o===void 0||o===null)return;const r=i?.color??i?.rgba,l=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),a=`${s}-${l}`;t[a]||(t[a]=[]),t[a].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchId(e,t){const i=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[i]){const a=this.eidToBatchIdMap[i].get(s);if(a!==void 0)return a}const r=this.tilesetMap[i]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const a=new Map;r.forEach(u=>{a.set(`${u.elementID}`,`${u.batchId}`)}),this.eidToBatchIdMap[i]=a;const c=a.get(s);if(c!==void 0)return c}const l=Fg(e);return l!=null?String(l):null}loadingModels=new Set;async getElementId(e,t){if(this.batchIdToElementIdMap[t]){const o=this.batchIdToElementIdMap[t].get(e);if(o!==void 0)return o}const i=this.tilesetMap[t];i.leiting?.node?.batchIdEIDInfos||await this.loadNodeDetailsForModel(t);const s=i?.leiting?.node?.batchIdEIDInfos;if(s&&Array.isArray(s)){const o=new Map;s.forEach(l=>{l&&l.elementID&&o.set(`${l.batchId}`,`${l.elementID}`)}),this.batchIdToElementIdMap[t]=o;const r=o.get(e);if(r!==void 0)return r}return i&&i.leiting&&!i.leiting.node&&i.leiting.model?.nodeUrl&&(this.loadingModels.has(t)||(this.loadingModels.add(t),this.loadNodeDetailsCallback&&this.loadNodeDetailsCallback(t).then(()=>{this.loadingModels.delete(t),this.triggerSelectionChange()}).catch(()=>{this.loadingModels.delete(t)}))),null}setComponentVisibility(e){if(!Array.isArray(e))return;const t=new Set;e.forEach(i=>{const s=`${i.modelId}`,o=this.getBatchId(i.elementId,s);if(o===null)return;t.add(s);const r=this.showStateMap[s]||{batchIds:[],mode:"exclude"},l=new Set(r.batchIds);r.mode==="exclude"?i.show?l.delete(o):l.add(o):i.show?l.add(o):l.delete(o),r.batchIds=Array.from(l),this.showStateMap[s]=r}),t.forEach(i=>this.updateTilesetStyle(i))}setAllComponentsVisibility(e){this.getTargetModelIds().forEach(i=>{e?this.setShowStyle({modelId:i,batchIds:[],mode:"exclude"}):this.setShowStyle({modelId:i,batchIds:[],mode:"include"})})}getComponentsByVisibility(e){const t=[];return Object.keys(this.showStateMap).forEach(i=>{const s=this.showStateMap[i],o=this.tilesetMap[i];if(!o?.leiting?.node?.batchIdEIDInfos)return;const r=o.leiting.node.batchIdEIDInfos,l=new Set(s?.batchIds??[]);r.forEach(a=>{const c=l.has(`${a.batchId}`);(s?.mode==="include"?c:!c)===e&&t.push({elementId:`${a.elementID}`,modelId:i})})}),t}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:i,colorRank:s,show:o,selectionRank:r}){const l=this.tilesetMap[t];if(!Array.isArray(e))return[];const a=l.leiting.node,c=new Set(e),u=a.batchIdEIDInfos.filter(f=>c.has(`${f.elementID}`)).map(f=>String(f.batchId));return u.length?(s===Pa.normal&&!this.colorRankColor.includes(i)&&(this.colorRankColor=[i]),[[`(regExp('^(${u.join("|")})$').test(\${id}))`,i]]):[]}setSelectColorUserModelCpt(e,t){if(!Array.isArray(e))return;const i=new Map,s=t?.rank===void 0?"exist":t?.rank,o=Fa(s);e.forEach(r=>{const l=r?.modelId;if(l==null)return;const a=`${l}`,c=Array.isArray(r?.elementIds)?r.elementIds:r?.elementId?[r.elementId]:[];if(!c.length)return;const u=Ns(r?.rgba)||this.selectedColor;c.forEach(h=>{const f=this.getBatchId(h,a);f!==null&&(i.has(a)||i.set(a,[]),i.get(a)?.push({batchId:f,selectedColor:u,rank:o}))})}),i.forEach((r,l)=>{const a=this.mergeSelections(l,r);this.hasSelectedFeaturesMap[l]=a,this.setBaseStyle(l)}),this.triggerSelectionChange()}setAllSelectColorUserModelCpt({modelId:e,rgba:t}){if(!e)return;const i=String(e),s=this.tilesetMap[i];if(!s)return;const o=s?.leiting?.node?.batchIdEIDInfos;if(!o||!Array.isArray(o))return;const r=[];o.forEach(l=>{l&&l.elementID!==void 0&&r.push(l.elementID)}),r.length!==0&&this.setSelectColorUserModelCpt([{modelId:i,elementIds:r,rgba:t}],{rank:0})}getFeatureId(e){if(this.cesium.defined(e)&&this.cesium.defined(e.getProperty)){const t=e.getProperty("id");return t!=null?String(t):"-1"}return"-1"}getTargetModelIds(e){return e?[e]:Object.keys(this.tilesetMap)}buildShowConditions(e,t){const i=e.join("|");return i?t==="include"?[[`(regExp('^(${i})$').test(\${id}))`,"true"],["true","false"]]:[[`(regExp('^(${i})$').test(\${id}))`,"false"],["true","true"]]:t==="include"?[["true","false"]]:void 0}applyShowStyleOnly(e){const t=this.tilesetMap[e];if(!t)return;const i=this.showStateMap[e],s=i?this.buildShowConditions(i.batchIds,i.mode):void 0;s?t.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s}}):t.style=void 0}setSelectedColorRgba(e,t,i,s=1){const o=en(e),r=en(t),l=en(i),a=Ra(s),c=Ns({r:o,g:r,b:l,a});c&&(this.selectedColor=c)}mergeSelections(e,t){const i=new Map;return(this.hasSelectedFeaturesMap[e]||[]).forEach(o=>i.set(o.batchId,o)),t.forEach(o=>{const r=i.get(o.batchId);(!r||o.rank>r.rank||o.rank===r.rank)&&i.set(o.batchId,o)}),Array.from(i.values())}toggleMultiSelect(e,t,i,s){const o=this.hasSelectedFeaturesMap[e]||[],r=o.filter(h=>h.rank!==0),l=o.filter(h=>h.rank===0),c=l.some(h=>h.batchId===t)?l.filter(h=>h.batchId!==t):[...l,{batchId:t,selectedColor:i,rank:0,point:s}],u=[...r,...c];u.length?(this.hasSelectedFeaturesMap[e]=u,this.setBaseStyle(e)):(delete this.hasSelectedFeaturesMap[e],this.applyShowStyleOnly(e)),this.triggerSelectionChange()}ensureSelectionDiv(){if(this.selectionDiv)return;const e=document.createElement("div");e.style.display="none",e.style.pointerEvents="none",e.style.border="1px solid rgba(0, 255, 255, 0.8)",this.viewer.container.appendChild(e),this.selectionDiv=e}isRepeatedClick(e){const t=e?.position;return!t||typeof t.x!="number"||typeof t.y!="number"?!1:this.selectedPosition.x===t.x&&this.selectedPosition.y===t.y?!0:(this.selectedPosition.x=t.x,this.selectedPosition.y=t.y,!1)}selectTilesInRectangle(e,t,i){const s=Math.min(e.x,t.x),o=Math.max(e.x,t.x),r=Math.min(e.y,t.y),l=Math.max(e.y,t.y),a=o-s,c=l-r;if(Math.abs(a)<15||Math.abs(c)<15)return;const u=s+a/2,h=r+c/2,f=new this.cesium.Cartesian2(u,h),p=this.viewer.scene.drillPick(f,void 0,a,c);if(!Array.isArray(p))return;const A=new Map;p.forEach(C=>{if(!(C instanceof this.cesium.Cesium3DTileFeature))return;const m=Sn(C.tileset);if(!m||!this.tilesetMap[m])return;const y=this.getFeatureId(C);y!=="-1"&&(A.has(m)||A.set(m,new Set),A.get(m)?.add(y))}),A.forEach((C,m)=>{const y=this.hasSelectedFeaturesMap[m]||[],E=y.filter(S=>S.rank!==0),I=new Set(y.filter(S=>S.rank===0).map(S=>S.batchId)),M=[];C.forEach(S=>{I.has(S)||M.push({batchId:S,selectedColor:i,rank:0})});const k=y.filter(S=>S.rank===0);this.hasSelectedFeaturesMap[m]=[...E,...k,...M],this.setBaseStyle(m)}),this.triggerSelectionChange()}}class Qg{cesium;viewer;tilesetMap={};planeEntities=[];clippingPlanesMap={};activeModelIds=new Set;boxMatrix=null;boxInverseMatrix=null;boxCenter=null;boxOrientation=null;targetZPlus=0;targetZMinus=0;targetXPlus=0;targetXMinus=0;targetYPlus=0;targetYMinus=0;currentPlaneType="";selectedPlane=null;hoveredPlane=null;dragStartPoint=null;moveCallBack=null;downHandler=null;upHandler=null;moveHandler=null;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}attachTileset(e,t){this.tilesetMap[t]=e}open(e,t){!this.tilesetMap[e]||this.activeModelIds.has(e)||(this.activeModelIds.add(e),this.moveCallBack=t?.moveCallBack,this.fitToModels(),this.activeModelIds.size===1&&(this.createPlaneEntities(),this.initEventHandlers()))}setupClippingPlanes(e){const t=this.cesium,i=this.tilesetMap[e];if(!i||!this.boxMatrix)return;const s=new t.ClippingPlaneCollection({planes:[new t.ClippingPlane(new t.Cartesian3(1,0,0),this.targetXMinus),new t.ClippingPlane(new t.Cartesian3(-1,0,0),this.targetXPlus),new t.ClippingPlane(new t.Cartesian3(0,1,0),this.targetYMinus),new t.ClippingPlane(new t.Cartesian3(0,-1,0),this.targetYPlus),new t.ClippingPlane(new t.Cartesian3(0,0,1),this.targetZMinus),new t.ClippingPlane(new t.Cartesian3(0,0,-1),this.targetZPlus)],edgeWidth:2,edgeColor:t.Color.WHITE,enabled:!0,unionClippingRegions:!0}),o=t.Matrix4.inverse(i.root.transform,new t.Matrix4);s.modelMatrix=t.Matrix4.multiply(o,this.boxMatrix,new t.Matrix4),i.clippingPlanes=s,this.clippingPlanesMap[e]=s}createPlaneEntities(){const e=this.cesium,t=this.viewer;this.planeEntities.forEach(s=>t.entities.remove(s)),this.planeEntities=[];const i=["left","right","behind","front","top","down"];for(const s of i){const o=t.entities.add({name:s,position:new e.CallbackProperty(()=>{if(!this.boxMatrix)return e.Cartesian3.ZERO;const r=this.getPlaneOffsetCartesian(s);return e.Matrix4.multiplyByPoint(this.boxMatrix,r,new e.Cartesian3)},!1),orientation:new e.CallbackProperty(()=>this.boxOrientation||e.Quaternion.IDENTITY,!1),plane:{dimensions:new e.CallbackProperty(()=>{if(this.activeModelIds.size===0)return new e.Cartesian2(0,0);const r=.1,l=Math.max(r,this.targetXMinus+this.targetXPlus),a=Math.max(r,this.targetYPlus+this.targetYMinus),c=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(l,a):s==="left"||s==="right"?new e.Cartesian2(a,c):new e.Cartesian2(l,c)},!1),material:e.Color.WHITE.withAlpha(.1),outline:!0,outlineColor:e.Color.YELLOW,plane:new e.CallbackProperty(()=>new e.Plane(this.getNormalByType(s),0),!1)}});this.planeEntities.push(o)}}getPlaneOffsetCartesian(e){const t=(this.targetXPlus-this.targetXMinus)/2,i=(this.targetYPlus-this.targetYMinus)/2,s=(this.targetZPlus-this.targetZMinus)/2;switch(e){case"left":return new this.cesium.Cartesian3(-this.targetXMinus,i,s);case"right":return new this.cesium.Cartesian3(this.targetXPlus,i,s);case"behind":return new this.cesium.Cartesian3(t,-this.targetYMinus,s);case"front":return new this.cesium.Cartesian3(t,this.targetYPlus,s);case"top":return new this.cesium.Cartesian3(t,i,this.targetZPlus);case"down":return new this.cesium.Cartesian3(t,i,-this.targetZMinus);default:return this.cesium.Cartesian3.ZERO}}getNormalByType(e){const t=this.cesium;switch(e){case"left":return new t.Cartesian3(1,0,0);case"right":return new t.Cartesian3(-1,0,0);case"behind":return new t.Cartesian3(0,1,0);case"front":return new t.Cartesian3(0,-1,0);case"top":return new t.Cartesian3(0,0,-1);case"down":return new t.Cartesian3(0,0,1);default:return t.Cartesian3.UNIT_X}}getPlaneByType(e){const t=this.cesium,i=this.getNormalByType(e),s=t.Cartesian3.negate(i,new t.Cartesian3);let o=0;switch(e){case"left":o=this.targetXMinus;break;case"right":o=this.targetXPlus;break;case"behind":o=this.targetYMinus;break;case"front":o=this.targetYPlus;break;case"top":o=this.targetZPlus;break;case"down":o=this.targetZMinus;break}return new t.Plane(s,-o)}initEventHandlers(){const e=this.cesium,t=this.viewer.scene.canvas,i=this.viewer.scene;this.downHandler=new e.ScreenSpaceEventHandler(t),this.upHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler.setInputAction(s=>{if(this.selectedPlane)return;let o;try{o=i.pick(s.endPosition)}catch{}e.defined(o)&&o.id&&o.id.plane?this.hoveredPlane!==o.id.plane&&(this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1)),this.hoveredPlane=o.id.plane,this.hoveredPlane.material=e.Color.YELLOW.withAlpha(.3),t.style.cursor="pointer"):this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1),this.hoveredPlane=null,t.style.cursor="default")},e.ScreenSpaceEventType.MOUSE_MOVE),this.downHandler.setInputAction(s=>{let o;try{o=i.pick(s.position)}catch{}if(e.defined(o)&&o.id&&o.id.plane){this.currentPlaneType=o.id.name,this.selectedPlane=o.id.plane,this.selectedPlane.material=e.Color.RED.withAlpha(.4),i.screenSpaceCameraController.enableInputs=!1;const r=i.camera.getPickRay(s.position),l=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(l,r.origin,new e.Cartesian3),c=e.Matrix4.multiplyByPointAsVector(l,r.direction,new e.Cartesian3);e.Cartesian3.normalize(c,c);const u=new e.Ray(a,c),h=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(u,h,new e.Cartesian3),this.dragStartPoint||(this.dragStartPoint=this.getPlaneOffsetCartesian(this.currentPlaneType))}},e.ScreenSpaceEventType.LEFT_DOWN),this.moveHandler.setInputAction(s=>{if(!this.selectedPlane||!this.dragStartPoint)return;const o=i.camera.getPickRay(s.endPosition),r=this.boxInverseMatrix,l=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),a=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(a,a);const c=new e.Ray(l,a);let u=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?u=Math.abs(a.x)>Math.abs(a.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?u=Math.abs(a.y)>Math.abs(a.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:u=Math.abs(a.x)>Math.abs(a.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const h=-e.Cartesian3.dot(this.dragStartPoint,u),f=new e.Plane(u,h);let p=e.IntersectionTests.rayPlane(c,f,new e.Cartesian3);if(!p){const C=u===e.Cartesian3.UNIT_X?e.Cartesian3.UNIT_Y:u===e.Cartesian3.UNIT_Y&&(this.currentPlaneType==="top"||this.currentPlaneType==="down")?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z,m=-e.Cartesian3.dot(this.dragStartPoint,C);p=e.IntersectionTests.rayPlane(c,new e.Plane(C,m),new e.Cartesian3)}if(!p)return;const A=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+A,-p.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+A,p.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+A,-p.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+A,p.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+A,p.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+A,-p.z);break}this.syncClippingPlanes(),this.moveCallBack&&this.moveCallBack(this.getRangeParams())},e.ScreenSpaceEventType.MOUSE_MOVE),this.upHandler.setInputAction(()=>{this.selectedPlane&&(this.selectedPlane.material=e.Color.WHITE.withAlpha(.1),this.selectedPlane=null,this.currentPlaneType="",this.dragStartPoint=null),i.screenSpaceCameraController.enableInputs=!0,t.style.cursor="default"},e.ScreenSpaceEventType.LEFT_UP)}syncClippingPlanes(){this.activeModelIds.size!==0&&Object.keys(this.clippingPlanesMap).forEach(e=>{const t=this.clippingPlanesMap[e],i=this.tilesetMap[e];if(t&&i&&!t.isDestroyed()){const s=this.cesium;t.get(0).distance=this.targetXMinus,t.get(1).distance=this.targetXPlus,t.get(2).distance=this.targetYMinus,t.get(3).distance=this.targetYPlus,t.get(4).distance=this.targetZMinus,t.get(5).distance=this.targetZPlus;const o=s.Matrix4.inverse(i.root.transform,new s.Matrix4);t.modelMatrix=s.Matrix4.multiply(o,this.boxMatrix,new s.Matrix4)}})}fitToModels(){const e=this.cesium;if(this.activeModelIds.size===0)return;let t=[];if(this.activeModelIds.forEach(h=>{const f=this.tilesetMap[h];f&&f.boundingSphere&&t.push(f.boundingSphere.center)}),t.length===0)return;const i=new e.Cartesian3;t.forEach(h=>e.Cartesian3.add(i,h,i)),this.boxCenter=e.Cartesian3.divideByScalar(i,t.length,new e.Cartesian3),this.boxMatrix=e.Transforms.eastNorthUpToFixedFrame(this.boxCenter),this.boxInverseMatrix=e.Matrix4.inverse(this.boxMatrix,new e.Matrix4),this.boxOrientation=e.Quaternion.fromRotationMatrix(e.Matrix4.getMatrix3(this.boxMatrix,new e.Matrix3));let s=1/0,o=-1/0,r=1/0,l=-1/0,a=1/0,c=-1/0;this.activeModelIds.forEach(h=>{const f=this.tilesetMap[h];if(!f)return;const p=[],A=f.leiting?.box,C=f.root?.boundingVolume?.boundingVolume;if(A&&A.min&&A.max){const{min:m,max:y}=A,E=[new e.Cartesian3(m.x,m.y,m.z),new e.Cartesian3(y.x,m.y,m.z),new e.Cartesian3(m.x,y.y,m.z),new e.Cartesian3(y.x,y.y,m.z),new e.Cartesian3(m.x,m.y,y.z),new e.Cartesian3(y.x,m.y,y.z),new e.Cartesian3(m.x,y.y,y.z),new e.Cartesian3(y.x,y.y,y.z)],I=f.root.transform;E.forEach(M=>{p.push(e.Matrix4.multiplyByPoint(I,M,new e.Cartesian3))})}else if(C&&C.halfAxes){const m=C.center,y=C.halfAxes,E=e.Matrix3.getColumn(y,0,new e.Cartesian3),I=e.Matrix3.getColumn(y,1,new e.Cartesian3),M=e.Matrix3.getColumn(y,2,new e.Cartesian3);for(let k=0;k<8;k++){const S=e.Cartesian3.clone(m,new e.Cartesian3);e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(E,k&1?1:-1,new e.Cartesian3),S),e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(I,k&2?1:-1,new e.Cartesian3),S),e.Cartesian3.add(S,e.Cartesian3.multiplyByScalar(M,k&4?1:-1,new e.Cartesian3),S),p.push(S)}}else if(f.boundingSphere){const m=f.boundingSphere,y=m.center,E=m.radius,I=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,y,new e.Cartesian3);s=Math.min(s,I.x-E),o=Math.max(o,I.x+E),r=Math.min(r,I.y-E),l=Math.max(l,I.y+E),a=Math.min(a,I.z-E),c=Math.max(c,I.z+E)}p.forEach(m=>{const y=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,m,new e.Cartesian3);s=Math.min(s,y.x),o=Math.max(o,y.x),r=Math.min(r,y.y),l=Math.max(l,y.y),a=Math.min(a,y.z),c=Math.max(c,y.z)})});const u=1.01;this.targetXMinus=Math.abs(s)*u,this.targetXPlus=Math.abs(o)*u,this.targetYMinus=Math.abs(r)*u,this.targetYPlus=Math.abs(l)*u,this.targetZMinus=Math.abs(a)*u,this.targetZPlus=Math.abs(c)*u,this.activeModelIds.forEach(h=>{this.setupClippingPlanes(h)}),this.viewer.scene.requestRender()}getRangeParams(){const e=this.cesium;return{targetZPlus:this.targetZPlus,targetZMinus:this.targetZMinus,targetXPlus:this.targetXPlus,targetXMinus:this.targetXMinus,targetYPlus:this.targetYPlus,targetYMinus:this.targetYMinus,maxBox:new e.Cartesian3(this.targetXPlus,this.targetYPlus,this.targetZPlus),minBox:new e.Cartesian3(-this.targetXMinus,-this.targetYMinus,-this.targetZMinus)}}updateRange(e){if(!this.boxMatrix)return;e.targetXMinus!==void 0&&(this.targetXMinus=e.targetXMinus),e.targetXPlus!==void 0&&(this.targetXPlus=e.targetXPlus),e.targetYMinus!==void 0&&(this.targetYMinus=e.targetYMinus),e.targetYPlus!==void 0&&(this.targetYPlus=e.targetYPlus),e.targetZPlus!==void 0&&(this.targetZPlus=e.targetZPlus),e.targetZMinus!==void 0&&(this.targetZMinus=e.targetZMinus);const t=.1;this.targetXMinus+this.targetXPlus<t&&(this.targetXPlus=t-this.targetXMinus),this.targetYPlus+this.targetYMinus<t&&(this.targetYPlus=t-this.targetYMinus),this.targetZPlus+this.targetZMinus<t&&(this.targetZPlus=t-this.targetZMinus),this.syncClippingPlanes(),this.viewer.scene.requestRender()}getRange(){return this.getRangeParams()}setBoxVisibility(e){this.planeEntities.forEach(t=>{t.show=e}),this.viewer.scene.requestRender()}close(e){if(e){const t=this.tilesetMap[e];t&&(t.clippingPlanes&&(t.clippingPlanes.enabled=!1),t.clippingPlanes=void 0),delete this.clippingPlanesMap[e],this.activeModelIds.delete(e),this.activeModelIds.size>0&&this.fitToModels()}else Object.keys(this.clippingPlanesMap).forEach(t=>{const i=this.tilesetMap[t];i&&(i.clippingPlanes&&(i.clippingPlanes.enabled=!1),i.clippingPlanes=void 0)}),this.clippingPlanesMap={},this.activeModelIds.clear();this.activeModelIds.size===0&&(this.planeEntities.forEach(t=>{this.viewer.entities.remove(t)}),this.planeEntities=[],this.destroyEventHandlers(),this.boxMatrix=null,this.boxInverseMatrix=null),this.viewer.scene.requestRender()}destroyEventHandlers(){this.downHandler?.destroy(),this.upHandler?.destroy(),this.moveHandler?.destroy(),this.downHandler=this.upHandler=this.moveHandler=null}}let _s=performance.now();const Hg=10;class Gg{cesium;viewer;modelInfo={modelName:"Person",modelId:"player_111",url:"person/model.glb",scale:.0032};startTime=0;radian=0;speed=.1;speedVector;position;hpRoll;cameralHpRoll;fixedFrameTransforms;model;transparentTest=!0;gravityTestByMove=!1;gravityTest=!0;lastMoveTime=0;moveInterval=.01;collisionTest=!0;wheelCount=2;isLeftDragging=!1;lastScreenY=0;lastScreenX=0;pauseAnimationFn;resumeAnimationFn;selectedColor;selectedColorRecover;handler;moveState={moveFront:!1,moveBack:!1,moveLeft:!1,moveRight:!1,moveUp:!1,moveDown:!1};onLoading=null;onSuccess=null;onError=null;constructor({cesium:e,viewer:t,modelInfo:i,callbacks:s}){this.cesium=e,this.viewer=t,this.radian=this.cesium.Math.toRadians(4),this.speedVector=new this.cesium.Cartesian3,this.position=new this.cesium.Cartesian3,this.hpRoll=new this.cesium.HeadingPitchRoll,this.cameralHpRoll=new this.cesium.HeadingPitchRoll,this.fixedFrameTransforms=new this.cesium.Transforms.localFrameToFixedFrameGenerator("north","west"),i&&(this.modelInfo=Object.assign(this.modelInfo,i)),s&&(this.onLoading=s.onLoading||null,this.onSuccess=s.onSuccess||null,this.onError=s.onError||null),this.selectedColor=new this.cesium.Color(1,1,1,.4),this.selectedColorRecover=new this.cesium.Color(1,1,1,1);const o=this.viewer.scene.canvas;this.handler=new this.cesium.ScreenSpaceEventHandler(o)}getModel(){return this.model}setPauseAnimation(e){this.pauseAnimationFn=e}setResumeAnimationFn(e){this.resumeAnimationFn=e}async setPersonPosition(e){e&&(this.position=e),this.getModel()?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(e,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.model.show=!0,this.initKeyBoard()):await this.openPlayer(),this.setCameralDefault(!1)}setModelInfo(e){e&&(this.modelInfo=Object.assign(this.modelInfo,e))}async openPlayer(){if(this.enablePositionSelection(),this.model){this.model.show=!0,this.initKeyBoard(),this.setCameralDefault(!1);return}this.position&&!(this.position.x===0&&this.position.y===0&&this.position.z===0)?(await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)):this.onLoading&&this.onLoading("请按住 Ctrl + 左键点击场景选择初始位置...")}enablePositionSelection(){this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null);const e=new this.cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);e.setInputAction(async t=>{const i=this.viewer.scene;let s;try{s=i.pickPosition(t.position)}catch(o){console.warn("pickPosition failed:",o)}s&&(this.position=s,this.model?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.updatedCamera(),this.onSuccess&&this.onSuccess("已更新漫游位置")):(this.onSuccess&&this.onSuccess("位置已选择,正在加载模型..."),await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)))},this.cesium.ScreenSpaceEventType.LEFT_CLICK,this.cesium.KeyboardEventModifier.CTRL),this._positionHandler=e}_positionHandler;setDefaultPosition(){const e=this.viewer.scene,t=this.viewer.camera,i=new this.cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2);let s;try{s=e.pickPosition(i)}catch(o){console.warn("pickPosition failed:",o)}if(s)this.position=s;else{const o=t.direction,l=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=l}}async loadModel(){let e;try{this.onLoading&&this.onLoading("正在加载漫游人物...");const t=await this.cesium.Model.fromGltfAsync({id:this.modelInfo.modelId,url:this.modelInfo.url,modelMatrix:this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),scale:this.modelInfo.scale,allowPicking:!1,debugShowBoundingVolume:!1,debugWireframe:!1,cull:!1,gltfCallback:s=>{e=s.animations},backFaceCulling:!1}),i=()=>{if(e&&e.length>0){console.log("Model has animations:",e.length);try{t.activeAnimations.add({index:0,loop:this.cesium.ModelAnimationLoop.REPEAT,multiplier:1})}catch(s){console.error("Failed to add animation:",s)}this.pauseAnimationFn=()=>{this.viewer.clock.shouldAnimate=!1},this.resumeAnimationFn=()=>{this.viewer.clock.shouldAnimate=!0},this.viewer.clock.shouldAnimate=!1}else console.warn("No animations found in the model.")};t.ready?i():t.readyEvent.addEventListener(i),this.model=await this.viewer.scene.primitives.add(t),this.updatedCamera(),this.onLoading&&this.onLoading(""),this.onSuccess&&this.onSuccess("漫游模型加载完成")}catch(t){console.error("Failed to load model:",t),this.onLoading&&this.onLoading(""),this.onError&&this.onError("漫游模型加载失败")}}initKeyBoard(){const e=this.handler,t=this.cesium;_s=performance.now();const i=(o,r)=>{const l=o.code,a=o.keyCode;l==="KeyA"||a===65?this.moveState.moveLeft=r:l==="KeyW"||a===87?this.moveState.moveFront=r:l==="KeyD"||a===68?this.moveState.moveRight=r:l==="KeyS"||a===83?this.moveState.moveBack=r:l==="KeyQ"||a===81?this.moveState.moveUp=r:(l==="KeyE"||a===69)&&(this.moveState.moveDown=r)};e.setInputAction(o=>{this.wheelCount-=o*.001,this.wheelCount<.1&&(this.wheelCount=.1),this.updatedCamera()},t.ScreenSpaceEventType.WHEEL),this._keydownHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(i(o,!0),this.resumeAnimationFn&&this.resumeAnimationFn())},this._keyupHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(i(o,!1),Object.keys(this.moveState).every(r=>this.moveState[r]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())},document.addEventListener("keydown",this._keydownHandler),document.addEventListener("keyup",this._keyupHandler),e.setInputAction(o=>{this.isLeftDragging=!0,this.lastScreenY=o.position.y,this.lastScreenX=o.position.x},this.cesium.ScreenSpaceEventType.LEFT_DOWN),e.setInputAction(o=>{if(!this.isLeftDragging)return;const r=o.endPosition.x,l=o.endPosition.y,a=l-this.lastScreenY,c=r-this.lastScreenX;Math.abs(a)<Math.abs(c)&&(c>0?(this.cameralHpRoll.heading+=this.radian,this.hpRoll.heading+=this.radian):(this.cameralHpRoll.heading-=this.radian,this.hpRoll.heading-=this.radian),s(0),this.lastScreenX=r),this.lastScreenY=l;const u=this.viewer.camera;this.cameralHpRoll.pitch=u.pitch+this.cesium.Math.toRadians(-a*.1),this.updatedCamera()},t.ScreenSpaceEventType.MOUSE_MOVE),e.setInputAction(()=>{this.isLeftDragging&&(this.isLeftDragging=!1)},t.ScreenSpaceEventType.LEFT_UP);const s=o=>{const r=performance.now();if(r-_s<Hg)return;_s=r;const l=1.75;if(o===1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,-this.speed,this.speedVector),this.gravityTestByMove=!0):o===0?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,0,this.speedVector),this.gravityTestByMove=!1):o===2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,.05,this.speedVector),this.gravityTestByMove=!1):o===-2&&(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,-.05,this.speedVector),this.gravityTestByMove=!1),!this.viewer||!this.model)return;const a=(u,h)=>new this.cesium.Ray(u,h),c=new this.cesium.Cartesian3;if(this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,c),this.cesium.Cartesian3.normalize(c,c),Math.abs(o)!=2&&this.collisionTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,l),u),f=a(h,c),p=this.viewer.scene.pickFromRay(f,[this.model],1);if(p&&p.position&&this.cesium.Cartesian3.distance(h,p.position)<.9&&o===1)return}if(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,this.speedVector,this.position),this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.gravityTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=.5,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,h),u),p=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,f,p),this.cesium.Cartesian3.normalize(p,p);const A=a(f,p),C=this.viewer.scene.pickFromRay(A,[this.model],1),m=l,y=this.cesium.Cartesian3.add(f,this.cesium.Cartesian3.multiplyByScalar(c,m,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(C)){const E=t.Cartesian3.distance(f,C.position);E-h>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),E-h<-.1&&E<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!C&&this.gravityTestByMove){const E=a(this.position,p),I=this.viewer.scene.pickFromRay(E,[this.model],1);if(I){const M=this.cesium.Cartesian3.distance(this.position,I.position);Math.abs(M-1)>.05&&M<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(C&&this.gravityTestByMove&&this.gravityTest){const E=this.cesium.Cartesian3.distance(y,C.position);Math.abs(E-l)>.1&&(this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,(l-E)/Math.abs(l-E)*.05),this.position))}}if(this.transparentTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),h=1.75,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,h),u),p=this.viewer.camera.positionWC,A=f,C=t.Cartesian3.subtract(A,p,new t.Cartesian3),m=t.Cartesian3.distance(f,p),y=t.Cartesian3.normalize(C,new t.Cartesian3),E=new t.Ray(p,y);let I;try{I=this.viewer.scene.pickFromRay(E,void 0,1)}catch{}t.defined(I)&&I.primitive!==this.model&&I.position&&t.Cartesian3.distance(p,I.position)<m&&(this.wheelCount-=.1,this.wheelCount<.1&&(this.wheelCount=.1))}this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.updatedCamera()};this._tickHandler=()=>{const o=performance.now()/1e3;(o-this.lastMoveTime>=this.moveInterval||this.lastMoveTime==0)&&(this.moveState.moveFront?(this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian),s(1)):this.moveState.moveBack?(this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian),s(-1)):(this.moveState.moveUp&&s(2),this.moveState.moveDown&&s(-2),this.moveState.moveLeft&&(this.hpRoll.heading-=this.radian,this.cameralHpRoll.heading-=this.radian,s(0)),this.moveState.moveRight&&(this.hpRoll.heading+=this.radian,this.cameralHpRoll.heading+=this.radian,s(0))),this.lastMoveTime=o)},this.viewer.clock.onTick.addEventListener(this._tickHandler)}updatedCamera(){if(!this.model)return;const e=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),t=1.75,i=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,t),e);this.viewer.camera.viewBoundingSphere(new this.cesium.BoundingSphere(i,this.wheelCount),this.cameralHpRoll)}_keydownHandler;_keyupHandler;_tickHandler;_uiEventListeners=[];bindUiKeys(e){this.unbindUiKeys(),Object.entries(e).forEach(([t,i])=>{if(!i)return;const s=()=>this.setMoveState(t,!0),o=()=>this.setMoveState(t,!1);i.addEventListener("mousedown",s),i.addEventListener("mouseup",o),i.addEventListener("mouseleave",o),i.addEventListener("touchstart",r=>{r.preventDefault(),s()}),i.addEventListener("touchend",r=>{r.preventDefault(),o()}),this._uiEventListeners.push(()=>{i.removeEventListener("mousedown",s),i.removeEventListener("mouseup",o),i.removeEventListener("mouseleave",o),i.removeEventListener("touchstart",s),i.removeEventListener("touchend",o)})})}unbindUiKeys(){this._uiEventListeners.forEach(e=>e()),this._uiEventListeners=[]}closePlayer(){const e=this.cesium;this.model&&(this.model.show=!1),this.setCameralDefault(!0),this.handler&&(this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN),this.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP),this.handler.removeInputAction(e.ScreenSpaceEventType.WHEEL)),this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null),this._keydownHandler&&document.removeEventListener("keydown",this._keydownHandler),this._keyupHandler&&document.removeEventListener("keyup",this._keyupHandler),this._tickHandler&&this.viewer.clock.onTick.removeEventListener(this._tickHandler),this.unbindUiKeys(),this.viewer.camera.lookAtTransform(e.Matrix4.IDENTITY),this.onLoading&&this.onLoading("")}setSpeed({speed:e}){this.speed=e/50}setParams({gravityTest:e,collisionTest:t,transparentTest:i}){e!==void 0&&(this.gravityTest=e),t!==void 0&&(this.collisionTest=t),i!==void 0&&(this.transparentTest=i)}setMoveState(e,t){this.moveState.hasOwnProperty(e)&&(this.moveState[e]=t,t?this.resumeAnimationFn&&this.resumeAnimationFn():Object.keys(this.moveState).every(i=>this.moveState[i]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())}setCameralDefault(e){const t=this.viewer;t.scene.screenSpaceCameraController.enableRotate=e,t.scene.screenSpaceCameraController.enableTranslate=e,t.scene.screenSpaceCameraController.enableZoom=e,t.scene.screenSpaceCameraController.enableLook=e,t.scene.screenSpaceCameraController.enableTilt=e}}class Yg{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new cd(e),this.baseTiles=new ka(e),this.baseCompt=new _g(e),this.baseSection=new Qg(e),this.basePlayer=new Gg({cesium:e.cesium,viewer:e.viewer,modelInfo:{url:e.options?.playerUrl,modelName:e.options?.playerModelName,modelId:e.options?.playerModelId,scale:e.options?.playerScale},callbacks:e.callbacks})}getCesium(){return this.cesium}getViewer(){return this.viewer}setSceneOptions(...e){this.baseCesium.setSceneOptions(...e)}getSnapDomSImageBase64(...e){return this.baseCesium.getSnapDomSImageBase64(...e)}clearBackground(){this.baseCesium.clearBackground()}enableTestLabel(){this.baseCesium.enableTestLabel()}enableCesiumFXAA(e){this.baseCesium.enableCesiumFXAA(e)}updateModelEffect(e){this.baseCesium.updateModelEffect(e)}addModels(...e){return this.baseTiles.addModels(...e)}}class Vg{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new gi;showGlobal=!0;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}flyToCadModel(e={}){const t=e.modelId||this.modelId,i=this.dxfModelsList.find(s=>s.modelId===t);i&&this.flyToBounds(i)}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.dxfModelsList}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.dxfModelsList.find(i=>i.modelId===t):this.dxfModelsList}showJson({modelId:e,show:t}){this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})});const i=this.dxfModelsList.find(s=>s.modelId===e);i&&(i.show=t)}showJsonByLayer({modelId:e,show:t,layers:i}){const s=this.dxfModelsList.find(r=>r.modelId===e);if(!s){console.error("Tileset not found for modelId:",e);return}s.hiddenBatchIds||(s.hiddenBatchIds=new Set),s.layerMap&&Array.isArray(i)&&i.forEach(r=>{const l=s.layerMap[r];l!==void 0&&(t?s.hiddenBatchIds.delete(l):s.hiddenBatchIds.add(l))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(l=>`\${_BATCHID} !== ${l}`).join(" && ");s.style=new this.cesium.Cesium3DTileStyle({show:r})}else s.style=new this.cesium.Cesium3DTileStyle({show:!0});s.hasVisibilityListener||(s.hasVisibilityListener=!0,s.tileVisible.addEventListener(r=>{const l=r.content,a=l.featuresLength;if(a>0&&s.hiddenBatchIds)for(let c=0;c<a;c++)s.hiddenBatchIds.has(c)?l.getFeature(c).show=!1:l.getFeature(c).show=!0}))}flyToBounds(e,t){const i=this.cesium,s=e.boundingSphere?.radius||1e3,o={offset:new i.HeadingPitchRange(0,i.Math.toRadians(-90),s*.5),...t},r=o.duration??0;this.viewer.flyTo(e,{duration:r,offset:o.offset})}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const i=await t.blob(),s=new wa(new Ts(i),{password:"abc!?123",useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const l=await r.arrayBuffer({useWebWorkers:!1});await s.close();const a=new TextDecoder().decode(l);return JSON.parse(a.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}async addDxfModel({fileNames:e,options:t}){const i=this.renderGenAll;if(e?.length){for(const s of e){if(this.renderGenAll!==i)return;const o=this.renderGenByModel[s.modelId]||0;if((this.renderGenByModel[s.modelId]||0)!==o)return;const r=`${s.outPutPath}${s.dbName}/tileset.json`,l={...this.options,...t};try{const a=`${s.outPutPath}${s.dbName}/layerInfo.zip`,c=await this.loadModelFile(a);if(this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;const u=await this.cesium.Cesium3DTileset.fromUrl(r);if(u.maximumScreenSpaceError=0,this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(u,{modelId:s.modelId,modelName:s.modelName,deltaLatitude:s.deltaLatitude||0,deltaLongitude:s.deltaLongitude||0,relocated:!0,dbName:s.dbName,outPutPath:s.outPutPath,totalRotation:s.totalRotation||0,layerInfo:c}),s.formData?u.formData=s.formData:u.formData={modelId:u.modelId,longitude:u.deltaLongitude,latitude:u.deltaLatitude,distance:1e-6,rotation:0,totalRotation:u.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:u.modelId,label:u.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...u.formData,tileset:u}),Array.isArray(c)){const h=c;u.layerMap={};let f=this.mapLayers[s.modelId];f||(f={},this.mapLayers[s.modelId]=f),h.forEach(p=>{u.layerMap[p.layerName]=p.batchId,f[p.layerName]||(f[p.layerName]=[]),f[p.layerName].push({batchId:p.batchId,color:p.layerColor})})}if(this.dxfModelsList.push(u),this.setModelId(s.modelId),this.viewer.scene.primitives.add(u),this.renderGenAll!==i||(this.renderGenByModel[s.modelId]||0)!==o)return;l.flyTo&&this.flyToBounds(u),l.onSuccess&&l.onSuccess(u)}catch(a){console.error(`Failed to load tileset or layer info: ${r}`,a)}}this.events.emit("mountAllCad",this.dxfModelsList)}}adjustingModelByCad(e){const t=this.cesium,i=t.Quaternion.fromAxisAngle(t.Cartesian3.UNIT_Z,t.Math.toRadians(e.totalRotation)),s=t.Matrix4.fromRotationTranslation(t.Matrix3.fromQuaternion(i),new t.Cartesian3(0,0,0)),o=t.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),r=t.Transforms.eastNorthUpToFixedFrame(o);t.Matrix4.multiply(r,s,r),e.tileset?._root&&(e.tileset._root.transform=r)}deleteCad({modelId:e}){this.mapLayers[e]&&(Object.values(this.mapLayers[e]).forEach(i=>{i.forEach(s=>{this.viewer.scene.primitives.remove(s.primitive),s.primitive?.destroy()})}),delete this.mapLayers[e]),this.renderGen[e]=(this.renderGen[e]||0)+1,this.renderGenByModel[e]=(this.renderGenByModel[e]||0)+1;const t=this.dxfModelsList.findIndex(i=>i.modelId===e);if(t>-1){const i=this.dxfModelsList[t];this.viewer.scene.primitives.remove(i),i.destroy&&!i.isDestroyed()&&i.destroy(),this.dxfModelsList.splice(t,1)}}deleteAllCad(){Object.keys(this.mapLayers).forEach(e=>{this.deleteCad({modelId:e})}),[...this.dxfModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}class At{constructor(e,t){if(this.viewer=e,!this.viewer)return;this.type="prompt",t=t||{};const i=t.type==null?1:t.type;let s={id:new Date().getTime()+""+Math.floor(Math.random()*1e4),type:i,anchor:i==2,closeBtn:i==2,offset:i==2?{x:0,y:-20}:{x:10,y:10},content:"",show:!0,style:{background:"rgba(0,0,0,0.5)",color:"white"}};this.opt=Object.assign(s,t),this.attr=this.opt;const o=this.viewer.container.id;this.isShow=this.opt.show==null?!0:this.opt.show;let r="",l="";const a=this.opt.style.background,c=this.opt.style.color;this.opt.anchor&&(r+=`
82
82
  <div class="prompt-anchor-container">
83
83
  <div class="prompt-anchor" style="background:${a} !important;">
84
84
  </div>
@@ -94,7 +94,7 @@
94
94
  ${r}
95
95
  <!-- 关闭按钮 -->
96
96
  ${l}
97
- `;this.promptDiv=window.document.createElement("div"),this.promptDiv.className=`easy3d-prompt ${this.opt.className}`,this.promptDiv.id=h,this.promptDiv.innerHTML=f,window.document.getElementById(o).appendChild(this.promptDiv);const A=window.document.getElementById(`prompt-close-${this.opt.id}`);let C=this;A&&A.addEventListener("click",m=>{C.hide(),C.opt.close&&C.opt.close()}),this.promptDom=window.document.getElementById(h),this.position=this.transPosition(this.opt.position),i==2&&this.bindRender(),this.opt.show==!1&&this.hide(),this.containerW=this.viewer.container.offsetWidth,this.containerH=this.viewer.container.offsetHeight,this.containerLeft=this.viewer.container.offsetLeft,this.containerTop=this.viewer.container.offsetTop,this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,this.opt.success&&this.opt.success()}destroy(){this.promptDiv&&(window.document.getElementById(this.viewer.container.id).removeChild(this.promptDiv),this.promptDiv=null),this.rendHandler&&(this.rendHandler(),this.rendHandler=null)}bindRender(){let e=this;this.rendHandler=this.viewer.scene.postRender.addEventListener(function(){if(!e.isShow&&e.promptDom){e.promptDom.style.display="none";return}if(e.position)if(e.position instanceof Cesium.Cartesian3){let t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(e.viewer.scene,e.position);if(!t)return;new Cesium.EllipsoidalOccluder(e.viewer.scene.globe.ellipsoid,e.viewer.scene.camera.position).isPointVisible(e.position)?e.promptDom&&(e.promptDom.style.display="block"):e.promptDom&&(e.promptDom.style.display="none"),e.setByPX({x:t.x,y:t.y})}else e.setByPX({x:e.position.x,y:e.position.y})},this)}update(e,t){e instanceof Cesium.Cartesian3&&(this.position=e.clone(),e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e)),this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,e&&this.setByPX(e),t&&this.setContent(t)}isInView(){if(!this.position)return!1;let e=null;this.position instanceof Cesium.Cartesian2?e=this.position:e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,this.position);const i=new Cesium.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.position).isPointVisible(this.position);let s=!1;return e?(e.x>this.containerLeft&&e.x<this.containerLeft+this.containerW&&e.y>this.containerTop&&e.y<this.containerTop+this.containerH&&(s=!0),i&&s):s}setVisible(e){this.isInView(this.position)&&e?(this.isShow=!0,this.promptDom&&(this.promptDom.style.display="block")):(this.isShow=!1,this.promptDom&&(this.promptDom.style.display="none"))}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}setContent(e){let t=window.document.getElementById(`prompt-content-${this.opt.id}`);t.innerHTML=e}setByPX(e){e&&this.promptDom&&(this.promptDom.offsetWidth,this.promptDom.offsetHeight,this.opt.type==1?(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)+"px"):(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)-Number(this.contentW)/2+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)-Number(this.contentH)+"px"))}transPosition(e){let t;return Array.isArray(e)?t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0).clone():e instanceof Cesium.Cartesian3?t=e.clone():t=e,t}}const Oa=Object.freeze(Object.defineProperty({__proto__:null,default:At},Symbol.toStringTag,{value:"Module"}));let ce={};ce.cartesianToLnglat=function(n,e){if(!n)return[];var t=Cesium.Cartographic.fromCartesian(n),i=Cesium.Math.toDegrees(t.latitude),s=Cesium.Math.toDegrees(t.longitude),o=t.height;return[s,i,o]},ce.getViewCenter=n=>{if(n){var e=n.camera.computeViewRectangle(),t=e.west/Math.PI*180,i=e.north/Math.PI*180,s=e.east/Math.PI*180,o=e.south/Math.PI*180;return[(s+t)/2,(i+o)/2]}},ce.cartesiansToLnglats=function(n,e){if(!(!n||n.length<1)){if(e=e||window.viewer,!e){console.log("util.cartesiansToLnglats方法缺少viewer对象");return}for(var t=[],i=0;i<n.length;i++)t.push(ce.cartesianToLnglat(n[i],e));return t}},ce.lnglatsToCartesians=function(n){if(!(!n||n.length<1)){for(var e=[],t=0;t<n.length;t++){var i=Cesium.Cartesian3.fromDegrees(n[t][0],n[t][1],n[t][2]||0);e.push(i)}return e}},ce.flyTo=function(n,e){if(!e){console.log("util.flyTo缺少viewer对象");return}n=n||{};let t=n.center;if(!t){console.log("缺少定位坐标!");return}if(t instanceof Cesium.Cartesian3&&e.camera.flyToBoundingSphere(new Cesium.BoundingSphere(t),{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(n.heading||0),Cesium.Math.toRadians(n.pitch||-60),n.range||1e4)}),t instanceof Array){var i=new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(t[0],t[1],t[2]));e.camera.flyToBoundingSphere(i,{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(n.heading||0),Cesium.Math.toRadians(n.pitch||-60),n.range||1e4)})}},ce.getCameraView=function(n){if(n=n||window.viewer,!n){console.log("util.getCameraView缺少viewer对象");return}var e=n.camera,t=e.position,i=e.heading,s=e.pitch,o=e.roll,r=Cesium.Cartographic.fromCartesian(t),l={x:Cesium.Math.toDegrees(r.longitude),y:Cesium.Math.toDegrees(r.latitude),z:r.height,heading:Cesium.Math.toDegrees(i),pitch:Cesium.Math.toDegrees(s),roll:Cesium.Math.toDegrees(o)};return l},ce.setCameraView=function(n,e){if(e=e||window.viewer,!e){console.log("util.setCameraView缺少viewer对象");return}if(n){var t=n.destination||Cesium.Cartesian3.fromDegrees(n.x,n.y,n.z);e.camera.flyTo({destination:t,orientation:{heading:Cesium.Math.toRadians(n.heading||0),pitch:Cesium.Math.toRadians(n.pitch||0),roll:Cesium.Math.toRadians(n.roll||0)},duration:n.duration===void 0?3:n.duration,complete:n.complete})}},ce.computeAreaOfTriangle=function(n,e,t){if(!n||!e||!t)return console.log("传入坐标有误!"),0;var i=Cesium.Cartesian3.distance(n,e),s=Cesium.Cartesian3.distance(e,t),o=Cesium.Cartesian3.distance(t,n),r=(i+s+o)/2;return Math.sqrt(r*(r-i)*(r-s)*(r-o))};class et{constructor(e,t){this.viewer=e,this.style=t||{},this.objId=+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0)),this.handler=void 0,this.modifyHandler=void 0,this.type="",this.positions=[],this.state=null,this.prompt=null,this.controlPoints=[],this.modifyPoint=null,this.entity=null,this.pointStyle={},this.promptStyle=this.style.prompt||{show:!0},this.properties={},this.clientScale=1}getCatesian3FromPX(e){if(e=this.transpx(e),this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){let o=this.viewer.camera.getPickRay(e),r=null;return o&&(r=this.viewer.scene.globe.pick(o,this.viewer.scene)),r||(r=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),r}let t=this.viewer.scene.drillPick(e);this.viewer.scene.render();let i,s=!1;for(let o=0;o<t.length;o++)if(t[o]&&t[o].primitive&&t[o].primitive instanceof Cesium.Cesium3DTileset){s=!0;break}if(s)i=this.viewer.scene.pickPosition(e);else{let o=this.viewer.camera.getPickRay(e);if(!o)return null;i=this.viewer.scene.globe.pick(o,this.viewer.scene)}return i}setClientScale(e){e=e||1,this.clientScale=e}transpx(e){return{x:e.x/(this.clientScale||1),y:e.y/(this.clientScale||1)}}getEntity(){return this.entity}getPositions(e){return e?ce.cartesiansToLnglats(this.positions,this.viewer):this.positions}getLnglats(){return ce.cartesiansToLnglats(this.positions,this.viewer)}setOwnProp(e){this.entity&&(this.entity.ownProp=e)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}setVisible(e){this.entity&&(this.entity.show=e)}forbidDrawWorld(e){this.viewer.scene.screenSpaceCameraController.enableRotate=!e,this.viewer.scene.screenSpaceCameraController.enableTilt=!e,this.viewer.scene.screenSpaceCameraController.enableTranslate=!e,this.viewer.scene.screenSpaceCameraController.enableInputs=!e}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.positions=[],this.style=null;for(var e=0;e<this.controlPoints.length;e++){var t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.modifyPoint=null,this.prompt&&(this.prompt.destroy(),this.prompt=null),this.state="no",this.forbidDrawWorld(!1)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this;for(let i=0;i<t.controlPoints.length;i++){let s=t.controlPoints[i];s&&(s.show=!0)}this.entity.show=!0,this.modifyHandler.setInputAction(function(i){if(!t.entity)return;let s=t.viewer.scene.pick(i.position);Cesium.defined(s)&&s.id&&(s.id.objId||(t.modifyPoint=s.id),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(t.positions.length<1||!t.modifyPoint)return;let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.position.setValue(s),t.positions[t.modifyPoint.wz]=s,t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(i){t.modifyPoint&&(t.modifyPoint=null,t.forbidDrawWorld(!1),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){for(let t=0;t<this.controlPoints.length;t++){let i=this.controlPoints[t];i&&(i.show=!1)}this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}endCreate(){}done(){}createPoint(e){if(!e)return;this.pointStyle.color=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE,this.pointStyle.outlineColor=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE;let t=this.pointStyle.color instanceof Cesium.Color?this.pointStyle.color:Cesium.Color.fromCssColorString(this.pointStyle.color);t=t.withAlpha(this.pointStyle.colorAlpha||1);let i=this.pointStyle.outlineColor instanceof Cesium.Color?this.pointStyle.outlineColor:Cesium.Color.fromCssColorString(this.pointStyle.outlineColor);return i=i.withAlpha(this.pointStyle.outlineColorAlpha||1),this.viewer.entities.add({position:e,point:{pixelSize:this.pointStyle.property||10,color:t,outlineWidth:this.pointStyle.outlineWidth||0,outlineColor:i,disableDepthTestDistance:Number.POSITIVE_INFINITY},show:!1})}transfromLineMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let i=e.color.getValue();t.colorAlpha=i.alpha,t.colorHex=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}return t}transfromGonMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let i=e.color.getValue();t.colorAlpha=i.alpha,t.colorHex=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}return t}setAttr(e){this.properties.attr=e||{}}getAttr(){return this.properties.attr}zoomTo(){this.entity&&this.viewer.zoomTo(this.entity)}}const Gg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAptJREFUOE+FVD1oU1EYvecVCU5acHFqsggKSlUcdDGZuvhToeAgYuIuaUcHMZ0c2+JuAg4dKrS6iFPiooMUAyqCS5PFTVpBKJKa4/nez817yateeOTm3vOd75zv3u/C5QySx50b3HMO89oupyBdzTvOHawBR3t5sRhfJH+tiqiu9X4UDJH80Tc169ywGCeZcY7CDZaB6b00hyckd6WKbW2WFLQoYCtPga0JW40I3Y6wt4T1alOE382OBuaBk7l20gnIHQkoyEFA5/YrQClUGhKS/YZ+FmVpVhuejNzXemhfwU4BWAUKywlxRBoYfguYkWohosXBruY14JS3Sf6Ik1CJpqRkaAe0ovSyeGJrRPrNiJr6ziu+K8LPCqBqdraYtdRPMms/GmRPxNiTGiP3g/ykcrELnKuKcNtAPeBCKHkU/EUKgw5wWvsJ4VcLFPbMGOG2HdBN4GJJhO9UVMju5VaacHxOfjClsux0AJd8kkj5+7LdEOAKRNgWoYEqGVBWbVvqoTpRiSsTicUhQidC0ZBvjFAXdE4WJwe5qUM7ovtmmGtmbWKQr0UYiHDOCF9JmdXwulTkgddj8O2JrkrQ5EuJQRW4URThhv2pAwvT+YTNotaLQO0fJXlhTaFTXrBTXlfA0CypPndy6vPU6nMVeOAvdDox+Tx0IA4V8G4n7pRnVht7XbRYi1swCiOfyIF7DDzMeUia1v8ftd8H7lvipPVs47dZOqb+1I2v+ReEbMSWGxnLZBgTPyYFK8molyMlK9aXpk6krgHU1/JqGmPN5qaipJplYMm7ytiISA9kn7LvevpVzwZSRmWnlAb6WNWeqX6r66SXacm78ZbHlahuChhaj1uL6TH146dmSsIW8ChTggRx6N06zO7/1v8CLeIaJJK0e+4AAAAASUVORK5CYII=";class Yg extends et{constructor(e,t){super(e,t),this.type="billboard",this.viewer=e;let i={verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1};this.style=Object.assign({},i,t||{}),this.entity=null,this.style.hasOwnProperty("image")||console.warn("CreateBillboard: 未在 style 中指定 image,后续将使用回退图或占位图。"),this.position=null,this._defaultFallback=Gg,this.prompt=null,this.modifyHandler=null,this._globalMouseUpHandler=null,this._isDragging=!1,this._editPickedEntity=null,this.controlPoints=[],this.modifyPoint=null,this._isScaling=!1,this._fileInput=null}_preloadImage(e,t=7e3){return new Promise((i,s)=>{if(!e)return s(new Error("empty url"));try{const o=new window.Image;o.crossOrigin="anonymous";let r=!1;const l=()=>{r||(r=!0,clearTimeout(c),i(o))},a=u=>{r||(r=!0,clearTimeout(c),s(new Error("image load error: "+e)))};o.onload=l,o.onerror=a;const c=setTimeout(()=>{r||(r=!0,o.onload=o.onerror=null,s(new Error("image load timeout: "+e)))},t);o.src=e}catch(o){s(o)}})}createBillboard(e){if(!e)return;const t=this.style.fallbackImage||this._defaultFallback,i=this.viewer.entities.add({position:e,billboard:{image:t,scale:this.style.scale||1,pixelOffset:this.style.pixelOffset,heightReference:this.style.heightReference==null?Cesium.HeightReference.CLAMP_TO_GROUND:Number(this.style.heightReference),verticalOrigin:Cesium.VerticalOrigin.BOTTOM,color:this.style.color?this.style.color instanceof Cesium.Color?this.style.color.withAlpha(this.style.colorAlpha||1):Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE}});i.objId=this.objId;const s=this.style.image;if(s)this._preloadImage(s,7e3).then(o=>{try{i.billboard.image=o,this.style.image=s}catch(r){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",r);try{i.billboard.image=s}catch{}}try{this.viewer.scene.requestRender()}catch{}}).catch(o=>{console.error("CreateBillboard: image load failed:",o.message," URL:",s," 使用回退图:",t);try{this.viewer.scene.requestRender()}catch{}});else try{this.viewer.scene.requestRender()}catch{}return this.position=e.clone(),this.entity=i,i}updateBillboardImage(e){if(!this.entity||!this.entity.billboard)return;const t=this.style.fallbackImage||this._defaultFallback;if(!e){try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}return}try{this.entity.billboard.image=t}catch{}this._preloadImage(e,7e3).then(i=>{try{this.entity.billboard.image=i}catch(s){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",s);try{this.entity.billboard.image=e}catch{}}this.style.image=e;try{this.viewer.scene.requestRender()}catch{}}).catch(i=>{console.error("CreateBillboard: updateBillboardImage failed to load:",i.message," URL:",e);try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}})}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);if(s){if(t.position=s.clone(),t.entity=t.createBillboard(t.position),t.handler){try{t.handler.destroy()}catch{}t.handler=null}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}t.state="endCreate",e&&e(t.entity)}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt&&t.prompt.update&&t.prompt.update(i.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;if(e.handler){try{e.handler.destroy()}catch{}e.handler=null}if(e.prompt){try{e.prompt.destroy()}catch{}e.prompt=null}e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=null;e instanceof Cesium.Cartesian3?i=e.clone():i=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0)),i&&(this.position=i.clone(),this.entity=this.createBillboard(this.position),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(!e)return;let t=this.entity&&this.entity.billboard;if(t){if(e.image!=null&&this.updateBillboardImage(e.image),e.heightReference!=null){let i=1;e.heightReference==!0?i=1:i=Number(e.heightReference);try{t.heightReference=i}catch{}}if(e.scale!=null)try{t.scale=Number(e.scale)}catch{}if(e.color){let i=e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color);i=i.withAlpha(e.colorAlpha||1);try{t.color=i}catch{}}}this.style=Object.assign(this.style,e)}getStyle(){let e={},t=this.entity&&this.entity.billboard;if(e.image=this.style.image,t&&t.heightReference)try{let i=t.heightReference.getValue();e.heightReference=Number(i)}catch{}if(t&&t.scale)try{e.scale=t.scale.getValue()}catch{}if(t&&t.color)try{let i=t.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}catch{}return e}startEdit(e){if(this._cleanupEditState(),!this.entity)return;this.state="startEdit",this.controlPoints=[],this.showControlPoints(),this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);let t=this,i=null,s=!1;const o=()=>{if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}i=null,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}};window.addEventListener("mouseup",o,!0),this._globalMouseUpHandler=o,this.modifyHandler.setInputAction(function(r){const l=t.viewer.scene.pick(r.position);if(Cesium.defined(l)&&l.id){if(l.id===t.entity){i=l.id,s=!0,t._isDragging=!0,t._editPickedEntity=i,t.modifyPoint=null;try{t.forbidDrawWorld(!0)}catch{}}else if(t.controlPoints.includes(l.id)){t.modifyPoint=l.id,s=!0,t._isDragging=!0,i=t.entity;try{t.forbidDrawWorld(!0)}catch{}}}},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(r){if(!s)return;let l=t.getCatesian3FromPX(r.endPosition,t.viewer);if(l){if(Cesium.defined(i)){try{i.position.setValue(l)}catch{i.position=l}t.position=l.clone(),t.controlPoints&&t.controlPoints.length>0&&t.controlPoints.forEach(a=>{try{a.position.setValue(l)}catch(c){console.warn("更新控制点位置失败:",c);try{a.position=l.clone()}catch(u){console.error("重新设置控制点位置失败:",u)}}})}t.state="editing",e&&e()}},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}},Cesium.ScreenSpaceEventType.LEFT_UP),this.modifyHandler.setInputAction(function(){if(t._isScaling){t._isScaling=!1,t._isDragging=!1,t._scalingControlPoint=null,delete t._initialScale,delete t._initialMousePosition,t.viewer.canvas.style.cursor="",t._hideScaleHint();try{t.forbidDrawWorld(!1)}catch{}}if(s){s=!1,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}}if(t.hideControlPoints(),t.modifyHandler){try{t.modifyHandler.destroy()}catch{}t.modifyHandler=null}t._globalMouseUpHandler&&(window.removeEventListener("mouseup",t._globalMouseUpHandler,!0),t._globalMouseUpHandler=null),t.state="endEdit"},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.modifyHandler.setInputAction(function(r){const l=t.viewer.scene.pick(r.position);Cesium.defined(l)&&l.id===t.entity&&t._handleDoubleClick()},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}createControlPoint(e){return e?this.viewer.entities.add({position:e,point:{pixelSize:8,color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}}):null}createYellowControlPoint(e){if(!e)return null;const t=this.viewer.entities.add({position:e,point:{pixelSize:10,color:Cesium.Color.YELLOW,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return t.isYellowControl=!0,t}createScaleControlPoint(e,t){if(!e)return null;let i=Cesium.Color.GREEN;t==="bottomLeft"&&(i=Cesium.Color.BLUE);const s=this.viewer.entities.add({position:e,point:{pixelSize:10,color:i,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return s.isScaleControl=!0,s.corner=t,s}_calculateSpecialPosition(e){return this._calculateCornerPosition(e,"bottomRight")}_calculateCornerPosition(e,t){if(!e)return null;const s=50*(this.style.scale||1),o=this.viewer.camera,r=new Cesium.Cartesian3,l=new Cesium.Cartesian3,a=new Cesium.Cartesian3;Cesium.Cartesian3.clone(o.direction,r),Cesium.Cartesian3.clone(o.right,l),Cesium.Cartesian3.clone(o.up,a),Cesium.Cartesian3.normalize(r,r),Cesium.Cartesian3.normalize(l,l),Cesium.Cartesian3.normalize(a,a);const c=new Cesium.Cartesian3;Cesium.Cartesian3.multiplyByScalar(l,s,c),Cesium.Cartesian3.multiplyByScalar(a,s,a),Cesium.Cartesian3.add(c,a,c);const u=new Cesium.Ray(e,r),h=this.viewer.scene.globe.pick(u,this.viewer.scene),p=Cesium.Cartesian3.distance(e,h||e)*.001;return Cesium.Cartesian3.multiplyByScalar(c,p,c),Cesium.Cartesian3.add(e,c,new Cesium.Cartesian3)}showControlPoints(){if(this.controlPoints=this.controlPoints||[],this._isDragging){this.position&&this.controlPoints.length>0&&this.controlPoints.forEach(e=>{try{e.position.setValue(this.position)}catch{try{e.position=this.position.clone()}catch(i){console.warn("更新拖拽中控制点位置失败:",i)}}});return}if(this.controlPoints.length>0&&([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(i){console.warn("移除控制点失败:",i)}}),this.controlPoints.length=0),this.position&&this.viewer&&!this._isDragging){const e=this.createControlPoint(this.position);e&&(e.wz=0,this.controlPoints.push(e))}}hideControlPoints(){this.controlPoints&&Array.isArray(this.controlPoints)&&this.controlPoints.length>0?([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(i){console.warn("移除控制点失败:",i)}}),this.controlPoints.length=0):(!this.controlPoints||!Array.isArray(this.controlPoints))&&(this.controlPoints=[]),this.topRightControlPoint=null,this.bottomLeftControlPoint=null,this.scaleControlPoint=null,this.modifyPoint=null}endEdit(e){if(this.hideControlPoints(),this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}try{this.forbidDrawWorld(!1)}catch{}this.viewer&&this.viewer.canvas&&(this.viewer.canvas.style.cursor=""),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null,this.state="endEdit",e&&e(this.entity)}_cleanupEditState(){if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}if(this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}this.controlPoints=this.controlPoints||[],this.hideControlPoints(),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null;try{this.forbidDrawWorld(!1)}catch{}}_showScaleHint(e){this._scaleHintElement||(this._scaleHintElement=document.createElement("div"),this._scaleHintElement.style.position="absolute",this._scaleHintElement.style.background="rgba(0, 0, 0, 0.7)",this._scaleHintElement.style.color="white",this._scaleHintElement.style.padding="4px 8px",this._scaleHintElement.style.borderRadius="4px",this._scaleHintElement.style.fontSize="12px",this._scaleHintElement.style.pointerEvents="none",this._scaleHintElement.style.zIndex="10000",document.body.appendChild(this._scaleHintElement)),this._scaleHintElement.textContent=`缩放: ${e.toFixed(2)}x`,this._scaleHintElement.style.left=`${window.event.clientX+10}px`,this._scaleHintElement.style.top=`${window.event.clientY-30}px`,this._scaleHintElement.style.display="block"}_hideScaleHint(){this._scaleHintElement&&(this._scaleHintElement.style.display="none")}move(e){if(!this.entity)return;let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0));try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone(),this.state="editing"}_createFileInput(){if(this._fileInput)return this._fileInput;const e=document.createElement("input");return e.type="file",e.accept="image/*",e.style.display="none",e.onchange=t=>{this._handleFileUpload(t)},document.body.appendChild(e),this._fileInput=e,e}_handleFileUpload(e){const t=e.target.files[0];if(!t)return;if(!t.type.match("image.*")){console.warn("请选择有效的图片文件");return}const i=new FileReader;i.onload=s=>{this.updateBillboardImage(s.target.result),this._fileInput&&(this._fileInput.value="")},i.onerror=s=>{console.error("文件读取失败:",s)},i.readAsDataURL(t)}_handleDoubleClick(){this._createFileInput().click()}editImage(e){return e?(this.updateBillboardImage(e),!0):(console.warn("CreateBillboard.editImage: 未提供有效的图片URL"),!1)}remove(){try{this.endEdit()}catch{}if(this.entity){this.state="no";try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}}getPositions(e){return e?ce.cartesianToLnglat(this.position,this.viewer):this.position}getLnglats(){return this.getPositions(!0)}setPosition(e){let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0);try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone()}destroy(){try{this.endEdit()}catch{}if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.position=null,this.state="no",this._isDragging=!1,this._editPickedEntity=null}}class Vg extends et{constructor(e,t){super(e,t),this.type="circle",this.viewer=e,this.style=t||{},this.center=null,this.radiusPoint=null,this.radiusPointEntity=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null,this.pointsCount=64}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(i){const s=t.getCatesian3FromPX(i.position,t.viewer,[]);s&&(t.entity?(t.endCreate(),e&&e(t.entity)):(t.center=s.clone(),t.radiusPoint=s.clone(),t.entity=t._createPolyline(),t.radiusPointEntity=t.createPoint(t.radiusPoint),t.radiusPointEntity.typeAttr="radius",t.radiusPointEntity.show=!1))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(!t.entity){t.prompt?.update(i.endPosition,"单击开始绘制");return}t.prompt?.update(i.endPosition,"单击结束");const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);s&&(t.radiusPoint=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.radiusPointEntity&&(this.radiusPointEntity.show=!0),this.modifyHandler.setInputAction(function(i){const s=t.viewer.scene.pick(i.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(i.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="radius"&&(t.radiusPoint=s.clone()),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildCirclePositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildCirclePositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildCirclePositions(){if(!this.center||!this.radiusPoint)return[];const e=[],t=Cesium.Ellipsoid.WGS84,i=t.cartesianToCartographic(this.center),s=t.cartesianToCartographic(this.radiusPoint),o=Math.abs(s.longitude-i.longitude),r=Math.abs(s.latitude-i.latitude);for(let l=0;l<=this.pointsCount;l++){const a=l/this.pointsCount*Math.PI*2,c=i.longitude+o*Math.cos(a),u=i.latitude+r*Math.sin(a);e.push(Cesium.Cartesian3.fromRadians(c,u))}return e}_updateAuxPoints(){!this.radiusPoint||!this.radiusPointEntity||(this.radiusPointEntity.position=this.radiusPoint)}syncFromEntity(){if(!this.entity||!this.center||!this.radiusPoint)return;const e=this.center,t=this.entity._centerCoord;if(!t)return;const i=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.center=new Cesium.Cartesian3(this.center.x+i,this.center.y+s,this.center.z+o),this.radiusPoint=new Cesium.Cartesian3(this.radiusPoint.x+i,this.radiusPoint.y+s,this.radiusPoint.z+o);const r=this.entity.objId,l=this.entity._plotInstance;this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=l,this.entity.objId=r,this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.center||!this.radiusPoint)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.center=Cesium.Cartesian3.add(this.center,t,new Cesium.Cartesian3),this.radiusPoint=Cesium.Cartesian3.add(this.radiusPoint,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update circle positions:",t),!1}}getPositions(e){return e?ce.cartesiansToLnglats([this.center,this.radiusPoint],this.viewer):[this.center,this.radiusPoint]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let i=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(i=i.withAlpha(t.colorAlpha)),this.entity.polyline.material=i,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.prompt?.destroy(),this.prompt=null}catch{}}_manageRadiusPointEntity(){this.radiusPointEntity?this.radiusPoint&&(this.radiusPointEntity.position=this.radiusPoint):(this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity&&(this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=!1))}createByPositions(e,t){try{if(!e||e.length===0)return console.error("createByPositions: positions array is empty or undefined"),t&&t(null),this;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length===0)return console.error("createByPositions: failed to convert positions to Cartesian3"),t&&t(null),this;if(i.length>=2)this.center=Cesium.Cartesian3.clone(i[0]),this.radiusPoint=Cesium.Cartesian3.clone(i[1]);else if(i.length===1)this.center=Cesium.Cartesian3.clone(i[0]),this._createDefaultRadiusPoint();else return console.error("createByPositions: invalid positions array"),t&&t(null),this;this.entity?this._updatePolyline():this.entity=this._createPolyline(),this._manageRadiusPointEntity(),this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),this}catch(i){return console.error("createByPositions error:",i),t&&t(null),this}}}class Wg extends et{constructor(e,t){if(super(e,t),this.type="gltfModel",t=t||{},this.viewer=e,!t.uri){console.warn("请输入模型地址!");return}let i={heading:0,pitch:0,roll:0,minimumPixelSize:24,maximumScale:120};this.style=Object.assign(i,t||{}),this.modelUri=t.uri,this.entity=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);s&&(t.entity.position=s,t.position=s.clone()),t.endCreate(),e&&e(t.entity)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt.update(i.endPosition,"单击新增"),t.state="creating";let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity]);s&&(t.entity?t.entity.position=s:t.entity=t.createGltfModel(s.clone()))},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}createByPositions(e,t){e&&(this.state="startCreate",e instanceof Cesium.Cartesian3?this.position=e:this.position=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0),this.entity=this.createGltfModel(this.position),t(this.entity),this.state="endCreate")}startEdit(e){if(this.state=="startEdit"||this.state=="editing")return;this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,i;this.state="startEdit",this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(i=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!i)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer,[t.entity]);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o.clone()),t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){i&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createGltfModel(e){if(!e)return;let t=Cesium.Math.toRadians(this.style.heading),i=Cesium.Math.toRadians(this.style.pitch),s=Cesium.Math.toRadians(this.style.roll),o=new Cesium.HeadingPitchRoll(t,i,s),r=Cesium.Transforms.headingPitchRollQuaternion(e,o),l=this.viewer.entities.add({position:e,orientation:r,model:{uri:this.modelUri,minimumPixelSize:this.style.minimumPixelSize,maximumScale:this.style.maximumScale,scale:this.style.scale||1,heightReference:this.style.heightReference}});return l.objId=this.objId,l}getPositions(e){return e?ce.cartesianToLnglat(this.position,this.viewer):this.position}getStyle(){let e={},t=this.entity.model;e.minimumPixelSize=t.minimumPixelSize.getValue();let i=this.entity.orientation.getValue(),s=this.entity.position.getValue(this.viewer.clock.currentTime),o=ce.oreatationToHpr(s.clone(),i,!0)||{};e.heading=(o.heading||0)<360?o.heading+360:o.heading,e.pitch=o.pitch||0,e.roll=o.roll||0,e.scale=t.scale.getValue(),e.uri=t.uri.getValue();let r=this.entity.heightReference&&this.entity.heightReference.getValue();return r!=null&&(e.heightReference=Number(r)),e}setStyle(e){e&&(this.setOrientation(e.heading,e.pitch,e.roll),this.entity.model.scale.setValue(e.scale==null?1:e.scale),e.uri&&this.entity.model.uri.setValue(e.uri),e.heightReference!=null&&this.entity.model.heightReference.setValue(Number(e.heightReference)),this.style=Object.assign(this.style,e))}setOrientation(e,t,i){e=e||0,t=t||0,i=i||0,this.style.heading=e,this.style.pitch=t,this.style.roll=i;var s=Cesium.Math.toRadians(e||0),o=Cesium.Math.toRadians(t||0),r=Cesium.Math.toRadians(i||0),l=new Cesium.HeadingPitchRoll(s,o,r),a=this.entity.position._value,c=Cesium.Transforms.headingPitchRollQuaternion(a,l);this.entity&&(this.entity.orientation=c)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.style=null,this.prompt&&(this.prompt.destroy(),this.prompt=null)}}String.prototype.codePointAt||(function(){var n=(function(){try{var t={},i=Object.defineProperty,s=i(t,t,t)&&i}catch{}return s})(),e=function(t){if(this==null)throw TypeError();var i=String(this),s=i.length,o=t?Number(t):0;if(o!=o&&(o=0),!(o<0||o>=s)){var r=i.charCodeAt(o),l;return r>=55296&&r<=56319&&s>o+1&&(l=i.charCodeAt(o+1),l>=56320&&l<=57343)?(r-55296)*1024+l-56320+65536:r}};n?n(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e})();function tn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs,La;function zg(){if(La)return Qs;La=1;var n=0,e=-3;function t(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function i(g,k){this.source=g,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=k,this.destLen=0,this.ltree=new t,this.dtree=new t}var s=new t,o=new t,r=new Uint8Array(30),l=new Uint16Array(30),a=new Uint8Array(30),c=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new t,f=new Uint8Array(320);function p(g,k,P,F){var L,G;for(L=0;L<P;++L)g[L]=0;for(L=0;L<30-P;++L)g[L+P]=L/P|0;for(G=F,L=0;L<30;++L)k[L]=G,G+=1<<g[L]}function A(g,k){var P;for(P=0;P<7;++P)g.table[P]=0;for(g.table[7]=24,g.table[8]=152,g.table[9]=112,P=0;P<24;++P)g.trans[P]=256+P;for(P=0;P<144;++P)g.trans[24+P]=P;for(P=0;P<8;++P)g.trans[168+P]=280+P;for(P=0;P<112;++P)g.trans[176+P]=144+P;for(P=0;P<5;++P)k.table[P]=0;for(k.table[5]=32,P=0;P<32;++P)k.trans[P]=P}var C=new Uint16Array(16);function m(g,k,P,F){var L,G;for(L=0;L<16;++L)g.table[L]=0;for(L=0;L<F;++L)g.table[k[P+L]]++;for(g.table[0]=0,G=0,L=0;L<16;++L)C[L]=G,G+=g.table[L];for(L=0;L<F;++L)k[P+L]&&(g.trans[C[k[P+L]]++]=L)}function y(g){g.bitcount--||(g.tag=g.source[g.sourceIndex++],g.bitcount=7);var k=g.tag&1;return g.tag>>>=1,k}function E(g,k,P){if(!k)return P;for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var F=g.tag&65535>>>16-k;return g.tag>>>=k,g.bitcount-=k,F+P}function x(g,k){for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var P=0,F=0,L=0,G=g.tag;do F=2*F+(G&1),G>>>=1,++L,P+=k.table[L],F-=k.table[L];while(F>=0);return g.tag=G,g.bitcount-=L,k.trans[P+F]}function M(g,k,P){var F,L,G,O,v,w;for(F=E(g,5,257),L=E(g,5,1),G=E(g,4,4),O=0;O<19;++O)f[O]=0;for(O=0;O<G;++O){var b=E(g,3,0);f[u[O]]=b}for(m(h,f,0,19),v=0;v<F+L;){var B=x(g,h);switch(B){case 16:var R=f[v-1];for(w=E(g,2,3);w;--w)f[v++]=R;break;case 17:for(w=E(g,3,3);w;--w)f[v++]=0;break;case 18:for(w=E(g,7,11);w;--w)f[v++]=0;break;default:f[v++]=B;break}}m(k,f,0,F),m(P,f,F,L)}function T(g,k,P){for(;;){var F=x(g,k);if(F===256)return n;if(F<256)g.dest[g.destLen++]=F;else{var L,G,O,v;for(F-=257,L=E(g,r[F],l[F]),G=x(g,P),O=g.destLen-E(g,a[G],c[G]),v=O;v<O+L;++v)g.dest[g.destLen++]=g.dest[v]}}}function S(g){for(var k,P,F;g.bitcount>8;)g.sourceIndex--,g.bitcount-=8;if(k=g.source[g.sourceIndex+1],k=256*k+g.source[g.sourceIndex],P=g.source[g.sourceIndex+3],P=256*P+g.source[g.sourceIndex+2],k!==(~P&65535))return e;for(g.sourceIndex+=4,F=k;F;--F)g.dest[g.destLen++]=g.source[g.sourceIndex++];return g.bitcount=0,n}function I(g,k){var P=new i(g,k),F,L,G;do{switch(F=y(P),L=E(P,2,0),L){case 0:G=S(P);break;case 1:G=T(P,s,o);break;case 2:M(P,P.ltree,P.dtree),G=T(P,P.ltree,P.dtree);break;default:G=e}if(G!==n)throw new Error("Data error")}while(!F);return P.destLen<P.dest.length?typeof P.dest.slice=="function"?P.dest.slice(0,P.destLen):P.dest.subarray(0,P.destLen):P.dest}return A(s,o),p(r,l,4,3),p(a,c,2,1),r[28]=0,l[28]=258,Qs=I,Qs}var jg=zg();const $g=tn(jg);function nn(n,e,t,i,s){return Math.pow(1-s,3)*n+3*Math.pow(1-s,2)*s*e+3*(1-s)*Math.pow(s,2)*t+Math.pow(s,3)*i}function yt(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}yt.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},yt.prototype.addPoint=function(n,e){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},yt.prototype.addX=function(n){this.addPoint(n,null)},yt.prototype.addY=function(n){this.addPoint(null,n)},yt.prototype.addBezier=function(n,e,t,i,s,o,r,l){const a=[n,e],c=[t,i],u=[s,o],h=[r,l];this.addPoint(n,e),this.addPoint(r,l);for(let f=0;f<=1;f++){const p=6*a[f]-12*c[f]+6*u[f],A=-3*a[f]+9*c[f]-9*u[f]+3*h[f],C=3*c[f]-3*a[f];if(A===0){if(p===0)continue;const x=-C/p;0<x&&x<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],x)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],x)));continue}const m=Math.pow(p,2)-4*C*A;if(m<0)continue;const y=(-p+Math.sqrt(m))/(2*A);0<y&&y<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],y)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],y)));const E=(-p-Math.sqrt(m))/(2*A);0<E&&E<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],E)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],E)))}},yt.prototype.addQuad=function(n,e,t,i,s,o){const r=n+.6666666666666666*(t-n),l=e+2/3*(i-e),a=r+1/3*(s-n),c=l+1/3*(o-e);this.addBezier(n,e,r,l,a,c,s,o)};function be(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}be.prototype.moveTo=function(n,e){this.commands.push({type:"M",x:n,y:e})},be.prototype.lineTo=function(n,e){this.commands.push({type:"L",x:n,y:e})},be.prototype.curveTo=be.prototype.bezierCurveTo=function(n,e,t,i,s,o){this.commands.push({type:"C",x1:n,y1:e,x2:t,y2:i,x:s,y:o})},be.prototype.quadTo=be.prototype.quadraticCurveTo=function(n,e,t,i){this.commands.push({type:"Q",x1:n,y1:e,x:t,y:i})},be.prototype.close=be.prototype.closePath=function(){this.commands.push({type:"Z"})},be.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof yt){const e=n;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,n)},be.prototype.getBoundingBox=function(){const n=new yt;let e=0,t=0,i=0,s=0;for(let o=0;o<this.commands.length;o++){const r=this.commands[o];switch(r.type){case"M":n.addPoint(r.x,r.y),e=i=r.x,t=s=r.y;break;case"L":n.addPoint(r.x,r.y),i=r.x,s=r.y;break;case"Q":n.addQuad(i,s,r.x1,r.y1,r.x,r.y),i=r.x,s=r.y;break;case"C":n.addBezier(i,s,r.x1,r.y1,r.x2,r.y2,r.x,r.y),i=r.x,s=r.y;break;case"Z":i=e,s=t;break;default:throw new Error("Unexpected path command "+r.type)}}return n.isEmpty()&&n.addPoint(0,0),n},be.prototype.draw=function(n){n.beginPath();for(let e=0;e<this.commands.length;e+=1){const t=this.commands[e];t.type==="M"?n.moveTo(t.x,t.y):t.type==="L"?n.lineTo(t.x,t.y):t.type==="C"?n.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?n.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&n.closePath()}this.fill&&(n.fillStyle=this.fill,n.fill()),this.stroke&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeWidth,n.stroke())},be.prototype.toPathData=function(n){n=n!==void 0?n:2;function e(s){return Math.round(s)===s?""+Math.round(s):s.toFixed(n)}function t(){let s="";for(let o=0;o<arguments.length;o+=1){const r=arguments[o];r>=0&&o>0&&(s+=" "),s+=e(r)}return s}let i="";for(let s=0;s<this.commands.length;s+=1){const o=this.commands[s];o.type==="M"?i+="M"+t(o.x,o.y):o.type==="L"?i+="L"+t(o.x,o.y):o.type==="C"?i+="C"+t(o.x1,o.y1,o.x2,o.y2,o.x,o.y):o.type==="Q"?i+="Q"+t(o.x1,o.y1,o.x,o.y):o.type==="Z"&&(i+="Z")}return i},be.prototype.toSVG=function(n){let e='<path d="';return e+=this.toPathData(n),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},be.prototype.toDOMElement=function(n){const e=this.toPathData(n),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function Na(n){throw new Error(n)}function Ua(n,e){n||Na(e)}const ie={fail:Na,argument:Ua,assert:Ua},_a=32768,Qa=2147483648,sn={},z={},te={};function Ge(n){return function(){return n}}z.BYTE=function(n){return ie.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},te.BYTE=Ge(1),z.CHAR=function(n){return[n.charCodeAt(0)]},te.CHAR=Ge(1),z.CHARARRAY=function(n){const e=[];for(let t=0;t<n.length;t+=1)e[t]=n.charCodeAt(t);return e},te.CHARARRAY=function(n){return n.length},z.USHORT=function(n){return[n>>8&255,n&255]},te.USHORT=Ge(2),z.SHORT=function(n){return n>=_a&&(n=-(2*_a-n)),[n>>8&255,n&255]},te.SHORT=Ge(2),z.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},te.UINT24=Ge(3),z.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},te.ULONG=Ge(4),z.LONG=function(n){return n>=Qa&&(n=-(2*Qa-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},te.LONG=Ge(4),z.FIXED=z.ULONG,te.FIXED=te.ULONG,z.FWORD=z.SHORT,te.FWORD=te.SHORT,z.UFWORD=z.USHORT,te.UFWORD=te.USHORT,z.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},te.LONGDATETIME=Ge(8),z.TAG=function(n){return ie.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},te.TAG=Ge(4),z.Card8=z.BYTE,te.Card8=te.BYTE,z.Card16=z.USHORT,te.Card16=te.USHORT,z.OffSize=z.BYTE,te.OffSize=te.BYTE,z.SID=z.USHORT,te.SID=te.USHORT,z.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?z.NUMBER16(n):z.NUMBER32(n)},te.NUMBER=function(n){return z.NUMBER(n).length},z.NUMBER16=function(n){return[28,n>>8&255,n&255]},te.NUMBER16=Ge(3),z.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},te.NUMBER32=Ge(5),z.REAL=function(n){let e=n.toString();const t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){const o=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(n*o)/o).toString()}let i="";for(let o=0,r=e.length;o<r;o+=1){const l=e[o];l==="e"?i+=e[++o]==="-"?"c":"b":l==="."?i+="a":l==="-"?i+="e":i+=l}i+=i.length&1?"f":"ff";const s=[30];for(let o=0,r=i.length;o<r;o+=2)s.push(parseInt(i.substr(o,2),16));return s},te.REAL=function(n){return z.REAL(n).length},z.NAME=z.CHARARRAY,te.NAME=te.CHARARRAY,z.STRING=z.CHARARRAY,te.STRING=te.CHARARRAY,sn.UTF8=function(n,e,t){const i=[],s=t;for(let o=0;o<s;o++,e+=1)i[o]=n.getUint8(e);return String.fromCharCode.apply(null,i)},sn.UTF16=function(n,e,t){const i=[],s=t/2;for(let o=0;o<s;o++,e+=2)i[o]=n.getUint16(e);return String.fromCharCode.apply(null,i)},z.UTF16=function(n){const e=[];for(let t=0;t<n.length;t+=1){const i=n.charCodeAt(t);e[e.length]=i>>8&255,e[e.length]=i&255}return e},te.UTF16=function(n){return n.length*2};const Hs={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};sn.MACSTRING=function(n,e,t,i){const s=Hs[i];if(s===void 0)return;let o="";for(let r=0;r<t;r++){const l=n.getUint8(e+r);l<=127?o+=String.fromCharCode(l):o+=s[l&127]}return o};const mi=typeof WeakMap=="function"&&new WeakMap;let Ai;const Kg=function(n){if(!Ai){Ai={};for(let s in Hs)Ai[s]=new String(s)}const e=Ai[n];if(e===void 0)return;if(mi){const s=mi.get(e);if(s!==void 0)return s}const t=Hs[n];if(t===void 0)return;const i={};for(let s=0;s<t.length;s++)i[t.charCodeAt(s)]=s+128;return mi&&mi.set(e,i),i};z.MACSTRING=function(n,e){const t=Kg(e);if(t===void 0)return;const i=[];for(let s=0;s<n.length;s++){let o=n.charCodeAt(s);if(o>=128&&(o=t[o],o===void 0))return;i[s]=o}return i},te.MACSTRING=function(n,e){const t=z.MACSTRING(n,e);return t!==void 0?t.length:0};function Gs(n){return n>=-128&&n<=127}function Xg(n,e,t){let i=0;const s=n.length;for(;e<s&&i<64&&n[e]===0;)++e,++i;return t.push(128|i-1),e}function qg(n,e,t){let i=0;const s=n.length;let o=e;for(;o<s&&i<64;){const r=n[o];if(!Gs(r)||r===0&&o+1<s&&n[o+1]===0)break;++o,++i}t.push(i-1);for(let r=e;r<o;++r)t.push(n[r]+256&255);return o}function Jg(n,e,t){let i=0;const s=n.length;let o=e;for(;o<s&&i<64;){const r=n[o];if(r===0||Gs(r)&&o+1<s&&Gs(n[o+1]))break;++o,++i}t.push(64|i-1);for(let r=e;r<o;++r){const l=n[r];t.push(l+65536>>8&255,l+256&255)}return o}z.VARDELTAS=function(n){let e=0;const t=[];for(;e<n.length;){const i=n[e];i===0?e=Xg(n,e,t):i>=-128&&i<=127?e=qg(n,e,t):e=Jg(n,e,t)}return t},z.INDEX=function(n){let e=1;const t=[e],i=[];for(let l=0;l<n.length;l+=1){const a=z.OBJECT(n[l]);Array.prototype.push.apply(i,a),e+=a.length,t.push(e)}if(i.length===0)return[0,0];const s=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,r=[void 0,z.BYTE,z.USHORT,z.UINT24,z.ULONG][o];for(let l=0;l<t.length;l+=1){const a=r(t[l]);Array.prototype.push.apply(s,a)}return Array.prototype.concat(z.Card16(n.length),z.OffSize(o),s,i)},te.INDEX=function(n){return z.INDEX(n).length},z.DICT=function(n){let e=[];const t=Object.keys(n),i=t.length;for(let s=0;s<i;s+=1){const o=parseInt(t[s],0),r=n[o];e=e.concat(z.OPERAND(r.value,r.type)),e=e.concat(z.OPERATOR(o))}return e},te.DICT=function(n){return z.DICT(n).length},z.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},z.OPERAND=function(n,e){let t=[];if(Array.isArray(e))for(let i=0;i<e.length;i+=1)ie.argument(n.length===e.length,"Not enough arguments given for type"+e),t=t.concat(z.OPERAND(n[i],e[i]));else if(e==="SID")t=t.concat(z.NUMBER(n));else if(e==="offset")t=t.concat(z.NUMBER32(n));else if(e==="number")t=t.concat(z.NUMBER(n));else if(e==="real")t=t.concat(z.REAL(n));else throw new Error("Unknown operand type "+e);return t},z.OP=z.BYTE,te.OP=te.BYTE;const yi=typeof WeakMap=="function"&&new WeakMap;z.CHARSTRING=function(n){if(yi){const i=yi.get(n);if(i!==void 0)return i}let e=[];const t=n.length;for(let i=0;i<t;i+=1){const s=n[i];e=e.concat(z[s.type](s.value))}return yi&&yi.set(n,e),e},te.CHARSTRING=function(n){return z.CHARSTRING(n).length},z.OBJECT=function(n){const e=z[n.type];return ie.argument(e!==void 0,"No encoding function for type "+n.type),e(n.value)},te.OBJECT=function(n){const e=te[n.type];return ie.argument(e!==void 0,"No sizeOf function for type "+n.type),e(n.value)},z.TABLE=function(n){let e=[];const t=n.fields.length,i=[],s=[];for(let o=0;o<t;o+=1){const r=n.fields[o],l=z[r.type];ie.argument(l!==void 0,"No encoding function for field type "+r.type+" ("+r.name+")");let a=n[r.name];a===void 0&&(a=r.value);const c=l(a);r.type==="TABLE"?(s.push(e.length),e=e.concat([0,0]),i.push(c)):e=e.concat(c)}for(let o=0;o<i.length;o+=1){const r=s[o],l=e.length;ie.argument(l<65536,"Table "+n.tableName+" too big."),e[r]=l>>8,e[r+1]=l&255,e=e.concat(i[o])}return e},te.TABLE=function(n){let e=0;const t=n.fields.length;for(let i=0;i<t;i+=1){const s=n.fields[i],o=te[s.type];ie.argument(o!==void 0,"No sizeOf function for field type "+s.type+" ("+s.name+")");let r=n[s.name];r===void 0&&(r=s.value),e+=o(r),s.type==="TABLE"&&(e+=2)}return e},z.RECORD=z.TABLE,te.RECORD=te.TABLE,z.LITERAL=function(n){return n},te.LITERAL=function(n){return n.length};function De(n,e,t){for(let i=0;i<e.length;i+=1){const s=e[i];this[s.name]=s.value}if(this.tableName=n,this.fields=e,t){const i=Object.keys(t);for(let s=0;s<i.length;s+=1){const o=i[s],r=t[o];this[o]!==void 0&&(this[o]=r)}}}De.prototype.encode=function(){return z.TABLE(this)},De.prototype.sizeOf=function(){return te.TABLE(this)};function Mn(n,e,t){t===void 0&&(t=e.length);const i=new Array(e.length+1);i[0]={name:n+"Count",type:"USHORT",value:t};for(let s=0;s<e.length;s++)i[s+1]={name:n+s,type:"USHORT",value:e[s]};return i}function Ys(n,e,t){const i=e.length,s=new Array(i+1);s[0]={name:n+"Count",type:"USHORT",value:i};for(let o=0;o<i;o++)s[o+1]={name:n+o,type:"TABLE",value:t(e[o],o)};return s}function Ci(n,e,t){const i=e.length;let s=[];s[0]={name:n+"Count",type:"USHORT",value:i};for(let o=0;o<i;o++)s=s.concat(t(e[o],o));return s}function Ei(n){n.format===1?De.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Mn("glyph",n.glyphs))):ie.assert(!1,"Can't create coverage table format 2 yet.")}Ei.prototype=Object.create(De.prototype),Ei.prototype.constructor=Ei;function wi(n){De.call(this,"scriptListTable",Ci("scriptRecord",n,function(e,t){const i=e.script;let s=i.defaultLangSys;return ie.assert(!!s,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new De("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new De("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(Mn("featureIndex",s.featureIndexes)))}].concat(Ci("langSys",i.langSysRecords,function(o,r){const l=o.langSys;return[{name:"langSysTag"+r,type:"TAG",value:o.tag},{name:"langSys"+r,type:"TABLE",value:new De("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:l.reqFeatureIndex}].concat(Mn("featureIndex",l.featureIndexes)))}]})))}]}))}wi.prototype=Object.create(De.prototype),wi.prototype.constructor=wi;function bi(n){De.call(this,"featureListTable",Ci("featureRecord",n,function(e,t){const i=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new De("featureTable",[{name:"featureParams",type:"USHORT",value:i.featureParams}].concat(Mn("lookupListIndex",i.lookupListIndexes)))}]}))}bi.prototype=Object.create(De.prototype),bi.prototype.constructor=bi;function vi(n,e){De.call(this,"lookupListTable",Ys("lookup",n,function(t){let i=e[t.lookupType];return ie.assert(!!i,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new De("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(Ys("subtable",t.subtables,i)))}))}vi.prototype=Object.create(De.prototype),vi.prototype.constructor=vi;const Z={Table:De,Record:De,Coverage:Ei,ScriptList:wi,FeatureList:bi,LookupList:vi,ushortList:Mn,tableList:Ys,recordList:Ci};function Ha(n,e){return n.getUint8(e)}function xi(n,e){return n.getUint16(e,!1)}function Zg(n,e){return n.getInt16(e,!1)}function Vs(n,e){return n.getUint32(e,!1)}function Ga(n,e){const t=n.getInt16(e,!1),i=n.getUint16(e+2,!1);return t+i/65535}function em(n,e){let t="";for(let i=e;i<e+4;i+=1)t+=String.fromCharCode(n.getInt8(i));return t}function tm(n,e,t){let i=0;for(let s=0;s<t;s+=1)i<<=8,i+=n.getUint8(e+s);return i}function nm(n,e,t){const i=[];for(let s=e;s<t;s+=1)i.push(n.getUint8(s));return i}function im(n){let e="";for(let t=0;t<n.length;t+=1)e+=String.fromCharCode(n[t]);return e}const sm={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function H(n,e){this.data=n,this.offset=e,this.relativeOffset=0}H.prototype.parseByte=function(){const n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},H.prototype.parseChar=function(){const n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},H.prototype.parseCard8=H.prototype.parseByte,H.prototype.parseUShort=function(){const n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},H.prototype.parseCard16=H.prototype.parseUShort,H.prototype.parseSID=H.prototype.parseUShort,H.prototype.parseOffset16=H.prototype.parseUShort,H.prototype.parseShort=function(){const n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},H.prototype.parseF2Dot14=function(){const n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},H.prototype.parseULong=function(){const n=Vs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},H.prototype.parseOffset32=H.prototype.parseULong,H.prototype.parseFixed=function(){const n=Ga(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},H.prototype.parseString=function(n){const e=this.data,t=this.offset+this.relativeOffset;let i="";this.relativeOffset+=n;for(let s=0;s<n;s++)i+=String.fromCharCode(e.getUint8(t+s));return i},H.prototype.parseTag=function(){return this.parseString(4)},H.prototype.parseLongDateTime=function(){let n=Vs(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},H.prototype.parseVersion=function(n){const e=xi(this.data,this.offset+this.relativeOffset),t=xi(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),e+t/n/10},H.prototype.skip=function(n,e){e===void 0&&(e=1),this.relativeOffset+=sm[n]*e},H.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint32(i),i+=4;return this.relativeOffset+=n*4,e},H.prototype.parseOffset16List=H.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint16(i),i+=2;return this.relativeOffset+=n*2,e},H.prototype.parseShortList=function(n){const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getInt16(i),i+=2;return this.relativeOffset+=n*2,e},H.prototype.parseByteList=function(n){const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint8(i++);return this.relativeOffset+=n,e},H.prototype.parseList=function(n,e){e||(e=n,n=this.parseUShort());const t=new Array(n);for(let i=0;i<n;i++)t[i]=e.call(this);return t},H.prototype.parseList32=function(n,e){e||(e=n,n=this.parseULong());const t=new Array(n);for(let i=0;i<n;i++)t[i]=e.call(this);return t},H.prototype.parseRecordList=function(n,e){e||(e=n,n=this.parseUShort());const t=new Array(n),i=Object.keys(e);for(let s=0;s<n;s++){const o={};for(let r=0;r<i.length;r++){const l=i[r],a=e[l];o[l]=a.call(this)}t[s]=o}return t},H.prototype.parseRecordList32=function(n,e){e||(e=n,n=this.parseULong());const t=new Array(n),i=Object.keys(e);for(let s=0;s<n;s++){const o={};for(let r=0;r<i.length;r++){const l=i[r],a=e[l];o[l]=a.call(this)}t[s]=o}return t},H.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{const e=Object.keys(n),t={};for(let i=0;i<e.length;i++){const s=e[i],o=n[s];t[s]=o.call(this)}return t}},H.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;const e={};return n&1&&(e.xPlacement=this.parseShort()),n&2&&(e.yPlacement=this.parseShort()),n&4&&(e.xAdvance=this.parseShort()),n&8&&(e.yAdvance=this.parseShort()),n&16&&(e.xPlaDevice=void 0,this.parseShort()),n&32&&(e.yPlaDevice=void 0,this.parseShort()),n&64&&(e.xAdvDevice=void 0,this.parseShort()),n&128&&(e.yAdvDevice=void 0,this.parseShort()),e},H.prototype.parseValueRecordList=function(){const n=this.parseUShort(),e=this.parseUShort(),t=new Array(e);for(let i=0;i<e;i++)t[i]=this.parseValueRecord(n);return t},H.prototype.parsePointer=function(n){const e=this.parseOffset16();if(e>0)return new H(this.data,this.offset+e).parseStruct(n)},H.prototype.parsePointer32=function(n){const e=this.parseOffset32();if(e>0)return new H(this.data,this.offset+e).parseStruct(n)},H.prototype.parseListOfLists=function(n){const e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,s=new Array(t);for(let o=0;o<t;o++){const r=e[o];if(r===0){s[o]=void 0;continue}if(this.relativeOffset=r,n){const l=this.parseOffset16List(),a=new Array(l.length);for(let c=0;c<l.length;c++)this.relativeOffset=r+l[c],a[c]=n.call(this);s[o]=a}else s[o]=this.parseUShortList()}return this.relativeOffset=i,s},H.prototype.parseCoverage=function(){const n=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){const i=new Array(t);for(let s=0;s<t;s++)i[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}}throw new Error("0x"+n.toString(16)+": Coverage format must be 1 or 2.")},H.prototype.parseClassDef=function(){const n=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:H.uShort,end:H.uShort,classId:H.uShort})};throw new Error("0x"+n.toString(16)+": ClassDef format must be 1 or 2.")},H.list=function(n,e){return function(){return this.parseList(n,e)}},H.list32=function(n,e){return function(){return this.parseList32(n,e)}},H.recordList=function(n,e){return function(){return this.parseRecordList(n,e)}},H.recordList32=function(n,e){return function(){return this.parseRecordList32(n,e)}},H.pointer=function(n){return function(){return this.parsePointer(n)}},H.pointer32=function(n){return function(){return this.parsePointer32(n)}},H.tag=H.prototype.parseTag,H.byte=H.prototype.parseByte,H.uShort=H.offset16=H.prototype.parseUShort,H.uShortList=H.prototype.parseUShortList,H.uLong=H.offset32=H.prototype.parseULong,H.uLongList=H.prototype.parseULongList,H.struct=H.prototype.parseStruct,H.coverage=H.prototype.parseCoverage,H.classDef=H.prototype.parseClassDef;const Ya={reserved:H.uShort,reqFeatureIndex:H.uShort,featureIndexes:H.uShortList};H.prototype.parseScriptList=function(){return this.parsePointer(H.recordList({tag:H.tag,script:H.pointer({defaultLangSys:H.pointer(Ya),langSysRecords:H.recordList({tag:H.tag,langSys:H.pointer(Ya)})})}))||[]},H.prototype.parseFeatureList=function(){return this.parsePointer(H.recordList({tag:H.tag,feature:H.pointer({featureParams:H.offset16,lookupListIndexes:H.uShortList})}))||[]},H.prototype.parseLookupList=function(n){return this.parsePointer(H.list(H.pointer(function(){const e=this.parseUShort();ie.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");const t=this.parseUShort(),i=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(H.pointer(n[e])),markFilteringSet:i?this.parseUShort():void 0}})))||[]},H.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){const n=this.parseUShort(),e=this.parseUShort();return ie.argument(n===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:H.offset32,featureTableSubstitutionOffset:H.offset32})})||[]};const q={getByte:Ha,getCard8:Ha,getUShort:xi,getCard16:xi,getShort:Zg,getULong:Vs,getFixed:Ga,getTag:em,getOffset:tm,getBytes:nm,bytesToString:im,Parser:H};function om(n,e){e.parseUShort(),n.length=e.parseULong(),n.language=e.parseULong();let t;n.groupCount=t=e.parseULong(),n.glyphIndexMap={};for(let i=0;i<t;i+=1){const s=e.parseULong(),o=e.parseULong();let r=e.parseULong();for(let l=s;l<=o;l+=1)n.glyphIndexMap[l]=r,r++}}function rm(n,e,t,i,s){n.length=e.parseUShort(),n.language=e.parseUShort();let o;n.segCount=o=e.parseUShort()>>1,e.skip("uShort",3),n.glyphIndexMap={};const r=new q.Parser(t,i+s+14),l=new q.Parser(t,i+s+16+o*2),a=new q.Parser(t,i+s+16+o*4),c=new q.Parser(t,i+s+16+o*6);let u=i+s+16+o*8;for(let h=0;h<o-1;h+=1){let f;const p=r.parseUShort(),A=l.parseUShort(),C=a.parseShort(),m=c.parseUShort();for(let y=A;y<=p;y+=1)m!==0?(u=c.offset+c.relativeOffset-2,u+=m,u+=(y-A)*2,f=q.getUShort(t,u),f!==0&&(f=f+C&65535)):f=y+C&65535,n.glyphIndexMap[y]=f}}function am(n,e){const t={};t.version=q.getUShort(n,e),ie.argument(t.version===0,"cmap table version should be 0."),t.numTables=q.getUShort(n,e+2);let i=-1;for(let o=t.numTables-1;o>=0;o-=1){const r=q.getUShort(n,e+4+o*8),l=q.getUShort(n,e+4+o*8+2);if(r===3&&(l===0||l===1||l===10)||r===0&&(l===0||l===1||l===2||l===3||l===4)){i=q.getULong(n,e+4+o*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");const s=new q.Parser(n,e+i);if(t.format=s.parseUShort(),t.format===12)om(t,s);else if(t.format===4)rm(t,s,n,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function lm(n,e,t){n.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function cm(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function dm(n){let e=!0,t;for(t=n.length-1;t>0;t-=1)if(n.get(t).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}let i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);const s=new Z.Table("cmap",i);for(s.segments=[],t=0;t<n.length;t+=1){const p=n.get(t);for(let A=0;A<p.unicodes.length;A+=1)lm(s,p.unicodes[A],t);s.segments=s.segments.sort(function(A,C){return A.start-C.start})}cm(s);const o=s.segments.length;let r=0,l=[],a=[],c=[],u=[],h=[],f=[];for(t=0;t<o;t+=1){const p=s.segments[t];p.end<=65535&&p.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:p.end}),a=a.concat({name:"start_"+t,type:"USHORT",value:p.start}),c=c.concat({name:"idDelta_"+t,type:"SHORT",value:p.delta}),u=u.concat({name:"idRangeOffset_"+t,type:"USHORT",value:p.offset}),p.glyphId!==void 0&&(h=h.concat({name:"glyph_"+t,type:"USHORT",value:p.glyphId}))):r+=1,!e&&p.glyphIndex!==void 0&&(f=f.concat({name:"cmap12Start_"+t,type:"ULONG",value:p.start}),f=f.concat({name:"cmap12End_"+t,type:"ULONG",value:p.end}),f=f.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:p.glyphIndex}))}if(s.segCountX2=(o-r)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(o-r)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(a),s.fields=s.fields.concat(c),s.fields=s.fields.concat(u),s.fields=s.fields.concat(h),s.cmap4Length=14+l.length*2+2+a.length*2+c.length*2+u.length*2+h.length*2,!e){const p=16+f.length*4;s.cmap12Offset=20+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:p},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:f.length/3}]),s.fields=s.fields.concat(f)}return s}const Va={parse:am,make:dm},Ii=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],um=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],hm=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Ft=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Wa(n){this.font=n}Wa.prototype.charToGlyphIndex=function(n){const e=n.codePointAt(0),t=this.font.glyphs;if(t)for(let i=0;i<t.length;i+=1){const s=t.get(i);for(let o=0;o<s.unicodes.length;o+=1)if(s.unicodes[o]===e)return i}return null};function za(n){this.cmap=n}za.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function Bi(n,e){this.encoding=n,this.charset=e}Bi.prototype.charToGlyphIndex=function(n){const e=n.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function Ws(n){switch(n.version){case 1:this.names=Ft.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let e=0;e<n.numberOfGlyphs;e++)n.glyphNameIndex[e]<Ft.length?this.names[e]=Ft[n.glyphNameIndex[e]]:this.names[e]=n.names[n.glyphNameIndex[e]-Ft.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let e=0;e<n.numberOfGlyphs;e++)this.names[e]=Ft[e+n.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}Ws.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},Ws.prototype.glyphIndexToName=function(n){return this.names[n]};function fm(n){let e;const t=n.tables.cmap.glyphIndexMap,i=Object.keys(t);for(let s=0;s<i.length;s+=1){const o=i[s],r=t[o];e=n.glyphs.get(r),e.addUnicode(parseInt(o))}for(let s=0;s<n.glyphs.length;s+=1)e=n.glyphs.get(s),n.cffEncoding?n.isCIDFont?e.name="gid"+s:e.name=n.cffEncoding.charset[s]:n.glyphNames.names&&(e.name=n.glyphNames.glyphIndexToName(s))}function pm(n,e,t,i,s){n.beginPath(),n.moveTo(e,t),n.lineTo(i,s),n.stroke()}const Rt={line:pm};function gm(n,e){let t=e||new be;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(i){t=i}}}function He(n){this.bindConstructorValues(n)}He.prototype.bindConstructorValues=function(n){this.index=n.index||0,this.name=n.name||null,this.unicode=n.unicode||void 0,this.unicodes=n.unicodes||n.unicode!==void 0?[n.unicode]:[],n.xMin&&(this.xMin=n.xMin),n.yMin&&(this.yMin=n.yMin),n.xMax&&(this.xMax=n.xMax),n.yMax&&(this.yMax=n.yMax),n.advanceWidth&&(this.advanceWidth=n.advanceWidth),Object.defineProperty(this,"path",gm(this,n.path))},He.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},He.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},He.prototype.getPath=function(n,e,t,i,s){n=n!==void 0?n:0,e=e!==void 0?e:0,t=t!==void 0?t:72;let o,r;i||(i={});let l=i.xScale,a=i.yScale;if(i.hinting&&s&&s.hinting&&(r=this.path&&s.hinting.exec(this,t)),r)o=s.hinting.getCommands(r),n=Math.round(n),e=Math.round(e),l=a=1;else{o=this.path.commands;const u=1/this.path.unitsPerEm*t;l===void 0&&(l=u),a===void 0&&(a=u)}const c=new be;for(let u=0;u<o.length;u+=1){const h=o[u];h.type==="M"?c.moveTo(n+h.x*l,e+-h.y*a):h.type==="L"?c.lineTo(n+h.x*l,e+-h.y*a):h.type==="Q"?c.quadraticCurveTo(n+h.x1*l,e+-h.y1*a,n+h.x*l,e+-h.y*a):h.type==="C"?c.curveTo(n+h.x1*l,e+-h.y1*a,n+h.x2*l,e+-h.y2*a,n+h.x*l,e+-h.y*a):h.type==="Z"&&c.closePath()}return c},He.prototype.getContours=function(){if(this.points===void 0)return[];const n=[];let e=[];for(let t=0;t<this.points.length;t+=1){const i=this.points[t];e.push(i),i.lastPointOfContour&&(n.push(e),e=[])}return ie.argument(e.length===0,"There are still points left in the current contour."),n},He.prototype.getMetrics=function(){const n=this.path.commands,e=[],t=[];for(let s=0;s<n.length;s+=1){const o=n[s];o.type!=="Z"&&(e.push(o.x),t.push(o.y)),(o.type==="Q"||o.type==="C")&&(e.push(o.x1),t.push(o.y1)),o.type==="C"&&(e.push(o.x2),t.push(o.y2))}const i={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(i.xMin)||(i.xMin=0),isFinite(i.xMax)||(i.xMax=this.advanceWidth),isFinite(i.yMin)||(i.yMin=0),isFinite(i.yMax)||(i.yMax=0),i.rightSideBearing=this.advanceWidth-i.leftSideBearing-(i.xMax-i.xMin),i},He.prototype.draw=function(n,e,t,i,s){this.getPath(e,t,i,s).draw(n)},He.prototype.drawPoints=function(n,e,t,i){function s(c,u,h,f){const p=Math.PI*2;n.beginPath();for(let A=0;A<c.length;A+=1)n.moveTo(u+c[A].x*f,h+c[A].y*f),n.arc(u+c[A].x*f,h+c[A].y*f,2,0,p,!1);n.closePath(),n.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24;const o=1/this.path.unitsPerEm*i,r=[],l=[],a=this.path;for(let c=0;c<a.commands.length;c+=1){const u=a.commands[c];u.x!==void 0&&r.push({x:u.x,y:-u.y}),u.x1!==void 0&&l.push({x:u.x1,y:-u.y1}),u.x2!==void 0&&l.push({x:u.x2,y:-u.y2})}n.fillStyle="blue",s(r,e,t,o),n.fillStyle="red",s(l,e,t,o)},He.prototype.drawMetrics=function(n,e,t,i){let s;e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24,s=1/this.path.unitsPerEm*i,n.lineWidth=1,n.strokeStyle="black",Rt.line(n,e,-1e4,e,1e4),Rt.line(n,-1e4,t,1e4,t);const o=this.xMin||0;let r=this.yMin||0;const l=this.xMax||0;let a=this.yMax||0;const c=this.advanceWidth||0;n.strokeStyle="blue",Rt.line(n,e+o*s,-1e4,e+o*s,1e4),Rt.line(n,e+l*s,-1e4,e+l*s,1e4),Rt.line(n,-1e4,t+-r*s,1e4,t+-r*s),Rt.line(n,-1e4,t+-a*s,1e4,t+-a*s),n.strokeStyle="green",Rt.line(n,e+c*s,-1e4,e+c*s,1e4)};function Si(n,e,t){Object.defineProperty(n,e,{get:function(){return n.path,n[t]},set:function(i){n[t]=i},enumerable:!0,configurable:!0})}function zs(n,e){if(this.font=n,this.glyphs={},Array.isArray(e))for(let t=0;t<e.length;t++)this.glyphs[t]=e[t];this.length=e&&e.length||0}zs.prototype.get=function(n){return typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]()),this.glyphs[n]},zs.prototype.push=function(n,e){this.glyphs[n]=e,this.length++};function mm(n,e){return new He({index:e,font:n})}function Am(n,e,t,i,s,o){return function(){const r=new He({index:e,font:n});return r.path=function(){t(r,i,s);const l=o(n.glyphs,r);return l.unitsPerEm=n.unitsPerEm,l},Si(r,"xMin","_xMin"),Si(r,"xMax","_xMax"),Si(r,"yMin","_yMin"),Si(r,"yMax","_yMax"),r}}function ym(n,e,t,i){return function(){const s=new He({index:e,font:n});return s.path=function(){const o=t(n,s,i);return o.unitsPerEm=n.unitsPerEm,o},s}}const on={GlyphSet:zs,glyphLoader:mm,ttfGlyphLoader:Am,cffGlyphLoader:ym};function ja(n,e){if(n===e)return!0;if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t+=1)if(!ja(n[t],e[t]))return!1;return!0}else return!1}function js(n){let e;return n.length<1240?e=107:n.length<33900?e=1131:e=32768,e}function Ct(n,e,t){const i=[],s=[],o=q.getCard16(n,e);let r,l;if(o!==0){const a=q.getByte(n,e+2);r=e+(o+1)*a+2;let c=e+3;for(let u=0;u<o+1;u+=1)i.push(q.getOffset(n,c,a)),c+=a;l=r+i[o]}else l=e+2;for(let a=0;a<i.length-1;a+=1){let c=q.getBytes(n,r+i[a],r+i[a+1]);t&&(c=t(c)),s.push(c)}return{objects:s,startOffset:e,endOffset:l}}function Cm(n){let e="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=n.parseByte(),o=s>>4,r=s&15;if(o===15||(e+=i[o],r===15))break;e+=i[r]}return parseFloat(e)}function Em(n,e){let t,i,s,o;if(e===28)return t=n.parseByte(),i=n.parseByte(),t<<8|i;if(e===29)return t=n.parseByte(),i=n.parseByte(),s=n.parseByte(),o=n.parseByte(),t<<24|i<<16|s<<8|o;if(e===30)return Cm(n);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=n.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=n.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function wm(n){const e={};for(let t=0;t<n.length;t+=1){const i=n[t][0],s=n[t][1];let o;if(s.length===1?o=s[0]:o=s,e.hasOwnProperty(i)&&!isNaN(e[i]))throw new Error("Object "+e+" already has key "+i);e[i]=o}return e}function $a(n,e,t){e=e!==void 0?e:0;const i=new q.Parser(n,e),s=[];let o=[];for(t=t!==void 0?t:n.length;i.relativeOffset<t;){let r=i.parseByte();r<=21?(r===12&&(r=1200+i.parseByte()),s.push([r,o]),o=[]):o.push(Em(i,r))}return wm(s)}function Tn(n,e){return e<=390?e=Ii[e]:e=n[e-391],e}function Ka(n,e,t){const i={};let s;for(let o=0;o<e.length;o+=1){const r=e[o];if(Array.isArray(r.type)){const l=[];l.length=r.type.length;for(let a=0;a<r.type.length;a++)s=n[r.op]!==void 0?n[r.op][a]:void 0,s===void 0&&(s=r.value!==void 0&&r.value[a]!==void 0?r.value[a]:null),r.type[a]==="SID"&&(s=Tn(t,s)),l[a]=s;i[r.name]=l}else s=n[r.op],s===void 0&&(s=r.value!==void 0?r.value:null),r.type==="SID"&&(s=Tn(t,s)),i[r.name]=s}return i}function bm(n,e){const t={};return t.formatMajor=q.getCard8(n,e),t.formatMinor=q.getCard8(n,e+1),t.size=q.getCard8(n,e+2),t.offsetSize=q.getCard8(n,e+3),t.startOffset=e,t.endOffset=e+4,t}const Xa=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],qa=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function vm(n,e){const t=$a(n,0,n.byteLength);return Ka(t,Xa,e)}function Ja(n,e,t,i){const s=$a(n,e,t);return Ka(s,qa,i)}function Za(n,e,t,i){const s=[];for(let o=0;o<t.length;o+=1){const r=new DataView(new Uint8Array(t[o]).buffer),l=vm(r,i);l._subrs=[],l._subrsBias=0;const a=l.private[0],c=l.private[1];if(a!==0&&c!==0){const u=Ja(n,c+e,a,i);if(l._defaultWidthX=u.defaultWidthX,l._nominalWidthX=u.nominalWidthX,u.subrs!==0){const h=c+u.subrs,f=Ct(n,h+e);l._subrs=f.objects,l._subrsBias=js(l._subrs)}l._privateDict=u}s.push(l)}return s}function xm(n,e,t,i){let s,o;const r=new q.Parser(n,e);t-=1;const l=[".notdef"],a=r.parseCard8();if(a===0)for(let c=0;c<t;c+=1)s=r.parseSID(),l.push(Tn(i,s));else if(a===1)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard8();for(let c=0;c<=o;c+=1)l.push(Tn(i,s)),s+=1}else if(a===2)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard16();for(let c=0;c<=o;c+=1)l.push(Tn(i,s)),s+=1}else throw new Error("Unknown charset format "+a);return l}function Im(n,e,t){let i;const s={},o=new q.Parser(n,e),r=o.parseCard8();if(r===0){const l=o.parseCard8();for(let a=0;a<l;a+=1)i=o.parseCard8(),s[i]=a}else if(r===1){const l=o.parseCard8();i=1;for(let a=0;a<l;a+=1){const c=o.parseCard8(),u=o.parseCard8();for(let h=c;h<=c+u;h+=1)s[h]=i,i+=1}}else throw new Error("Unknown encoding format "+r);return new Bi(s,t)}function Bm(n,e,t){let i,s,o,r;const l=new be,a=[];let c=0,u=!1,h=!1,f=0,p=0,A,C,m,y;if(n.isCIDFont){const S=n.tables.cff.topDict._fdSelect[e.index],I=n.tables.cff.topDict._fdArray[S];A=I._subrs,C=I._subrsBias,m=I._defaultWidthX,y=I._nominalWidthX}else A=n.tables.cff.topDict._subrs,C=n.tables.cff.topDict._subrsBias,m=n.tables.cff.topDict._defaultWidthX,y=n.tables.cff.topDict._nominalWidthX;let E=m;function x(S,I){h&&l.closePath(),l.moveTo(S,I),h=!0}function M(){let S;S=a.length%2!==0,S&&!u&&(E=a.shift()+y),c+=a.length>>1,a.length=0,u=!0}function T(S){let I,g,k,P,F,L,G,O,v,w,b,B,R=0;for(;R<S.length;){let U=S[R];switch(R+=1,U){case 1:M();break;case 3:M();break;case 4:a.length>1&&!u&&(E=a.shift()+y,u=!0),p+=a.pop(),x(f,p);break;case 5:for(;a.length>0;)f+=a.shift(),p+=a.shift(),l.lineTo(f,p);break;case 6:for(;a.length>0&&(f+=a.shift(),l.lineTo(f,p),a.length!==0);)p+=a.shift(),l.lineTo(f,p);break;case 7:for(;a.length>0&&(p+=a.shift(),l.lineTo(f,p),a.length!==0);)f+=a.shift(),l.lineTo(f,p);break;case 8:for(;a.length>0;)i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 10:F=a.pop()+C,L=A[F],L&&T(L);break;case 11:return;case 12:switch(U=S[R],R+=1,U){case 35:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),O=r+a.shift(),v=G+a.shift(),w=O+a.shift(),b=v+a.shift(),B=w+a.shift(),f=b+a.shift(),p=B+a.shift(),a.shift(),l.curveTo(i,s,o,r,G,O),l.curveTo(v,w,b,B,f,p);break;case 34:i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),O=r,v=G+a.shift(),w=r,b=v+a.shift(),B=p,f=b+a.shift(),l.curveTo(i,s,o,r,G,O),l.curveTo(v,w,b,B,f,p);break;case 36:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),O=r,v=G+a.shift(),w=r,b=v+a.shift(),B=w+a.shift(),f=b+a.shift(),l.curveTo(i,s,o,r,G,O),l.curveTo(v,w,b,B,f,p);break;case 37:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),O=r+a.shift(),v=G+a.shift(),w=O+a.shift(),b=v+a.shift(),B=w+a.shift(),Math.abs(b-f)>Math.abs(B-p)?f=b+a.shift():p=B+a.shift(),l.curveTo(i,s,o,r,G,O),l.curveTo(v,w,b,B,f,p);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+U),a.length=0}break;case 14:a.length>0&&!u&&(E=a.shift()+y,u=!0),h&&(l.closePath(),h=!1);break;case 18:M();break;case 19:case 20:M(),R+=c+7>>3;break;case 21:a.length>2&&!u&&(E=a.shift()+y,u=!0),p+=a.pop(),f+=a.pop(),x(f,p);break;case 22:a.length>1&&!u&&(E=a.shift()+y,u=!0),f+=a.pop(),x(f,p);break;case 23:M();break;case 24:for(;a.length>2;)i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);f+=a.shift(),p+=a.shift(),l.lineTo(f,p);break;case 25:for(;a.length>6;)f+=a.shift(),p+=a.shift(),l.lineTo(f,p);i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 26:for(a.length%2&&(f+=a.shift());a.length>0;)i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o,p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 27:for(a.length%2&&(p+=a.shift());a.length>0;)i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r,l.curveTo(i,s,o,r,f,p);break;case 28:I=S[R],g=S[R+1],a.push((I<<24|g<<16)>>16),R+=2;break;case 29:F=a.pop()+n.gsubrsBias,L=n.gsubrs[F],L&&T(L);break;case 30:for(;a.length>0&&(i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p),a.length!==0);)i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),p=r+a.shift(),f=o+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p);break;case 31:for(;a.length>0&&(i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),p=r+a.shift(),f=o+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p),a.length!==0);)i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p);break;default:U<32?console.log("Glyph "+e.index+": unknown operator "+U):U<247?a.push(U-139):U<251?(I=S[R],R+=1,a.push((U-247)*256+I+108)):U<255?(I=S[R],R+=1,a.push(-(U-251)*256-I-108)):(I=S[R],g=S[R+1],k=S[R+2],P=S[R+3],R+=4,a.push((I<<24|g<<16|k<<8|P)/65536))}}}return T(t),e.advanceWidth=E,l}function Sm(n,e,t,i){const s=[];let o;const r=new q.Parser(n,e),l=r.parseCard8();if(l===0)for(let a=0;a<t;a++){if(o=r.parseCard8(),o>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");s.push(o)}else if(l===3){const a=r.parseCard16();let c=r.parseCard16();if(c!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+c);let u;for(let h=0;h<a;h++){if(o=r.parseCard8(),u=r.parseCard16(),o>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");if(u>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+u);for(;c<u;c++)s.push(o);c=u}if(u!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+u)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+l);return s}function Mm(n,e,t){t.tables.cff={};const i=bm(n,e),s=Ct(n,i.endOffset,q.bytesToString),o=Ct(n,s.endOffset),r=Ct(n,o.endOffset,q.bytesToString),l=Ct(n,r.endOffset);t.gsubrs=l.objects,t.gsubrsBias=js(t.gsubrs);const a=Za(n,e,o.objects,r.objects);if(a.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+a.length);const c=a[0];if(t.tables.cff.topDict=c,c._privateDict&&(t.defaultWidthX=c._privateDict.defaultWidthX,t.nominalWidthX=c._privateDict.nominalWidthX),c.ros[0]!==void 0&&c.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){let A=c.fdArray,C=c.fdSelect;if(A===0||C===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");A+=e;const m=Ct(n,A),y=Za(n,e,m.objects,r.objects);c._fdArray=y,C+=e,c._fdSelect=Sm(n,C,t.numGlyphs,y.length)}const u=e+c.private[1],h=Ja(n,u,c.private[0],r.objects);if(t.defaultWidthX=h.defaultWidthX,t.nominalWidthX=h.nominalWidthX,h.subrs!==0){const A=u+h.subrs,C=Ct(n,A);t.subrs=C.objects,t.subrsBias=js(t.subrs)}else t.subrs=[],t.subrsBias=0;const f=Ct(n,e+c.charStrings);t.nGlyphs=f.objects.length;const p=xm(n,e+c.charset,t.nGlyphs,r.objects);c.encoding===0?t.cffEncoding=new Bi(um,p):c.encoding===1?t.cffEncoding=new Bi(hm,p):t.cffEncoding=Im(n,e+c.encoding,p),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new on.GlyphSet(t);for(let A=0;A<t.nGlyphs;A+=1){const C=f.objects[A];t.glyphs.push(A,on.cffGlyphLoader(t,A,Bm,C))}}function el(n,e){let t,i=Ii.indexOf(n);return i>=0&&(t=i),i=e.indexOf(n),i>=0?t=i+Ii.length:(t=Ii.length+e.length,e.push(n)),t}function Tm(){return new Z.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Dm(n){const e=new Z.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(let t=0;t<n.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:n[t]});return e}function tl(n,e,t){const i={};for(let s=0;s<n.length;s+=1){const o=n[s];let r=e[o.name];r!==void 0&&!ja(r,o.value)&&(o.type==="SID"&&(r=el(r,t)),i[o.op]={name:o.name,type:o.type,value:r})}return i}function nl(n,e){const t=new Z.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=tl(Xa,n,e),t}function il(n){const e=new Z.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],e}function km(n){const e=new Z.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(let t=0;t<n.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:n[t]});return e}function Pm(){return new Z.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Fm(n,e){const t=new Z.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let i=0;i<n.length;i+=1){const s=n[i],o=el(s,e);t.fields.push({name:"glyph_"+i,type:"SID",value:o})}return t}function Rm(n){const e=[],t=n.path;e.push({name:"width",type:"NUMBER",value:n.advanceWidth});let i=0,s=0;for(let o=0;o<t.commands.length;o+=1){let r,l,a=t.commands[o];if(a.type==="Q"){const c=.3333333333333333,u=2/3;a={type:"C",x:a.x,y:a.y,x1:c*i+u*a.x1,y1:c*s+u*a.y1,x2:c*a.x+u*a.x1,y2:c*a.y+u*a.y1}}if(a.type==="M")r=Math.round(a.x-i),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rmoveto",type:"OP",value:21}),i=Math.round(a.x),s=Math.round(a.y);else if(a.type==="L")r=Math.round(a.x-i),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rlineto",type:"OP",value:5}),i=Math.round(a.x),s=Math.round(a.y);else if(a.type==="C"){const c=Math.round(a.x1-i),u=Math.round(a.y1-s),h=Math.round(a.x2-a.x1),f=Math.round(a.y2-a.y1);r=Math.round(a.x-a.x2),l=Math.round(a.y-a.y2),e.push({name:"dx1",type:"NUMBER",value:c}),e.push({name:"dy1",type:"NUMBER",value:u}),e.push({name:"dx2",type:"NUMBER",value:h}),e.push({name:"dy2",type:"NUMBER",value:f}),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rrcurveto",type:"OP",value:8}),i=Math.round(a.x),s=Math.round(a.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function Om(n){const e=new Z.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let t=0;t<n.length;t+=1){const i=n.get(t),s=Rm(i);e.charStrings.push({name:i.name,type:"CHARSTRING",value:s})}return e}function Lm(n,e){const t=new Z.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=tl(qa,n,e),t}function Nm(n,e){const t=new Z.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),i=1/e.unitsPerEm,s={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[i,0,0,i,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},o={},r=[];let l;for(let h=1;h<n.length;h+=1)l=n.get(h),r.push(l.name);const a=[];t.header=Tm(),t.nameIndex=Dm([e.postScriptName]);let c=nl(s,a);t.topDictIndex=il(c),t.globalSubrIndex=Pm(),t.charsets=Fm(r,a),t.charStringsIndex=Om(n),t.privateDict=Lm(o,a),t.stringIndex=km(a);const u=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return s.charset=u,s.encoding=0,s.charStrings=s.charset+t.charsets.sizeOf(),s.private[1]=s.charStrings+t.charStringsIndex.sizeOf(),c=nl(s,a),t.topDictIndex=il(c),t}const sl={parse:Mm,make:Nm};function Um(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.fontRevision=Math.round(i.parseFixed()*1e3)/1e3,t.checkSumAdjustment=i.parseULong(),t.magicNumber=i.parseULong(),ie.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=i.parseUShort(),t.unitsPerEm=i.parseUShort(),t.created=i.parseLongDateTime(),t.modified=i.parseLongDateTime(),t.xMin=i.parseShort(),t.yMin=i.parseShort(),t.xMax=i.parseShort(),t.yMax=i.parseShort(),t.macStyle=i.parseUShort(),t.lowestRecPPEM=i.parseUShort(),t.fontDirectionHint=i.parseShort(),t.indexToLocFormat=i.parseShort(),t.glyphDataFormat=i.parseShort(),t}function _m(n){const e=Math.round(new Date().getTime()/1e3)+2082844800;let t=e;return n.createdTimestamp&&(t=n.createdTimestamp+2082844800),new Z.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],n)}const ol={parse:Um,make:_m};function Qm(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.ascender=i.parseShort(),t.descender=i.parseShort(),t.lineGap=i.parseShort(),t.advanceWidthMax=i.parseUShort(),t.minLeftSideBearing=i.parseShort(),t.minRightSideBearing=i.parseShort(),t.xMaxExtent=i.parseShort(),t.caretSlopeRise=i.parseShort(),t.caretSlopeRun=i.parseShort(),t.caretOffset=i.parseShort(),i.relativeOffset+=8,t.metricDataFormat=i.parseShort(),t.numberOfHMetrics=i.parseUShort(),t}function Hm(n){return new Z.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],n)}const rl={parse:Qm,make:Hm};function Gm(n,e,t,i,s){let o,r;const l=new q.Parser(n,e);for(let a=0;a<i;a+=1){a<t&&(o=l.parseUShort(),r=l.parseShort());const c=s.get(a);c.advanceWidth=o,c.leftSideBearing=r}}function Ym(n){const e=new Z.Table("hmtx",[]);for(let t=0;t<n.length;t+=1){const i=n.get(t),s=i.advanceWidth||0,o=i.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:s}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:o})}return e}const al={parse:Gm,make:Ym};function Vm(n){const e=new Z.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:n.length}]);let t="";const i=12+n.length*4;for(let s=0;s<n.length;++s){let o=t.indexOf(n[s]);o<0&&(o=t.length,t+=n[s]),e.fields.push({name:"offset "+s,type:"USHORT",value:i+o}),e.fields.push({name:"length "+s,type:"USHORT",value:n[s].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function Wm(n,e){const t=new q.Parser(n,e),i=t.parseULong();ie.argument(i===1,"Unsupported ltag table version."),t.skip("uLong",1);const s=t.parseULong(),o=[];for(let r=0;r<s;r++){let l="";const a=e+t.parseUShort(),c=t.parseUShort();for(let u=a;u<a+c;++u)l+=String.fromCharCode(n.getInt8(u));o.push(l)}return o}const ll={make:Vm,parse:Wm};function zm(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.numGlyphs=i.parseUShort(),t.version===1&&(t.maxPoints=i.parseUShort(),t.maxContours=i.parseUShort(),t.maxCompositePoints=i.parseUShort(),t.maxCompositeContours=i.parseUShort(),t.maxZones=i.parseUShort(),t.maxTwilightPoints=i.parseUShort(),t.maxStorage=i.parseUShort(),t.maxFunctionDefs=i.parseUShort(),t.maxInstructionDefs=i.parseUShort(),t.maxStackElements=i.parseUShort(),t.maxSizeOfInstructions=i.parseUShort(),t.maxComponentElements=i.parseUShort(),t.maxComponentDepth=i.parseUShort()),t}function jm(n){return new Z.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}const cl={parse:zm,make:jm},dl=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ul={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},$m={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},hl={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Km(n,e,t){switch(n){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return ul[e];case 3:return hl[e]}}const $s="utf-16",Xm={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},qm={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function fl(n,e,t){switch(n){case 0:return $s;case 1:return qm[t]||Xm[e];case 3:if(e===1||e===10)return $s;break}}function Jm(n,e,t){const i={},s=new q.Parser(n,e),o=s.parseUShort(),r=s.parseUShort(),l=s.offset+s.parseUShort();for(let a=0;a<r;a++){const c=s.parseUShort(),u=s.parseUShort(),h=s.parseUShort(),f=s.parseUShort(),p=dl[f]||f,A=s.parseUShort(),C=s.parseUShort(),m=Km(c,h,t),y=fl(c,u,h);if(y!==void 0&&m!==void 0){let E;if(y===$s?E=sn.UTF16(n,l+C,A):E=sn.MACSTRING(n,l+C,A,y),E){let x=i[p];x===void 0&&(x=i[p]={}),x[m]=E}}}return o===1&&s.parseUShort(),i}function Ks(n){const e={};for(let t in n)e[n[t]]=parseInt(t);return e}function pl(n,e,t,i,s,o){return new Z.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:i},{name:"length",type:"USHORT",value:s},{name:"offset",type:"USHORT",value:o}])}function Zm(n,e){const t=n.length,i=e.length-t+1;e:for(let s=0;s<i;s++)for(;s<i;s++){for(let o=0;o<t;o++)if(e[s+o]!==n[o])continue e;return s}return-1}function gl(n,e){let t=Zm(n,e);if(t<0){t=e.length;let i=0;const s=n.length;for(;i<s;++i)e.push(n[i])}return t}function eA(n,e){let t;const i=[],s={},o=Ks(dl);for(let h in n){let f=o[h];if(f===void 0&&(f=h),t=parseInt(f),isNaN(t))throw new Error('Name table entry "'+h+'" does not exist, see nameTableNames for complete list.');s[t]=n[h],i.push(t)}const r=Ks(ul),l=Ks(hl),a=[],c=[];for(let h=0;h<i.length;h++){t=i[h];const f=s[t];for(let p in f){const A=f[p];let C=1,m=r[p],y=$m[m];const E=fl(C,y,m);let x=z.MACSTRING(A,E);x===void 0&&(C=0,m=e.indexOf(p),m<0&&(m=e.length,e.push(p)),y=4,x=z.UTF16(A));const M=gl(x,c);a.push(pl(C,y,m,t,x.length,M));const T=l[p];if(T!==void 0){const S=z.UTF16(A),I=gl(S,c);a.push(pl(3,1,T,t,S.length,I))}}}a.sort(function(h,f){return h.platformID-f.platformID||h.encodingID-f.encodingID||h.languageID-f.languageID||h.nameID-f.nameID});const u=new Z.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:a.length},{name:"stringOffset",type:"USHORT",value:6+a.length*12}]);for(let h=0;h<a.length;h++)u.fields.push({name:"record_"+h,type:"RECORD",value:a[h]});return u.fields.push({name:"strings",type:"LITERAL",value:c}),u}const ml={parse:Jm,make:eA},Xs=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function tA(n){for(let e=0;e<Xs.length;e+=1){const t=Xs[e];if(n>=t.begin&&n<t.end)return e}return-1}function nA(n,e){const t={},i=new q.Parser(n,e);t.version=i.parseUShort(),t.xAvgCharWidth=i.parseShort(),t.usWeightClass=i.parseUShort(),t.usWidthClass=i.parseUShort(),t.fsType=i.parseUShort(),t.ySubscriptXSize=i.parseShort(),t.ySubscriptYSize=i.parseShort(),t.ySubscriptXOffset=i.parseShort(),t.ySubscriptYOffset=i.parseShort(),t.ySuperscriptXSize=i.parseShort(),t.ySuperscriptYSize=i.parseShort(),t.ySuperscriptXOffset=i.parseShort(),t.ySuperscriptYOffset=i.parseShort(),t.yStrikeoutSize=i.parseShort(),t.yStrikeoutPosition=i.parseShort(),t.sFamilyClass=i.parseShort(),t.panose=[];for(let s=0;s<10;s++)t.panose[s]=i.parseByte();return t.ulUnicodeRange1=i.parseULong(),t.ulUnicodeRange2=i.parseULong(),t.ulUnicodeRange3=i.parseULong(),t.ulUnicodeRange4=i.parseULong(),t.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),t.fsSelection=i.parseUShort(),t.usFirstCharIndex=i.parseUShort(),t.usLastCharIndex=i.parseUShort(),t.sTypoAscender=i.parseShort(),t.sTypoDescender=i.parseShort(),t.sTypoLineGap=i.parseShort(),t.usWinAscent=i.parseUShort(),t.usWinDescent=i.parseUShort(),t.version>=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function iA(n){return new Z.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],n)}const qs={parse:nA,make:iA,unicodeRanges:Xs,getUnicodeRange:tA};function sA(n,e){const t={},i=new q.Parser(n,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=Ft.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.glyphNameIndex[s]=i.parseUShort();t.names=[];for(let s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=Ft.length){const o=i.parseChar();t.names.push(i.parseString(o))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.offset[s]=i.parseChar();break}return t}function oA(){return new Z.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}const Al={parse:sA,make:oA},Ye=new Array(9);Ye[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),substitute:this.parseOffset16List()};ie.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},Ye[2]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),sequences:this.parseListOfLists()}},Ye[3]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),alternateSets:this.parseListOfLists()}},Ye[4]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};const rn={sequenceIndex:H.uShort,lookupListIndex:H.uShort};Ye[5]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(H.coverage),ruleSets:this.parseListOfLists(function(){const i=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,rn)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(H.coverage),classDef:this.parsePointer(H.classDef),classSets:this.parseListOfLists(function(){const i=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,rn)}})};if(t===3){const i=this.parseUShort(),s=this.parseUShort();return{substFormat:t,coverages:this.parseList(i,H.pointer(H.coverage)),lookupRecords:this.parseRecordList(s,rn)}}ie.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Ye[6]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(rn)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),backtrackClassDef:this.parsePointer(H.classDef),inputClassDef:this.parsePointer(H.classDef),lookaheadClassDef:this.parsePointer(H.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(rn)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(H.pointer(H.coverage)),inputCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),lookupRecords:this.parseRecordList(rn)};ie.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Ye[7]=function(){const e=this.parseUShort();ie.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");const t=this.parseUShort(),i=new H(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:Ye[t].call(i)}},Ye[8]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),backtrackCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),substitutes:this.parseUShortList()}};function rA(n,e){e=e||0;const t=new H(n,e),i=t.parseVersion(1);return ie.argument(i===1||i===1.1,"Unsupported GSUB table version."),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ye)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ye),variations:t.parseFeatureVariationsList()}}const Mi=new Array(9);Mi[1]=function(e){return e.substFormat===1?new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.ushortList("substitute",e.substitute)))},Mi[3]=function(e){return ie.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.tableList("altSet",e.alternateSets,function(t){return new Z.Table("alternateSetTable",Z.ushortList("alternate",t))})))},Mi[4]=function(e){return ie.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.tableList("ligSet",e.ligatureSets,function(t){return new Z.Table("ligatureSetTable",Z.tableList("ligature",t,function(i){return new Z.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:i.ligGlyph}].concat(Z.ushortList("component",i.components,i.components.length+1)))}))})))};function aA(n){return new Z.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(n.lookups,Mi)}])}const yl={parse:rA,make:aA};function lA(n,e){const t=new q.Parser(n,e),i=t.parseULong();ie.argument(i===1,"Unsupported META table version."),t.parseULong(),t.parseULong();const s=t.parseULong(),o={};for(let r=0;r<s;r++){const l=t.parseTag(),a=t.parseULong(),c=t.parseULong(),u=sn.UTF8(n,e+a,c);o[l]=u}return o}function cA(n){const e=Object.keys(n).length;let t="";const i=16+e*12,s=new Z.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:i},{name:"numTags",type:"ULONG",value:e}]);for(let o in n){const r=t.length;t+=n[o],s.fields.push({name:"tag "+o,type:"TAG",value:o}),s.fields.push({name:"offset "+o,type:"ULONG",value:i+r}),s.fields.push({name:"length "+o,type:"ULONG",value:n[o].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),s}const Cl={parse:lA,make:cA};function El(n){return Math.log(n)/Math.log(2)|0}function Js(n){for(;n.length%4!==0;)n.push(0);let e=0;for(let t=0;t<n.length;t+=4)e+=(n[t]<<24)+(n[t+1]<<16)+(n[t+2]<<8)+n[t+3];return e%=Math.pow(2,32),e}function wl(n,e,t,i){return new Z.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:i!==void 0?i:0}])}function bl(n){const e=new Z.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=n,e.numTables=n.length;const t=Math.pow(2,El(e.numTables));e.searchRange=16*t,e.entrySelector=El(t),e.rangeShift=e.numTables*16-e.searchRange;const i=[],s=[];let o=e.sizeOf()+wl().sizeOf()*e.numTables;for(;o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0});for(let r=0;r<n.length;r+=1){const l=n[r];ie.argument(l.tableName.length===4,"Table name"+l.tableName+" is invalid.");const a=l.sizeOf(),c=wl(l.tableName,Js(l.encode()),o,a);for(i.push({name:c.tag+" Table Record",type:"RECORD",value:c}),s.push({name:l.tableName+" table",type:"RECORD",value:l}),o+=a,ie.argument(!isNaN(o),"Something went wrong calculating the offset.");o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0})}return i.sort(function(r,l){return r.value.tag>l.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(s),e}function vl(n,e,t){for(let i=0;i<e.length;i+=1){const s=n.charToGlyphIndex(e[i]);if(s>0)return n.glyphs.get(s).getMetrics()}return t}function dA(n){let e=0;for(let t=0;t<n.length;t+=1)e+=n[t];return e/n.length}function uA(n){const e=[],t=[],i=[],s=[],o=[],r=[],l=[];let a,c=0,u=0,h=0,f=0,p=0;for(let D=0;D<n.glyphs.length;D+=1){const Q=n.glyphs.get(D),V=Q.unicode|0;if(isNaN(Q.advanceWidth))throw new Error("Glyph "+Q.name+" ("+D+"): advanceWidth is not a number.");(a>V||a===void 0)&&V>0&&(a=V),c<V&&(c=V);const $=qs.getUnicodeRange(V);if($<32)u|=1<<$;else if($<64)h|=1<<$-32;else if($<96)f|=1<<$-64;else if($<123)p|=1<<$-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Q.name===".notdef")continue;const J=Q.getMetrics();e.push(J.xMin),t.push(J.yMin),i.push(J.xMax),s.push(J.yMax),r.push(J.leftSideBearing),l.push(J.rightSideBearing),o.push(Q.advanceWidth)}const A={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:dA(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,l)};A.ascender=n.ascender,A.descender=n.descender;const C=ol.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:A.xMin,yMin:A.yMin,xMax:A.xMax,yMax:A.yMax,lowestRecPPEM:3,createdTimestamp:n.createdTimestamp}),m=rl.make({ascender:A.ascender,descender:A.descender,advanceWidthMax:A.advanceWidthMax,minLeftSideBearing:A.minLeftSideBearing,minRightSideBearing:A.minRightSideBearing,xMaxExtent:A.maxLeftSideBearing+(A.xMax-A.xMin),numberOfHMetrics:n.glyphs.length}),y=cl.make(n.glyphs.length),E=qs.make({xAvgCharWidth:Math.round(A.advanceWidthAvg),usWeightClass:n.tables.os2.usWeightClass,usWidthClass:n.tables.os2.usWidthClass,usFirstCharIndex:a,usLastCharIndex:c,ulUnicodeRange1:u,ulUnicodeRange2:h,ulUnicodeRange3:f,ulUnicodeRange4:p,fsSelection:n.tables.os2.fsSelection,sTypoAscender:A.ascender,sTypoDescender:A.descender,sTypoLineGap:0,usWinAscent:A.yMax,usWinDescent:Math.abs(A.yMin),ulCodePageRange1:1,sxHeight:vl(n,"xyvw",{yMax:Math.round(A.ascender/2)}).yMax,sCapHeight:vl(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",A).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0}),x=al.make(n.glyphs),M=Va.make(n.glyphs),T=n.getEnglishName("fontFamily"),S=n.getEnglishName("fontSubfamily"),I=T+" "+S;let g=n.getEnglishName("postScriptName");g||(g=T.replace(/\s/g,"")+"-"+S);const k={};for(let D in n.names)k[D]=n.names[D];k.uniqueID||(k.uniqueID={en:n.getEnglishName("manufacturer")+":"+I}),k.postScriptName||(k.postScriptName={en:g}),k.preferredFamily||(k.preferredFamily=n.names.fontFamily),k.preferredSubfamily||(k.preferredSubfamily=n.names.fontSubfamily);const P=[],F=ml.make(k,P),L=P.length>0?ll.make(P):void 0,G=Al.make(),O=sl.make(n.glyphs,{version:n.getEnglishName("version"),fullName:I,familyName:T,weightName:S,postScriptName:g,unitsPerEm:n.unitsPerEm,fontBBox:[0,A.yMin,A.ascender,A.advanceWidthMax]}),v=n.metas&&Object.keys(n.metas).length>0?Cl.make(n.metas):void 0,w=[C,m,y,E,F,M,G,O,x];L&&w.push(L),n.tables.gsub&&w.push(yl.make(n.tables.gsub)),v&&w.push(v);const b=bl(w),B=b.encode(),R=Js(B),U=b.fields;let N=!1;for(let D=0;D<U.length;D+=1)if(U[D].name==="head table"){U[D].value.checkSumAdjustment=2981146554-R,N=!0;break}if(!N)throw new Error("Could not find head table with checkSum to adjust.");return b}const hA={make:bl,fontToTable:uA,computeCheckSum:Js};function Zs(n,e){let t=0,i=n.length-1;for(;t<=i;){const s=t+i>>>1,o=n[s].tag;if(o===e)return s;o<e?t=s+1:i=s-1}return-t-1}function xl(n,e){let t=0,i=n.length-1;for(;t<=i;){const s=t+i>>>1,o=n[s];if(o===e)return s;o<e?t=s+1:i=s-1}return-t-1}function Il(n,e){let t,i=0,s=n.length-1;for(;i<=s;){const o=i+s>>>1;t=n[o];const r=t.start;if(r===e)return t;r<e?i=o+1:s=o-1}if(i>0)return t=n[i-1],e>t.end?0:t}function Dn(n,e){this.font=n,this.tableName=e}Dn.prototype={searchTag:Zs,binSearch:xl,getTable:function(n){let e=this.font.tables[this.tableName];return!e&&n&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let e=!1;for(let t=0;t<n.scripts.length;t++){const i=n.scripts[t].tag;if(i==="DFLT")return i;i==="latn"&&(e=!0)}if(e)return"latn"},getScriptTable:function(n,e){const t=this.getTable(e);if(t){n=n||"DFLT";const i=t.scripts,s=Zs(t.scripts,n);if(s>=0)return i[s].script;if(e){const o={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-s,0,o),o.script}}},getLangSysTable:function(n,e,t){const i=this.getScriptTable(n,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;const s=Zs(i.langSysRecords,e);if(s>=0)return i.langSysRecords[s].langSys;if(t){const o={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-s,0,o),o.langSys}}},getFeatureTable:function(n,e,t,i){const s=this.getLangSysTable(n,e,i);if(s){let o;const r=s.featureIndexes,l=this.font.tables[this.tableName].features;for(let a=0;a<r.length;a++)if(o=l[r[a]],o.tag===t)return o.feature;if(i){const a=l.length;return ie.assert(a===0||t>=l[a-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},l.push(o),r.push(a),o.feature}}},getLookupTables:function(n,e,t,i,s){const o=this.getFeatureTable(n,e,t,s),r=[];if(o){let l;const a=o.lookupListIndexes,c=this.font.tables[this.tableName].lookups;for(let u=0;u<a.length;u++)l=c[a[u]],l.lookupType===i&&r.push(l);if(r.length===0&&s){l={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};const u=c.length;return c.push(l),a.push(u),[l]}}return r},getGlyphClass:function(n,e){switch(n.format){case 1:return n.startGlyph<=e&&e<n.startGlyph+n.classes.length?n.classes[e-n.startGlyph]:0;case 2:const t=Il(n.ranges,e);return t?t.classId:0}},getCoverageIndex:function(n,e){switch(n.format){case 1:const t=xl(n.glyphs,e);return t>=0?t:-1;case 2:const i=Il(n.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{const e=[],t=n.ranges;for(let i=0;i<t.length;i++){const s=t[i],o=s.start,r=s.end;for(let l=o;l<=r;l++)e.push(l)}return e}}};function kn(n){Dn.call(this,n,"gpos")}kn.prototype=Dn.prototype,kn.prototype.init=function(){const n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},kn.prototype.getKerningValue=function(n,e,t){for(let i=0;i<n.length;i++){const s=n[i].subtables;for(let o=0;o<s.length;o++){const r=s[o],l=this.getCoverageIndex(r.coverage,e);if(!(l<0))switch(r.posFormat){case 1:let a=r.pairSets[l];for(let f=0;f<a.length;f++){let p=a[f];if(p.secondGlyph===t)return p.value1&&p.value1.xAdvance||0}break;case 2:const c=this.getGlyphClass(r.classDef1,e),u=this.getGlyphClass(r.classDef2,t),h=r.classRecords[c][u];return h.value1&&h.value1.xAdvance||0}}}return 0},kn.prototype.getKerningTables=function(n,e){if(this.font.tables.gpos)return this.getLookupTables(n,e,"kern",2)};function Ve(n){Dn.call(this,n,"gsub")}function fA(n,e){const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}function Bl(n,e,t){const i=n.subtables;for(let s=0;s<i.length;s++){const o=i[s];if(o.substFormat===e)return o}if(t)return i.push(t),t}Ve.prototype=Dn.prototype,Ve.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ve.prototype.getSingle=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,1);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage);let u;if(a.substFormat===1){const h=a.deltaGlyphId;for(u=0;u<c.length;u++){const f=c[u];i.push({sub:f,by:f+h})}}else{const h=a.substitute;for(u=0;u<c.length;u++)i.push({sub:c[u],by:h[u]})}}}return i},Ve.prototype.getAlternates=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,3);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage),u=a.alternateSets;for(let h=0;h<c.length;h++)i.push({sub:c[h],by:u[h]})}}return i},Ve.prototype.getLigatures=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,4);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage),u=a.ligatureSets;for(let h=0;h<c.length;h++){const f=c[h],p=u[h];for(let A=0;A<p.length;A++){const C=p[A];i.push({sub:[f].concat(C.components),by:C.ligGlyph})}}}}return i},Ve.prototype.addSingle=function(n,e,t,i){const s=this.getLookupTables(t,i,n,1,!0)[0],o=Bl(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.substitute.splice(l,0,0)),o.substitute[l]=e.by},Ve.prototype.addAlternate=function(n,e,t,i){const s=this.getLookupTables(t,i,n,3,!0)[0],o=Bl(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.alternateSets.splice(l,0,0)),o.alternateSets[l]=e.by},Ve.prototype.addLigature=function(n,e,t,i){const s=this.getLookupTables(t,i,n,4,!0)[0];let o=s.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=o),ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub[0],l=e.sub.slice(1),a={ligGlyph:e.by,components:l};let c=this.binSearch(o.coverage.glyphs,r);if(c>=0){const u=o.ligatureSets[c];for(let h=0;h<u.length;h++)if(fA(u[h].components,l))return;u.push(a)}else c=-1-c,o.coverage.glyphs.splice(c,0,r),o.ligatureSets.splice(c,0,[a])},Ve.prototype.getFeature=function(n,e,t){if(/ss\d\d/.test(n))return this.getSingle(n,e,t);switch(n){case"aalt":case"salt":return this.getSingle(n,e,t).concat(this.getAlternates(n,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(n,e,t)}},Ve.prototype.add=function(n,e,t,i){if(/ss\d\d/.test(n))return this.addSingle(n,e,t,i);switch(n){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(n,e,t,i):this.addAlternate(n,e,t,i);case"dlig":case"liga":case"rlig":return this.addLigature(n,e,t,i)}};function pA(){return typeof window<"u"}function gA(n){const e=new ArrayBuffer(n.length),t=new Uint8Array(e);for(let i=0;i<n.length;++i)t[i]=n[i];return e}function mA(n){const e=new Buffer(n.byteLength),t=new Uint8Array(n);for(let i=0;i<e.length;++i)e[i]=t[i];return e}function an(n,e){if(!n)throw e}function Sl(n,e,t,i,s){let o;return(e&i)>0?(o=n.parseByte(),(e&s)===0&&(o=-o),o=t+o):(e&s)>0?o=t:o=t+n.parseShort(),o}function AA(n,e,t){const i=new q.Parser(e,t);n.numberOfContours=i.parseShort(),n._xMin=i.parseShort(),n._yMin=i.parseShort(),n._xMax=i.parseShort(),n._yMax=i.parseShort();let s,o;if(n.numberOfContours>0){const r=n.endPointIndices=[];for(let a=0;a<n.numberOfContours;a+=1)r.push(i.parseUShort());n.instructionLength=i.parseUShort(),n.instructions=[];for(let a=0;a<n.instructionLength;a+=1)n.instructions.push(i.parseByte());const l=r[r.length-1]+1;s=[];for(let a=0;a<l;a+=1)if(o=i.parseByte(),s.push(o),(o&8)>0){const c=i.parseByte();for(let u=0;u<c;u+=1)s.push(o),a+=1}if(ie.argument(s.length===l,"Bad flags."),r.length>0){const a=[];let c;if(l>0){for(let f=0;f<l;f+=1)o=s[f],c={},c.onCurve=!!(o&1),c.lastPointOfContour=r.indexOf(f)>=0,a.push(c);let u=0;for(let f=0;f<l;f+=1)o=s[f],c=a[f],c.x=Sl(i,o,u,2,16),u=c.x;let h=0;for(let f=0;f<l;f+=1)o=s[f],c=a[f],c.y=Sl(i,o,h,4,32),h=c.y}n.points=a}else n.points=[]}else if(n.numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];let r=!0;for(;r;){s=i.parseUShort();const l={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(l.dx=i.parseShort(),l.dy=i.parseShort()):l.matchedPoints=[i.parseUShort(),i.parseUShort()]:(s&2)>0?(l.dx=i.parseChar(),l.dy=i.parseChar()):l.matchedPoints=[i.parseByte(),i.parseByte()],(s&8)>0?l.xScale=l.yScale=i.parseF2Dot14():(s&64)>0?(l.xScale=i.parseF2Dot14(),l.yScale=i.parseF2Dot14()):(s&128)>0&&(l.xScale=i.parseF2Dot14(),l.scale01=i.parseF2Dot14(),l.scale10=i.parseF2Dot14(),l.yScale=i.parseF2Dot14()),n.components.push(l),r=!!(s&32)}if(s&256){n.instructionLength=i.parseUShort(),n.instructions=[];for(let l=0;l<n.instructionLength;l+=1)n.instructions.push(i.parseByte())}}}function eo(n,e){const t=[];for(let i=0;i<n.length;i+=1){const s=n[i],o={x:e.xScale*s.x+e.scale01*s.y+e.dx,y:e.scale10*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};t.push(o)}return t}function yA(n){const e=[];let t=[];for(let i=0;i<n.length;i+=1){const s=n[i];t.push(s),s.lastPointOfContour&&(e.push(t),t=[])}return ie.argument(t.length===0,"There are still points left in the current contour."),e}function Ml(n){const e=new be;if(!n)return e;const t=yA(n);for(let i=0;i<t.length;++i){const s=t[i];let o=null,r=s[s.length-1],l=s[0];if(r.onCurve)e.moveTo(r.x,r.y);else if(l.onCurve)e.moveTo(l.x,l.y);else{const a={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5};e.moveTo(a.x,a.y)}for(let a=0;a<s.length;++a)if(o=r,r=l,l=s[(a+1)%s.length],r.onCurve)e.lineTo(r.x,r.y);else{let c=l;o.onCurve||((r.x+o.x)*.5,(r.y+o.y)*.5),l.onCurve||(c={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5}),e.quadraticCurveTo(r.x,r.y,c.x,c.y)}e.closePath()}return e}function CA(n,e){if(e.isComposite)for(let t=0;t<e.components.length;t+=1){const i=e.components[t],s=n.get(i.glyphIndex);if(s.getPath(),s.points){let o;if(i.matchedPoints===void 0)o=eo(s.points,i);else{if(i.matchedPoints[0]>e.points.length-1||i.matchedPoints[1]>s.points.length-1)throw Error("Matched points out of range in "+e.name);const r=e.points[i.matchedPoints[0]];let l=s.points[i.matchedPoints[1]];const a={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};l=eo([l],a)[0],a.dx=r.x-l.x,a.dy=r.y-l.y,o=eo(s.points,a)}e.points=e.points.concat(o)}}return Ml(e.points)}function EA(n,e,t,i){const s=new on.GlyphSet(i);for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];r!==l?s.push(o,on.ttfGlyphLoader(i,o,AA,n,e+r,CA)):s.push(o,on.glyphLoader(i,o))}return s}const Tl={getPath:Ml,parse:EA};let Dl,Ot,kl,to;function Pl(n){this.font=n,this.getCommands=function(e){return Tl.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function wA(n){return n}function Fl(n){return Math.sign(n)*Math.round(Math.abs(n))}function bA(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function vA(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function xA(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function IA(n){return Math.sign(n)*Math.floor(Math.abs(n))}const Rl=function(n){const e=this.srPeriod;let t=this.srPhase;const i=this.srThreshold;let s=1;return n<0&&(n=-n,s=-1),n+=i-t,n=Math.trunc(n/e)*e,n+=t,n<0?t*s:n*s},tt={x:1,y:0,axis:"x",distance:function(n,e,t,i){return(t?n.xo:n.x)-(i?e.xo:e.x)},interpolate:function(n,e,t,i){let s,o,r,l,a,c,u;if(!i||i===this){if(s=n.xo-e.xo,o=n.xo-t.xo,a=e.x-e.xo,c=t.x-t.xo,r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){n.x=n.xo+(a+c)/2;return}n.x=n.xo+(a*l+c*r)/u;return}if(s=i.distance(n,e,!0,!0),o=i.distance(n,t,!0,!0),a=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){tt.setRelative(n,n,(a+c)/2,i,!0);return}tt.setRelative(n,n,(a*l+c*r)/u,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,e,t,i,s){if(!i||i===this){n.x=(s?e.xo:e.x)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y;n.x=l+(n.y-a)/i.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},rt={x:0,y:1,axis:"y",distance:function(n,e,t,i){return(t?n.yo:n.y)-(i?e.yo:e.y)},interpolate:function(n,e,t,i){let s,o,r,l,a,c,u;if(!i||i===this){if(s=n.yo-e.yo,o=n.yo-t.yo,a=e.y-e.yo,c=t.y-t.yo,r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){n.y=n.yo+(a+c)/2;return}n.y=n.yo+(a*l+c*r)/u;return}if(s=i.distance(n,e,!0,!0),o=i.distance(n,t,!0,!0),a=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){rt.setRelative(n,n,(a+c)/2,i,!0);return}rt.setRelative(n,n,(a*l+c*r)/u,i,!0)},normalSlope:0,setRelative:function(n,e,t,i,s){if(!i||i===this){n.y=(s?e.yo:e.y)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y;n.y=a+i.normalSlope*(n.x-l)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(tt),Object.freeze(rt);function Pn(n,e){this.x=n,this.y=e,this.axis=void 0,this.slope=e/n,this.normalSlope=-n/e,Object.freeze(this)}Pn.prototype.distance=function(n,e,t,i){return this.x*tt.distance(n,e,t,i)+this.y*rt.distance(n,e,t,i)},Pn.prototype.interpolate=function(n,e,t,i){let s,o,r,l,a,c,u;if(r=i.distance(n,e,!0,!0),l=i.distance(n,t,!0,!0),s=i.distance(e,e,!1,!0),o=i.distance(t,t,!1,!0),a=Math.abs(r),c=Math.abs(l),u=a+c,u===0){this.setRelative(n,n,(s+o)/2,i,!0);return}this.setRelative(n,n,(s*c+o*a)/u,i,!0)},Pn.prototype.setRelative=function(n,e,t,i,s){i=i||this;const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y,c=i.normalSlope,u=this.slope,h=n.x,f=n.y;n.x=(u*h-c*l+a-f)/(u-c),n.y=u*(n.x-h)+f},Pn.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function Fn(n,e){const t=Math.sqrt(n*n+e*e);return n/=t,e/=t,n===1&&e===0?tt:n===0&&e===1?rt:new Pn(n,e)}function at(n,e,t,i){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}at.prototype.nextTouched=function(n){let e=this.nextPointOnContour;for(;!n.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},at.prototype.prevTouched=function(n){let e=this.prevPointOnContour;for(;!n.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};const Rn=Object.freeze(new at(0,0)),BA={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Et(n,e){switch(this.env=n,this.stack=[],this.prog=e,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=tt,this.round=Fl}}Pl.prototype.exec=function(n,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;const t=this.font;let i=this._prepState;if(!i||i.ppem!==e){let s=this._fpgmState;if(!s){Et.prototype=BA,s=this._fpgmState=new Et("fpgm",t.tables.fpgm),s.funcs=[],s.font=t,_.DEBUG&&(console.log("---EXEC FPGM---"),s.step=-1);try{Ot(s)}catch(r){console.log("Hinting error in FPGM:"+r),this._errorState=3;return}}Et.prototype=s,i=this._prepState=new Et("prep",t.tables.prep),i.ppem=e;const o=t.tables.cvt;if(o){const r=i.cvt=new Array(o.length),l=e/t.unitsPerEm;for(let a=0;a<o.length;a++)r[a]=o[a]*l}else i.cvt=[];_.DEBUG&&(console.log("---EXEC PREP---"),i.step=-1);try{Ot(i)}catch(r){this._errorState<2&&console.log("Hinting error in PREP:"+r),this._errorState=2}}if(!(this._errorState>1))try{return kl(n,i)}catch(s){this._errorState<1&&(console.log("Hinting error:"+s),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},kl=function(n,e){const t=e.ppem/e.font.unitsPerEm,i=t;let s=n.components,o,r,l;if(Et.prototype=e,!s)l=new Et("glyf",n.instructions),_.DEBUG&&(console.log("---EXEC GLYPH---"),l.step=-1),to(n,l,t,i),r=l.gZone;else{const a=e.font;r=[],o=[];for(let c=0;c<s.length;c++){const u=s[c],h=a.glyphs.get(u.glyphIndex);l=new Et("glyf",h.instructions),_.DEBUG&&(console.log("---EXEC COMP "+c+"---"),l.step=-1),to(h,l,t,i);const f=Math.round(u.dx*t),p=Math.round(u.dy*i),A=l.gZone,C=l.contours;for(let y=0;y<A.length;y++){const E=A[y];E.xTouched=E.yTouched=!1,E.xo=E.x=E.x+f,E.yo=E.y=E.y+p}const m=r.length;r.push.apply(r,A);for(let y=0;y<C.length;y++)o.push(C[y]+m)}n.instructions&&!l.inhibitGridFit&&(l=new Et("glyf",n.instructions),l.gZone=l.z0=l.z1=l.z2=r,l.contours=o,r.push(new at(0,0),new at(Math.round(n.advanceWidth*t),0)),_.DEBUG&&(console.log("---EXEC COMPOSITE---"),l.step=-1),Ot(l),r.length-=2)}return r},to=function(n,e,t,i){const s=n.points||[],o=s.length,r=e.gZone=e.z0=e.z1=e.z2=[],l=e.contours=[];let a;for(let h=0;h<o;h++)a=s[h],r[h]=new at(a.x*t,a.y*i,a.lastPointOfContour,a.onCurve);let c,u;for(let h=0;h<o;h++)a=r[h],c||(c=a,l.push(h)),a.lastPointOfContour?(a.nextPointOnContour=c,c.prevPointOnContour=a,c=void 0):(u=r[h+1],a.nextPointOnContour=u,u.prevPointOnContour=a);if(!e.inhibitGridFit){if(_.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let h=0;h<o;h++)console.log(h,r[h].x,r[h].y)}if(r.push(new at(0,0),new at(Math.round(n.advanceWidth*t),0)),Ot(e),r.length-=2,_.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let h=0;h<o;h++)console.log(h,r[h].x,r[h].y)}}},Ot=function(n){let e=n.prog;if(!e)return;const t=e.length;let i;for(n.ip=0;n.ip<t;n.ip++){if(_.DEBUG&&n.step++,i=Dl[e[n.ip]],!i)throw new Error("unknown instruction: 0x"+Number(e[n.ip]).toString(16));i(n)}};function Ti(n){const e=n.tZone=new Array(n.gZone.length);for(let t=0;t<e.length;t++)e[t]=new at(0,0)}function Ol(n,e){const t=n.prog;let i=n.ip,s=1,o;do if(o=t[++i],o===88)s++;else if(o===89)s--;else if(o===64)i+=t[i+1]+1;else if(o===65)i+=2*t[i+1]+1;else if(o>=176&&o<=183)i+=o-176+1;else if(o>=184&&o<=191)i+=(o-184+1)*2;else if(e&&s===1&&o===27)break;while(s>0);n.ip=i}function Ll(n,e){_.DEBUG&&console.log(e.step,"SVTCA["+n.axis+"]"),e.fv=e.pv=e.dpv=n}function Nl(n,e){_.DEBUG&&console.log(e.step,"SPVTCA["+n.axis+"]"),e.pv=e.dpv=n}function Ul(n,e){_.DEBUG&&console.log(e.step,"SFVTCA["+n.axis+"]"),e.fv=n}function _l(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log("SPVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.pv=e.dpv=Fn(l,a)}function Ql(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log("SFVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.fv=Fn(l,a)}function SA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.pv=n.dpv=Fn(i,t)}function MA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.fv=Fn(i,t)}function TA(n){const e=n.stack,t=n.pv;_.DEBUG&&console.log(n.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function DA(n){const e=n.stack,t=n.fv;_.DEBUG&&console.log(n.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function kA(n){n.fv=n.pv,_.DEBUG&&console.log(n.step,"SFVTPV[]")}function PA(n){const e=n.stack,t=e.pop(),i=e.pop(),s=e.pop(),o=e.pop(),r=e.pop(),l=n.z0,a=n.z1,c=l[t],u=l[i],h=a[s],f=a[o],p=n.z2[r];_.DEBUG&&console.log("ISECT[], ",t,i,s,o,r);const A=c.x,C=c.y,m=u.x,y=u.y,E=h.x,x=h.y,M=f.x,T=f.y,S=(A-m)*(x-T)-(C-y)*(E-M),I=A*y-C*m,g=E*T-x*M;p.x=(I*(E-M)-g*(A-m))/S,p.y=(I*(x-T)-g*(C-y))/S}function FA(n){n.rp0=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP0[]",n.rp0)}function RA(n){n.rp1=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP1[]",n.rp1)}function OA(n){n.rp2=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP2[]",n.rp2)}function LA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP0[]",e),n.zp0=e,e){case 0:n.tZone||Ti(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function NA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP1[]",e),n.zp1=e,e){case 0:n.tZone||Ti(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function UA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP2[]",e),n.zp2=e,e){case 0:n.tZone||Ti(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function _A(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZPS[]",e),n.zp0=n.zp1=n.zp2=e,e){case 0:n.tZone||Ti(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function QA(n){n.loop=n.stack.pop(),_.DEBUG&&console.log(n.step,"SLOOP[]",n.loop)}function HA(n){_.DEBUG&&console.log(n.step,"RTG[]"),n.round=Fl}function GA(n){_.DEBUG&&console.log(n.step,"RTHG[]"),n.round=vA}function YA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SMD[]",e),n.minDis=e/64}function VA(n){_.DEBUG&&console.log(n.step,"ELSE[]"),Ol(n,!1)}function WA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"JMPR[]",e),n.ip+=e-1}function zA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCVTCI[]",e),n.cvCutIn=e/64}function jA(n){const e=n.stack;_.DEBUG&&console.log(n.step,"DUP[]"),e.push(e[e.length-1])}function no(n){_.DEBUG&&console.log(n.step,"POP[]"),n.stack.pop()}function $A(n){_.DEBUG&&console.log(n.step,"CLEAR[]"),n.stack.length=0}function KA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SWAP[]"),e.push(t),e.push(i)}function XA(n){const e=n.stack;_.DEBUG&&console.log(n.step,"DEPTH[]"),e.push(e.length)}function qA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LOOPCALL[]",t,i);const s=n.ip,o=n.prog;n.prog=n.funcs[t];for(let r=0;r<i;r++)Ot(n),_.DEBUG&&console.log(++n.step,r+1<i?"next loopcall":"done loopcall",r);n.ip=s,n.prog=o}function JA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"CALL[]",e);const t=n.ip,i=n.prog;n.prog=n.funcs[e],Ot(n),n.ip=t,n.prog=i,_.DEBUG&&console.log(++n.step,"returning from",e)}function ZA(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"CINDEX[]",t),e.push(e[e.length-t])}function ey(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function ty(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");const e=n.stack,t=n.prog;let i=n.ip;const s=e.pop(),o=i;for(_.DEBUG&&console.log(n.step,"FDEF[]",s);t[++i]!==45;);n.ip=i,n.funcs[s]=t.slice(o+1,i)}function Hl(n,e){const t=e.stack.pop(),i=e.z0[t],s=e.fv,o=e.pv;_.DEBUG&&console.log(e.step,"MDAP["+n+"]",t);let r=o.distance(i,Rn);n&&(r=e.round(r)),s.setRelative(i,Rn,r,o),s.touch(i),e.rp0=e.rp1=t}function Gl(n,e){const t=e.z2,i=t.length-2;let s,o,r;_.DEBUG&&console.log(e.step,"IUP["+n.axis+"]");for(let l=0;l<i;l++)s=t[l],!n.touched(s)&&(o=s.prevTouched(n),o!==s&&(r=s.nextTouched(n),o===r&&n.setRelative(s,s,n.distance(o,o,!1,!0),n,!0),n.interpolate(s,o,r,n)))}function Yl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv;let l=e.loop;const a=e.z2;for(;l--;){const c=t.pop(),u=a[c],h=r.distance(s,s,!1,!0);o.setRelative(u,u,h,r),o.touch(u),_.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-l)+": ":"")+"SHP["+(n?"rp1":"rp2")+"]",c)}e.loop=1}function Vl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv,l=t.pop(),a=e.z2[e.contours[l]];let c=a;_.DEBUG&&console.log(e.step,"SHC["+n+"]",l);const u=r.distance(s,s,!1,!0);do c!==s&&o.setRelative(c,c,u,r),c=c.nextPointOnContour;while(c!==a)}function Wl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv,l=t.pop();_.DEBUG&&console.log(e.step,"SHZ["+n+"]",l);let a;switch(l){case 0:a=e.tZone;break;case 1:a=e.gZone;break;default:throw new Error("Invalid zone")}let c;const u=r.distance(s,s,!1,!0),h=a.length-2;for(let f=0;f<h;f++)c=a[f],o.setRelative(c,c,u,r)}function ny(n){const e=n.stack;let t=n.loop;const i=n.fv,s=e.pop()/64,o=n.z2;for(;t--;){const r=e.pop(),l=o[r];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-t)+": ":"")+"SHPIX[]",r,s),i.setRelative(l,l,s),i.touch(l)}n.loop=1}function iy(n){const e=n.stack,t=n.rp1,i=n.rp2;let s=n.loop;const o=n.z0[t],r=n.z1[i],l=n.fv,a=n.dpv,c=n.z2;for(;s--;){const u=e.pop(),h=c[u];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-s)+": ":"")+"IP[]",u,t,"<->",i),l.interpolate(h,o,r,a),l.touch(h)}n.loop=1}function zl(n,e){const t=e.stack,i=t.pop()/64,s=t.pop(),o=e.z1[s],r=e.z0[e.rp0],l=e.fv,a=e.pv;l.setRelative(o,r,i,a),l.touch(o),_.DEBUG&&console.log(e.step,"MSIRP["+n+"]",i,s),e.rp1=e.rp0,e.rp2=s,n&&(e.rp0=s)}function sy(n){const e=n.stack,t=n.rp0,i=n.z0[t];let s=n.loop;const o=n.fv,r=n.pv,l=n.z1;for(;s--;){const a=e.pop(),c=l[a];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-s)+": ":"")+"ALIGNRP[]",a),o.setRelative(c,i,0,r),o.touch(c)}n.loop=1}function oy(n){_.DEBUG&&console.log(n.step,"RTDG[]"),n.round=bA}function jl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z0[s],r=e.fv,l=e.pv;let a=e.cvt[i];_.DEBUG&&console.log(e.step,"MIAP["+n+"]",i,"(",a,")",s);let c=l.distance(o,Rn);n&&(Math.abs(c-a)<e.cvCutIn&&(c=a),c=e.round(c)),r.setRelative(o,Rn,c,l),e.zp0===0&&(o.xo=o.x,o.yo=o.y),r.touch(o),e.rp0=e.rp1=s}function ry(n){const e=n.prog;let t=n.ip;const i=n.stack,s=e[++t];_.DEBUG&&console.log(n.step,"NPUSHB[]",s);for(let o=0;o<s;o++)i.push(e[++t]);n.ip=t}function ay(n){let e=n.ip;const t=n.prog,i=n.stack,s=t[++e];_.DEBUG&&console.log(n.step,"NPUSHW[]",s);for(let o=0;o<s;o++){let r=t[++e]<<8|t[++e];r&32768&&(r=-((r^65535)+1)),i.push(r)}n.ip=e}function ly(n){const e=n.stack;let t=n.store;t||(t=n.store=[]);const i=e.pop(),s=e.pop();_.DEBUG&&console.log(n.step,"WS",i,s),t[s]=i}function cy(n){const e=n.stack,t=n.store,i=e.pop();_.DEBUG&&console.log(n.step,"RS",i);const s=t&&t[i]||0;e.push(s)}function dy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"WCVTP",t,i),n.cvt[i]=t/64}function uy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"RCVT",t),e.push(n.cvt[t]*64)}function $l(n,e){const t=e.stack,i=t.pop(),s=e.z2[i];_.DEBUG&&console.log(e.step,"GC["+n+"]",i),t.push(e.dpv.distance(s,Rn,n,!1)*64)}function Kl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z1[i],r=e.z0[s],l=e.dpv.distance(r,o,n,n);_.DEBUG&&console.log(e.step,"MD["+n+"]",i,s,"->",l),e.stack.push(Math.round(l*64))}function hy(n){_.DEBUG&&console.log(n.step,"MPPEM[]"),n.stack.push(n.ppem)}function fy(n){_.DEBUG&&console.log(n.step,"FLIPON[]"),n.autoFlip=!0}function py(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LT[]",t,i),e.push(i<t?1:0)}function gy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LTEQ[]",t,i),e.push(i<=t?1:0)}function my(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"GT[]",t,i),e.push(i>t?1:0)}function Ay(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function yy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"EQ[]",t,i),e.push(t===i?1:0)}function Cy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function Ey(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function wy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function by(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"IF[]",e),e||(Ol(n,!0),_.DEBUG&&console.log(n.step,"EIF[]"))}function vy(n){_.DEBUG&&console.log(n.step,"EIF[]")}function xy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"AND[]",t,i),e.push(t&&i?1:0)}function Iy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"OR[]",t,i),e.push(t||i?1:0)}function By(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"NOT[]",t),e.push(t?0:1)}function io(n,e){const t=e.stack,i=t.pop(),s=e.fv,o=e.pv,r=e.ppem,l=e.deltaBase+(n-1)*16,a=e.deltaShift,c=e.z0;_.DEBUG&&console.log(e.step,"DELTAP["+n+"]",i,t);for(let u=0;u<i;u++){const h=t.pop(),f=t.pop();if(l+((f&240)>>4)!==r)continue;let A=(f&15)-8;A>=0&&A++,_.DEBUG&&console.log(e.step,"DELTAPFIX",h,"by",A*a);const C=c[h];s.setRelative(C,C,A*a,o)}}function Sy(n){const t=n.stack.pop();_.DEBUG&&console.log(n.step,"SDB[]",t),n.deltaBase=t}function My(n){const t=n.stack.pop();_.DEBUG&&console.log(n.step,"SDS[]",t),n.deltaShift=Math.pow(.5,t)}function Ty(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"ADD[]",t,i),e.push(i+t)}function Dy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SUB[]",t,i),e.push(i-t)}function ky(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"DIV[]",t,i),e.push(i*64/t)}function Py(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MUL[]",t,i),e.push(i*t/64)}function Fy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"ABS[]",t),e.push(Math.abs(t))}function Ry(n){const e=n.stack;let t=e.pop();_.DEBUG&&console.log(n.step,"NEG[]",t),e.push(-t)}function Oy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function Ly(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Di(n,e){const t=e.stack,i=t.pop();_.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function Ny(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"WCVTF[]",t,i),n.cvt[i]=t*n.ppem/n.font.unitsPerEm}function so(n,e){const t=e.stack,i=t.pop(),s=e.ppem,o=e.deltaBase+(n-1)*16,r=e.deltaShift;_.DEBUG&&console.log(e.step,"DELTAC["+n+"]",i,t);for(let l=0;l<i;l++){const a=t.pop(),c=t.pop();if(o+((c&240)>>4)!==s)continue;let h=(c&15)-8;h>=0&&h++;const f=h*r;_.DEBUG&&console.log(e.step,"DELTACFIX",a,"by",f),e.cvt[a]+=f}}function Uy(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"SROUND[]",e),n.round=Rl;let t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function _y(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"S45ROUND[]",e),n.round=Rl;let t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function Qy(n){_.DEBUG&&console.log(n.step,"ROFF[]"),n.round=wA}function Hy(n){_.DEBUG&&console.log(n.step,"RUTG[]"),n.round=xA}function Gy(n){_.DEBUG&&console.log(n.step,"RDTG[]"),n.round=IA}function Yy(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCANCTRL[]",e)}function Xl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log(e.step,"SDPVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.dpv=Fn(l,a)}function Vy(n){const e=n.stack,t=e.pop();let i=0;_.DEBUG&&console.log(n.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function Wy(n){const e=n.stack,t=e.pop(),i=e.pop(),s=e.pop();_.DEBUG&&console.log(n.step,"ROLL[]"),e.push(i),e.push(t),e.push(s)}function zy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MAX[]",t,i),e.push(Math.max(i,t))}function jy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MIN[]",t,i),e.push(Math.min(i,t))}function $y(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCANTYPE[]",e)}function Ky(n){const e=n.stack.pop();let t=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"INSTCTRL[]",e,t),e){case 1:n.inhibitGridFit=!!t;return;case 2:n.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function wt(n,e){const t=e.stack,i=e.prog;let s=e.ip;_.DEBUG&&console.log(e.step,"PUSHB["+n+"]");for(let o=0;o<n;o++)t.push(i[++s]);e.ip=s}function bt(n,e){let t=e.ip;const i=e.prog,s=e.stack;_.DEBUG&&console.log(e.ip,"PUSHW["+n+"]");for(let o=0;o<n;o++){let r=i[++t]<<8|i[++t];r&32768&&(r=-((r^65535)+1)),s.push(r)}e.ip=t}function K(n,e,t,i,s,o){const r=o.stack,l=n&&r.pop(),a=r.pop(),c=o.rp0,u=o.z0[c],h=o.z1[a],f=o.minDis,p=o.fv,A=o.dpv;let C,m,y,E;m=C=A.distance(h,u,!0,!0),y=m>=0?1:-1,m=Math.abs(m),n&&(E=o.cvt[l],i&&Math.abs(m-E)<o.cvCutIn&&(m=E)),t&&m<f&&(m=f),i&&(m=o.round(m)),p.setRelative(h,u,y*m,A),p.touch(h),_.DEBUG&&console.log(o.step,(n?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(i?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"]",n?l+"("+o.cvt[l]+","+E+")":"",a,"(d =",C,"->",y*m,")"),o.rp1=o.rp0,o.rp2=a,e&&(o.rp0=a)}Dl=[Ll.bind(void 0,rt),Ll.bind(void 0,tt),Nl.bind(void 0,rt),Nl.bind(void 0,tt),Ul.bind(void 0,rt),Ul.bind(void 0,tt),_l.bind(void 0,0),_l.bind(void 0,1),Ql.bind(void 0,0),Ql.bind(void 0,1),SA,MA,TA,DA,kA,PA,FA,RA,OA,LA,NA,UA,_A,QA,HA,GA,YA,VA,WA,zA,void 0,void 0,jA,no,$A,KA,XA,ZA,ey,void 0,void 0,void 0,qA,JA,ty,void 0,Hl.bind(void 0,0),Hl.bind(void 0,1),Gl.bind(void 0,rt),Gl.bind(void 0,tt),Yl.bind(void 0,0),Yl.bind(void 0,1),Vl.bind(void 0,0),Vl.bind(void 0,1),Wl.bind(void 0,0),Wl.bind(void 0,1),ny,iy,zl.bind(void 0,0),zl.bind(void 0,1),sy,oy,jl.bind(void 0,0),jl.bind(void 0,1),ry,ay,ly,cy,dy,uy,$l.bind(void 0,0),$l.bind(void 0,1),void 0,Kl.bind(void 0,0),Kl.bind(void 0,1),hy,void 0,fy,void 0,void 0,py,gy,my,Ay,yy,Cy,Ey,wy,by,vy,xy,Iy,By,io.bind(void 0,1),Sy,My,Ty,Dy,ky,Py,Fy,Ry,Oy,Ly,Di.bind(void 0,0),Di.bind(void 0,1),Di.bind(void 0,2),Di.bind(void 0,3),void 0,void 0,void 0,void 0,Ny,io.bind(void 0,2),io.bind(void 0,3),so.bind(void 0,1),so.bind(void 0,2),so.bind(void 0,3),Uy,_y,void 0,void 0,Qy,void 0,Hy,Gy,no,no,void 0,void 0,void 0,void 0,void 0,Yy,Xl.bind(void 0,0),Xl.bind(void 0,1),Vy,void 0,Wy,zy,jy,$y,Ky,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,wt.bind(void 0,1),wt.bind(void 0,2),wt.bind(void 0,3),wt.bind(void 0,4),wt.bind(void 0,5),wt.bind(void 0,6),wt.bind(void 0,7),wt.bind(void 0,8),bt.bind(void 0,1),bt.bind(void 0,2),bt.bind(void 0,3),bt.bind(void 0,4),bt.bind(void 0,5),bt.bind(void 0,6),bt.bind(void 0,7),bt.bind(void 0,8),K.bind(void 0,0,0,0,0,0),K.bind(void 0,0,0,0,0,1),K.bind(void 0,0,0,0,0,2),K.bind(void 0,0,0,0,0,3),K.bind(void 0,0,0,0,1,0),K.bind(void 0,0,0,0,1,1),K.bind(void 0,0,0,0,1,2),K.bind(void 0,0,0,0,1,3),K.bind(void 0,0,0,1,0,0),K.bind(void 0,0,0,1,0,1),K.bind(void 0,0,0,1,0,2),K.bind(void 0,0,0,1,0,3),K.bind(void 0,0,0,1,1,0),K.bind(void 0,0,0,1,1,1),K.bind(void 0,0,0,1,1,2),K.bind(void 0,0,0,1,1,3),K.bind(void 0,0,1,0,0,0),K.bind(void 0,0,1,0,0,1),K.bind(void 0,0,1,0,0,2),K.bind(void 0,0,1,0,0,3),K.bind(void 0,0,1,0,1,0),K.bind(void 0,0,1,0,1,1),K.bind(void 0,0,1,0,1,2),K.bind(void 0,0,1,0,1,3),K.bind(void 0,0,1,1,0,0),K.bind(void 0,0,1,1,0,1),K.bind(void 0,0,1,1,0,2),K.bind(void 0,0,1,1,0,3),K.bind(void 0,0,1,1,1,0),K.bind(void 0,0,1,1,1,1),K.bind(void 0,0,1,1,1,2),K.bind(void 0,0,1,1,1,3),K.bind(void 0,1,0,0,0,0),K.bind(void 0,1,0,0,0,1),K.bind(void 0,1,0,0,0,2),K.bind(void 0,1,0,0,0,3),K.bind(void 0,1,0,0,1,0),K.bind(void 0,1,0,0,1,1),K.bind(void 0,1,0,0,1,2),K.bind(void 0,1,0,0,1,3),K.bind(void 0,1,0,1,0,0),K.bind(void 0,1,0,1,0,1),K.bind(void 0,1,0,1,0,2),K.bind(void 0,1,0,1,0,3),K.bind(void 0,1,0,1,1,0),K.bind(void 0,1,0,1,1,1),K.bind(void 0,1,0,1,1,2),K.bind(void 0,1,0,1,1,3),K.bind(void 0,1,1,0,0,0),K.bind(void 0,1,1,0,0,1),K.bind(void 0,1,1,0,0,2),K.bind(void 0,1,1,0,0,3),K.bind(void 0,1,1,0,1,0),K.bind(void 0,1,1,0,1,1),K.bind(void 0,1,1,0,1,2),K.bind(void 0,1,1,0,1,3),K.bind(void 0,1,1,1,0,0),K.bind(void 0,1,1,1,0,1),K.bind(void 0,1,1,1,0,2),K.bind(void 0,1,1,1,0,3),K.bind(void 0,1,1,1,1,0),K.bind(void 0,1,1,1,1,1),K.bind(void 0,1,1,1,1,2),K.bind(void 0,1,1,1,1,3)];const Xy=Array.from||(n=>n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]);function de(n){n=n||{},n.empty||(an(n.familyName,"When creating a new Font object, familyName is required."),an(n.styleName,"When creating a new Font object, styleName is required."),an(n.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),an(n.ascender,"When creating a new Font object, ascender is required."),an(n.descender,"When creating a new Font object, descender is required."),an(n.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:n.familyName||" "},fontSubfamily:{en:n.styleName||" "},fullName:{en:n.fullName||n.familyName+" "+n.styleName},postScriptName:{en:n.postScriptName||(n.familyName+n.styleName).replace(/\s/g,"")},designer:{en:n.designer||" "},designerURL:{en:n.designerURL||" "},manufacturer:{en:n.manufacturer||" "},manufacturerURL:{en:n.manufacturerURL||" "},license:{en:n.license||" "},licenseURL:{en:n.licenseURL||" "},version:{en:n.version||"Version 0.1"},description:{en:n.description||" "},copyright:{en:n.copyright||" "},trademark:{en:n.trademark||" "}},this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.tables={os2:{usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,fsSelection:n.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new on.GlyphSet(this,n.glyphs||[]),this.encoding=new Wa(this),this.position=new kn(this),this.substitution=new Ve(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new Pl(this)}})}de.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)!==null},de.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},de.prototype.charToGlyph=function(n){const e=this.charToGlyphIndex(n);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},de.prototype.stringToGlyphs=function(n,e){e=e||this.defaultRenderOptions;const t=Xy(n),i=[];for(let l=0;l<t.length;l+=1){const a=t[l];i.push(this.charToGlyphIndex(a))}let s=i.length;if(e.features){const l=e.script||this.substitution.getDefaultScriptName();let a=[];e.features.liga&&(a=a.concat(this.substitution.getFeature("liga",l,e.language))),e.features.rlig&&(a=a.concat(this.substitution.getFeature("rlig",l,e.language)));for(let c=0;c<s;c+=1)for(let u=0;u<a.length;u++){const h=a[u],f=h.sub,p=f.length;let A=0;for(;A<p&&f[A]===i[c+A];)A++;A===p&&(i.splice(c,p,h.by),s=s-p+1)}}const o=new Array(s),r=this.glyphs.get(0);for(let l=0;l<s;l+=1)o[l]=this.glyphs.get(i[l])||r;return o},de.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},de.prototype.nameToGlyph=function(n){const e=this.nameToGlyphIndex(n);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},de.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},de.prototype.getKerningValue=function(n,e){n=n.index||n,e=e.index||e;const t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,n,e):this.kerningPairs[n+","+e]||0},de.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},de.prototype.forEachGlyph=function(n,e,t,i,s,o){e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:72,s=s||this.defaultRenderOptions;const r=1/this.unitsPerEm*i,l=this.stringToGlyphs(n,s);let a;if(s.kerning){const c=s.script||this.position.getDefaultScriptName();a=this.position.getKerningTables(c,s.language)}for(let c=0;c<l.length;c+=1){const u=l[c];if(o.call(this,u,e,t,i,s),u.advanceWidth&&(e+=u.advanceWidth*r),s.kerning&&c<l.length-1){const h=a?this.position.getKerningValue(a,u.index,l[c+1].index):this.getKerningValue(u,l[c+1]);e+=h*r}s.letterSpacing?e+=s.letterSpacing*i:s.tracking&&(e+=s.tracking/1e3*i)}return e},de.prototype.getPath=function(n,e,t,i,s){const o=new be;return this.forEachGlyph(n,e,t,i,s,function(r,l,a,c){const u=r.getPath(l,a,c,s,this);o.extend(u)}),o},de.prototype.getPaths=function(n,e,t,i,s){const o=[];return this.forEachGlyph(n,e,t,i,s,function(r,l,a,c){const u=r.getPath(l,a,c,s,this);o.push(u)}),o},de.prototype.getAdvanceWidth=function(n,e,t){return this.forEachGlyph(n,0,0,e,t,function(){})},de.prototype.draw=function(n,e,t,i,s,o){this.getPath(e,t,i,s,o).draw(n)},de.prototype.drawPoints=function(n,e,t,i,s,o){this.forEachGlyph(e,t,i,s,o,function(r,l,a,c){r.drawPoints(n,l,a,c)})},de.prototype.drawMetrics=function(n,e,t,i,s,o){this.forEachGlyph(e,t,i,s,o,function(r,l,a,c){r.drawMetrics(n,l,a,c)})},de.prototype.getEnglishName=function(n){const e=this.names[n];if(e)return e.en},de.prototype.validate=function(){const n=this;function e(i,s){}function t(i){const s=n.getEnglishName(i);s&&s.trim().length>0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0},de.prototype.toTables=function(){return hA.fontToTable(this)},de.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},de.prototype.toArrayBuffer=function(){const e=this.toTables().encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<e.length;s++)i[s]=e[s];return t},de.prototype.download=function(n){const e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");n=n||e.replace(/\s/g,"")+"-"+t+".otf";const i=this.toArrayBuffer();if(pA())if(window.URL=window.URL||window.webkitURL,window.URL){const s=new DataView(i),o=new Blob([s],{type:"font/opentype"});let r=document.createElement("a");r.href=window.URL.createObjectURL(o),r.download=n;let l=document.createEvent("MouseEvents");l.initEvent("click",!0,!1),r.dispatchEvent(l)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{const s=require("fs"),o=mA(i);s.writeFileSync(n,o)}},de.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},de.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},de.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function ql(n,e){const t=JSON.stringify(n);let i=256;for(let s in e){let o=parseInt(s);if(!(!o||o<256)){if(JSON.stringify(e[s])===t)return o;i<=o&&(i=o+1)}}return e[i]=n,i}function qy(n,e,t){const i=ql(e.name,t);return[{name:"tag_"+n,type:"TAG",value:e.tag},{name:"minValue_"+n,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:i}]}function Jy(n,e,t){const i={},s=new q.Parser(n,e);return i.tag=s.parseTag(),i.minValue=s.parseFixed(),i.defaultValue=s.parseFixed(),i.maxValue=s.parseFixed(),s.skip("uShort",1),i.name=t[s.parseUShort()]||{},i}function Zy(n,e,t,i){const s=ql(e.name,i),o=[{name:"nameID_"+n,type:"USHORT",value:s},{name:"flags_"+n,type:"USHORT",value:0}];for(let r=0;r<t.length;++r){const l=t[r].tag;o.push({name:"axis_"+n+" "+l,type:"FIXED",value:e.coordinates[l]<<16})}return o}function e0(n,e,t,i){const s={},o=new q.Parser(n,e);s.name=i[o.parseUShort()]||{},o.skip("uShort",1),s.coordinates={};for(let r=0;r<t.length;++r)s.coordinates[t[r].tag]=o.parseFixed();return s}function t0(n,e){const t=new Z.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:n.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:n.instances.length},{name:"instanceSize",type:"USHORT",value:4+n.axes.length*4}]);t.offsetToData=t.sizeOf();for(let i=0;i<n.axes.length;i++)t.fields=t.fields.concat(qy(i,n.axes[i],e));for(let i=0;i<n.instances.length;i++)t.fields=t.fields.concat(Zy(i,n.instances[i],n.axes,e));return t}function n0(n,e,t){const i=new q.Parser(n,e),s=i.parseULong();ie.argument(s===65536,"Unsupported fvar table version.");const o=i.parseOffset16();i.skip("uShort",1);const r=i.parseUShort(),l=i.parseUShort(),a=i.parseUShort(),c=i.parseUShort(),u=[];for(let p=0;p<r;p++)u.push(Jy(n,e+o+p*l,t));const h=[],f=e+o+r*l;for(let p=0;p<a;p++)h.push(e0(n,f+p*c,u,t));return{axes:u,instances:h}}const i0={make:t0,parse:n0},We=new Array(10);We[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(H.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(H.coverage),values:this.parseValueRecordList()};ie.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},We[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();ie.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");const i=this.parsePointer(H.coverage),s=this.parseUShort(),o=this.parseUShort();if(t===1)return{posFormat:t,coverage:i,valueFormat1:s,valueFormat2:o,pairSets:this.parseList(H.pointer(H.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}})))};if(t===2){const r=this.parsePointer(H.classDef),l=this.parsePointer(H.classDef),a=this.parseUShort(),c=this.parseUShort();return{posFormat:t,coverage:i,valueFormat1:s,valueFormat2:o,classDef1:r,classDef2:l,class1Count:a,class2Count:c,classRecords:this.parseList(a,H.list(c,function(){return{value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}}))}}},We[3]=function(){return{error:"GPOS Lookup 3 not supported"}},We[4]=function(){return{error:"GPOS Lookup 4 not supported"}},We[5]=function(){return{error:"GPOS Lookup 5 not supported"}},We[6]=function(){return{error:"GPOS Lookup 6 not supported"}},We[7]=function(){return{error:"GPOS Lookup 7 not supported"}},We[8]=function(){return{error:"GPOS Lookup 8 not supported"}},We[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function s0(n,e){e=e||0;const t=new H(n,e),i=t.parseVersion(1);return ie.argument(i===1||i===1.1,"Unsupported GPOS table version "+i),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We),variations:t.parseFeatureVariationsList()}}const o0=new Array(10);function r0(n){return new Z.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(n.lookups,o0)}])}const a0={parse:s0,make:r0};function l0(n){const e={};n.skip("uShort");const t=n.parseUShort();ie.argument(t===0,"Unsupported kern sub-table version."),n.skip("uShort",2);const i=n.parseUShort();n.skip("uShort",3);for(let s=0;s<i;s+=1){const o=n.parseUShort(),r=n.parseUShort(),l=n.parseShort();e[o+","+r]=l}return e}function c0(n){const e={};n.skip("uShort"),n.parseULong()>1&&console.warn("Only the first kern subtable is supported."),n.skip("uLong");const s=n.parseUShort()&255;if(n.skip("uShort"),s===0){const o=n.parseUShort();n.skip("uShort",3);for(let r=0;r<o;r+=1){const l=n.parseUShort(),a=n.parseUShort(),c=n.parseShort();e[l+","+a]=c}}return e}function d0(n,e){const t=new q.Parser(n,e),i=t.parseUShort();if(i===0)return l0(t);if(i===1)return c0(t);throw new Error("Unsupported kern table version ("+i+").")}const u0={parse:d0};function h0(n,e,t,i){const s=new q.Parser(n,e),o=i?s.parseUShort:s.parseULong,r=[];for(let l=0;l<t+1;l+=1){let a=o.call(s);i&&(a*=2),r.push(a)}return r}const f0={parse:h0};function p0(n,e){require("fs").readFile(n,function(i,s){if(i)return e(i.message);e(null,gA(s))})}function g0(n,e){const t=new XMLHttpRequest;t.open("get",n,!0),t.responseType="arraybuffer",t.onload=function(){return t.response?e(null,t.response):e("Font could not be loaded: "+t.statusText)},t.onerror=function(){e("Font could not be loaded")},t.send()}function Jl(n,e){const t=[];let i=12;for(let s=0;s<e;s+=1){const o=q.getTag(n,i),r=q.getULong(n,i+4),l=q.getULong(n,i+8),a=q.getULong(n,i+12);t.push({tag:o,checksum:r,offset:l,length:a,compression:!1}),i+=16}return t}function m0(n,e){const t=[];let i=44;for(let s=0;s<e;s+=1){const o=q.getTag(n,i),r=q.getULong(n,i+4),l=q.getULong(n,i+8),a=q.getULong(n,i+12);let c;l<a?c="WOFF":c=!1,t.push({tag:o,offset:r,compression:c,compressedLength:l,length:a}),i+=20}return t}function we(n,e){if(e.compression==="WOFF"){const t=new Uint8Array(n.buffer,e.offset+2,e.compressedLength-2),i=new Uint8Array(e.length);if($g(t,i),i.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");return{data:new DataView(i.buffer,0),offset:0}}else return{data:n,offset:e.offset}}function A0(n){let e,t;const i=new de({empty:!0}),s=new DataView(n,0);let o,r=[];const l=q.getTag(s,0);if(l==="\0\0\0"||l==="true"||l==="typ1")i.outlinesFormat="truetype",o=q.getUShort(s,4),r=Jl(s,o);else if(l==="OTTO")i.outlinesFormat="cff",o=q.getUShort(s,4),r=Jl(s,o);else if(l==="wOFF"){const T=q.getTag(s,4);if(T==="\0\0\0")i.outlinesFormat="truetype";else if(T==="OTTO")i.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);o=q.getUShort(s,12),r=m0(s,o)}else throw new Error("Unsupported OpenType signature "+l);let a,c,u,h,f,p,A,C,m,y,E;for(let T=0;T<o;T+=1){const S=r[T];let I;switch(S.tag){case"cmap":I=we(s,S),i.tables.cmap=Va.parse(I.data,I.offset),i.encoding=new za(i.tables.cmap);break;case"cvt ":I=we(s,S),E=new q.Parser(I.data,I.offset),i.tables.cvt=E.parseShortList(S.length/2);break;case"fvar":c=S;break;case"fpgm":I=we(s,S),E=new q.Parser(I.data,I.offset),i.tables.fpgm=E.parseByteList(S.length);break;case"head":I=we(s,S),i.tables.head=ol.parse(I.data,I.offset),i.unitsPerEm=i.tables.head.unitsPerEm,e=i.tables.head.indexToLocFormat;break;case"hhea":I=we(s,S),i.tables.hhea=rl.parse(I.data,I.offset),i.ascender=i.tables.hhea.ascender,i.descender=i.tables.hhea.descender,i.numberOfHMetrics=i.tables.hhea.numberOfHMetrics;break;case"hmtx":p=S;break;case"ltag":I=we(s,S),t=ll.parse(I.data,I.offset);break;case"maxp":I=we(s,S),i.tables.maxp=cl.parse(I.data,I.offset),i.numGlyphs=i.tables.maxp.numGlyphs;break;case"name":m=S;break;case"OS/2":I=we(s,S),i.tables.os2=qs.parse(I.data,I.offset);break;case"post":I=we(s,S),i.tables.post=Al.parse(I.data,I.offset),i.glyphNames=new Ws(i.tables.post);break;case"prep":I=we(s,S),E=new q.Parser(I.data,I.offset),i.tables.prep=E.parseByteList(S.length);break;case"glyf":u=S;break;case"loca":C=S;break;case"CFF ":a=S;break;case"kern":A=S;break;case"GPOS":h=S;break;case"GSUB":f=S;break;case"meta":y=S;break}}const x=we(s,m);if(i.tables.name=ml.parse(x.data,x.offset,t),i.names=i.tables.name,u&&C){const T=e===0,S=we(s,C),I=f0.parse(S.data,S.offset,i.numGlyphs,T),g=we(s,u);i.glyphs=Tl.parse(g.data,g.offset,I,i)}else if(a){const T=we(s,a);sl.parse(T.data,T.offset,i)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");const M=we(s,p);if(al.parse(M.data,M.offset,i.numberOfHMetrics,i.numGlyphs,i.glyphs),fm(i),A){const T=we(s,A);i.kerningPairs=u0.parse(T.data,T.offset)}else i.kerningPairs={};if(h){const T=we(s,h);i.tables.gpos=a0.parse(T.data,T.offset),i.position.init()}if(f){const T=we(s,f);i.tables.gsub=yl.parse(T.data,T.offset)}if(c){const T=we(s,c);i.tables.fvar=i0.parse(T.data,T.offset,i.names)}if(y){const T=we(s,y);i.tables.meta=Cl.parse(T.data,T.offset),i.metas=i.tables.meta}return i}function y0(n,e){(typeof window>"u"?p0:g0)(n,function(s,o){if(s)return e(s);let r;try{r=A0(o)}catch(l){return e(l,null)}return e(null,r)})}const oo=1e-12;function On(n){if(!Array.isArray(n)||n.length===0)return n||[];const e=n[0],t=n[n.length-1];if(!e||!t||e.length<2||t.length<2)return n;const i=e[0]??0,s=e[1]??0,o=t[0]??0,r=t[1]??0;return(Math.abs(i-o)>oo||Math.abs(s-r)>oo)&&n.push([i,s]),n}function Lt(n){let e=0;if(!n)return 0;for(let t=0;t<n.length-1;t++){const i=n[t],s=n[t+1];if(!i||!s)continue;const o=i[0]??0,r=i[1]??0,l=s[0]??0,a=s[1]??0;e+=o*a-l*r}return e/2}function ki(n,e=oo){const t=[];if(!n)return t;for(const i of n){if(!i||i.length<2)continue;const s=t[t.length-1],o=i[0]??0,r=i[1]??0;if(!s){t.push([o,r]);continue}const l=s[0]??0,a=s[1]??0;(Math.abs(o-l)>e||Math.abs(r-a)>e)&&t.push([o,r])}return t}function C0(n,e,t,i,s=16){const o=[],r=n?.[0]??0,l=n?.[1]??0,a=t?.[0]??0,c=t?.[1]??0,u=i?.[0]??0,h=i?.[1]??0,f=e?.[0]??0,p=e?.[1]??0;for(let A=0;A<=s;A++){const C=A/s,m=1-C,y=m*m*m*r+3*m*m*C*a+3*m*C*C*u+C*C*C*f,E=m*m*m*l+3*m*m*C*c+3*m*C*C*h+C*C*C*p;o.push([y,E])}return o}function Zl(n,e){if(!n||!e)return!1;const t=n[0]??0,i=n[1]??0;let s=!1;for(let o=0,r=e.length-1;o<e.length;r=o++){const l=e[o],a=e[r];if(!l||!a)continue;const c=l[0]??0,u=l[1]??0,h=a[0]??0,f=a[1]??0;u>i!=f>i&&t<(h-c)*(i-u)/(f-u+0)+c&&(s=!s)}return s}function ro(n){return n?(Lt(n)<0&&n.reverse(),On(n),n):[]}function E0(n){return n?(Lt(n)>0&&n.reverse(),On(n),n):[]}function ec(n,e=16){if(!n||!Array.isArray(n.commands))return[];const t=[];let i=[];for(const s of n.commands){let o=function(l){const a=l.x!==void 0?l.x:0,c=l.y!==void 0?-l.y:0;return[a,c]};const r=s.type;if(r==="M")i.length&&t.push(ki(i)),i=[o(s)];else if(r==="L")i.push(o(s));else if(r==="Q"){const a=i[i.length-1]||o(s),c=[],u=s.x??0,h=s.y??0,f=s.x1??0,p=s.y1??0,A=a[0]??0,C=a[1]??0;for(let m=1;m<=e;m++){const y=m/e,E=1-y,x=E*E*A+2*E*y*f+y*y*u,M=E*E*C+2*E*y*p+y*y*-h;c.push([x,M])}c.length?i.push(...c):i.push(o(s))}else if(r==="C"){const a=i[i.length-1]||o(s),c=[s.x1||0,-(s.y1||0)],u=[s.x2||0,-(s.y2||0)],h=[s.x||0,-(s.y||0)],f=C0(a,h,c,u,e);f.length>1?i.push(...f.slice(1)):i.push(h)}else r==="Z"||r==="z"?(i.length&&t.push(ki(i)),i=[]):s.x!==void 0&&s.y!==void 0&&i.push(o(s))}return i.length&&t.push(ki(i)),t.map(s=>On(s)).filter(s=>s&&s.length>=4)}function ao(n,e){if(!n)return null;const t=n.map(i=>On(i.slice()));return{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{...e.properties||{},rings:t.length,polygons:1}}}function w0(n,e,t={}){t=Object.assign({sampleSegments:16,simplifyTolerance:0,epsArea:1e-24,debug:!1,scale:1,widthScale:.6,fillWinding:"auto"},t||{scale:1});const i=!!t.debug;if(!n||!n.geometry||!Array.isArray(n.geometry.coordinates))return{type:"FeatureCollection",features:[]};const s=n.geometry.coordinates,o=n.properties||{},r=o.text||o.label||"",l=o.rotation??0,a=t.sampleSegments||16,c=t.epsArea||1e-24,h=o.height/.9||1,f=(t.scale||1)*h,p=-l*Math.PI/180,A=Math.cos(p),C=Math.sin(p),m=o.attachmentPoint||"bottom-left",y=[];if(!e||typeof e.getPaths!="function")return{type:"FeatureCollection",features:y};const E=e.getPaths(r,0,0,t.fontSize||1)||[];let x=[];for(const L of E){const G=ec(L,a);for(const O of G)if(O)for(const v of O)v&&x.push(v)}let M=1/0,T=1/0,S=-1/0,I=-1/0;for(const L of x){if(!L)continue;const G=L[0]??0,O=L[1]??0;M=Math.min(M,G),T=Math.min(T,O),S=Math.max(S,G),I=Math.max(I,O)}const g=S-M,k=I-T;let P=0,F=0;switch(m){case"top-left":P=0,F=-k;break;case"top-center":P=-g/2,F=k;break;case"top-right":P=-g,F=k;break;case"center-left":P=0,F=k/2;break;case"center":P=-g/2,F=k/2;break;case"center-right":P=-g,F=k/2;break;case"bottom-left":P=0,F=0;break;case"bottom-center":P=-g/2,F=0;break;case"bottom-right":P=-g,F=0;break;default:P=0,F=0}for(const L of E){const G=ec(L,a);if(!G||G.length===0)continue;const O=G.map(R=>{if(!R)return[];const U=R.map(N=>{if(!N)return[0,0];let D=(N[0]??0)+P,Q=(N[1]??0)+F;D=D*(t.widthScale||.6);const V=D*A-Q*C,$=D*C+Q*A;return[s[0]+V*f,s[1]+$*f]});return On(ki(U))}).filter(R=>R&&R.length>=4&&Math.abs(Lt(R))>c);if(O.length===0)continue;let v=1;if(t.fillWinding==="positive")v=1;else if(t.fillWinding==="negative")v=-1;else{let R=0,U=-1;for(let Q=0;Q<O.length;Q++){const V=O[Q];if(!V)continue;const $=Lt(V);Math.abs($)>U&&(U=Math.abs($),R=Q)}const N=O[R],D=N?Lt(N):0;v=D>=0?1:-1,i&&console.log("[simple] auto fillSign=",v,"largest signed area=",D)}const w=O.map((R,U)=>({idx:U,ring:R,signedArea:Lt(R),absArea:Math.abs(Lt(R))}));for(const R of w)R.isFilled=R.signedArea*v>0,i&&console.log("[simple] ring",R.idx,"signedArea=",R.signedArea.toExponential(),"isFilled=",R.isFilled);const b=w.filter(R=>R.isFilled).sort((R,U)=>R.absArea-U.absArea),B=w.filter(R=>!R.isFilled).sort((R,U)=>U.absArea-R.absArea);for(const R of b)R.holes=[];for(const R of B){const U=(function(D){let Q=0,V=0;if(!D||D.length===0)return[0,0];for(const $ of D)$&&(Q+=$[0]??0,V+=$[1]??0);return[Q/D.length,V/D.length]})(R.ring);let N=null;for(const D of b)Zl(U,D.ring)&&(N===null||D.absArea<N.absArea&&D.idx<R.idx||D.absArea>N.absArea&&D.idx<R.idx&&B.length==1)&&(N=D);if(N){if(N.absArea<R.absArea&&B.length>1)for(const D of b)Zl(U,D.ring)&&D.absArea>R.absArea&&D.holes.push(R.ring);else N.holes.push(R.ring);R.assigned=!0}else R.assigned=!1,i&&console.log("[simple] hole not assigned idx=",R.idx)}for(const R of b){const U=ro(R.ring.slice()),N=(R.holes||[]).map(D=>E0(D.slice()));y.push(ao([U,...N],n))}for(const R of B)R.assigned||y.push(ao([ro(R.ring.slice())],n));if(b.length===0)for(const R of w)y.push(ao([ro(R.ring.slice())],n))}return{type:"FeatureCollection",features:y}}class b0 extends et{constructor(e,t){super(e,t),this.type="label",this._centerCoord=null,this._plotInstance=this,this.fontUrl="https://leiting.chenxisoft.com/resource/font/HanaMinA.ttf",this.labelText="点击编辑文本",this.fontSize=10,this.color="#ff0000",this.polygonEntities=[],t&&(this.fontSize=t.fontSize||this.fontSize,this.color=t.color||this.color,this.labelText=t.text||this.labelText)}start(e){this.startCreate(e)}startCreate(e){try{this.state="creating",this.forbidDrawWorld(!0);const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,i=this;if(!t){console.error("无法获取Cesium对象");return}this.handler&&this.handler.destroy(),this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(s){if(!s||!s.position)return;let o=i.getCatesian3FromPX(s.position);o&&(i.positions=[o],i._centerCoord=o,i.createLabel(o,function(){i.endCreate(e)}))},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(s){if(!s||!s.position)return;i.getCatesian3FromPX(s.position)&&i.state},t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(s){!s||!s.position||i.endCreate()},t.ScreenSpaceEventType.RIGHT_CLICK)}catch(t){console.error("启动创建标签功能时出错:",t),e&&e(null)}}createLabel(e,t){const i=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,s=this;if(!e){console.error("创建标签时位置参数无效"),t&&t();return}if(!i){console.error("创建标签时无法获取Cesium对象"),t&&t();return}this.clearPolygonEntities(),y0(this.fontUrl,(o,r)=>{try{if(o){console.error("加载字体失败:",o),t&&t();return}const l=i.Cartographic.fromCartesian(e),a=i.Math.toDegrees(l.longitude),c=i.Math.toDegrees(l.latitude),u={type:"Feature",geometry:{type:"Point",coordinates:[a,c]},properties:{text:s.labelText||"",rotation:0}},h={sampleSegments:16,fontSize:s.fontSize,scale:10},f=w0(u,r,h);if(!f||!f.features||!Array.isArray(f.features)){console.error("文本转换为多边形失败"),t&&t();return}s.drawGeoJsonLocal(f,[a,c],1,r),s.entity={_centerCoord:s._centerCoord,_plotInstance:s._plotInstance,position:e,label:{text:s.labelText},updatePosition:function(p){s.updatePositions([p])},getPosition:function(){return s._centerCoord},type:s.type,objId:s.objId,isDraggable:!0,setPosition:function(p){s._centerCoord=p,s.positions[0]=p,s.createLabel(p)}},s.addClickEditHandler(),t&&t()}catch(l){console.error("创建文本标签时发生错误:",l);try{s.clearPolygonEntities()}catch(a){console.error("清理标签多边形实体时出错:",a)}t&&t()}})}drawGeoJsonLocal(e,t,i=1,s){try{const o=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!e||!t||!Array.isArray(t)||t.length!==2){console.error("drawGeoJsonLocal: 参数无效");return}const r=t[0],l=t[1],a=o.Cartesian3.fromDegrees(r,l,0),c=o.Transforms.eastNorthUpToFixedFrame(a),u=i*1;this.clearPolygonEntities();let h=[];for(const x of e.features||[]){if(!x||!x.geometry||x.geometry.type!=="Polygon")continue;const M=x.geometry.coordinates||[];for(const T of M)T&&Array.isArray(T)&&(h=h.concat(T))}let f=1/0,p=1/0,A=-1/0,C=-1/0;for(const x of h)Array.isArray(x)&&x.length>=2&&(f=Math.min(f,x[0]),p=Math.min(p,x[1]),A=Math.max(A,x[0]),C=Math.max(C,x[1]));const m=(f+A)/2,y=(p+C)/2,E=x=>{const M=(x[0]-m)*u,T=(x[1]-y)*u,S=new o.Cartesian3(M,T,0);return o.Matrix4.multiplyByPoint(c,S,new o.Cartesian3)};for(const x of e.features||[]){if(!x||!x.geometry||x.geometry.type!=="Polygon")continue;const M=x.geometry.coordinates||[];if(M.length>0)try{const T=M[0]||[];if(T.length===0)continue;const S=T.map(E);let I;if(M.length>1){const k=M.slice(1).map(P=>!P||!Array.isArray(P)||P.length===0?null:new o.PolygonHierarchy(P.map(E))).filter(Boolean);I=new o.PolygonHierarchy(S,k)}else I=new o.PolygonHierarchy(S);const g=this.viewer.entities.add({polygon:{hierarchy:I,material:o.Color.fromCssColorString(this.color||"#000000"),outline:!1},_labelOwner:this.objId});this.polygonEntities.push(g)}catch(T){console.warn("创建多边形实体时出错:",T);continue}}}catch(o){console.error("drawGeoJsonLocal: 发生错误:",o)}}clearPolygonEntities(){for(let e of this.polygonEntities)this.viewer.entities.remove(e);this.polygonEntities=[]}addClickEditHandler(){const e=this,t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("添加点击编辑事件时无法获取Cesium对象");return}this.editHandler&&(this.editHandler.destroy(),this.editHandler=null),this.editHandler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.editHandler.setInputAction(function(i){if(!i||!i.position)return;const s=e.viewer.scene.pick(i.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(i.preventDefault(),e.editText())},t.ScreenSpaceEventType.LEFT_CLICK),this.editHandler.setInputAction(function(i){if(!i||!i.position)return;const s=e.viewer.scene.pick(i.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(i.preventDefault(),e.openStyleEditor())},t.ScreenSpaceEventType.RIGHT_CLICK)}editText(){const e=this;(function(i,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="500px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const l=document.createElement("h3");l.textContent="编辑文本",l.style.marginTop="0";const a=document.createElement("textarea");a.value=i,a.style.width="100%",a.style.height="150px",a.style.marginBottom="10px",a.style.fontSize="14px",a.style.padding="8px",a.style.boxSizing="border-box";const c=document.createElement("div");c.style.display="flex",c.style.justifyContent="flex-end",c.style.gap="10px";const u=document.createElement("button");u.textContent="取消",u.addEventListener("click",function(){document.body.removeChild(o),s(null)});const h=document.createElement("button");h.textContent="确认",h.addEventListener("click",function(){document.body.removeChild(o),s(a.value)}),c.appendChild(u),c.appendChild(h),r.appendChild(l),r.appendChild(a),r.appendChild(c),o.appendChild(r),document.body.appendChild(o),a.focus();const f=function(p){p.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",f),s(null))};document.addEventListener("keydown",f)})(this.labelText,function(i){i!==null&&(e.labelText=i||"点击编辑文本",e._centerCoord&&e.createLabel(e._centerCoord))})}endCreate(e){try{this.state="endCreate",this.handler&&(this.handler.destroy(),this.handler=null),this.forbidDrawWorld(!1),this.entity&&!this.entity.objId&&(this.entity.objId=this.objId),e&&e(this.entity)}catch(t){console.error("结束创建标签时出错:",t),e&&e(null)}}updatePositions(e){try{if(!e||!e.length){console.warn("更新标签位置时参数无效");return}if(!(window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium)){console.error("更新标签位置时无法获取Cesium对象");return}this.positions=e,this._centerCoord=e[0],this.entity&&(this.entity.position=e[0]),this.createLabel(e[0])}catch(t){console.error("更新标签位置时出错:",t)}}moveEntity(e){try{const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("移动实体时无法获取Cesium对象");return}if(!e||!this._centerCoord)return;const i=t.Cartesian3.add(this._centerCoord,e,new t.Cartesian3);this.updatePositions([i])}catch(t){console.error("移动实体时出错:",t)}}setStyle(e){e&&(e.color&&(this.color=e.color),e.fontSize&&(this.fontSize=e.fontSize),e.text!==void 0&&(this.labelText=e.text),this._centerCoord&&this.createLabel(this._centerCoord))}openStyleEditor(){const e=this;(function(i,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="400px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const l=document.createElement("h3");l.textContent="编辑样式",l.style.marginTop="0";const a=document.createElement("div");a.style.marginBottom="15px";const c=document.createElement("label");c.textContent="文本颜色: ",c.style.display="block",c.style.marginBottom="5px";const u=document.createElement("input");u.type="color",u.value=i.color,u.style.width="50px",a.appendChild(c),a.appendChild(u);const h=document.createElement("div");h.style.marginBottom="15px";const f=document.createElement("label");f.textContent="字体大小: ",f.style.display="block",f.style.marginBottom="5px";const p=document.createElement("input");p.type="number",p.value=i.fontSize,p.min="8",p.max="200",p.step="1",p.style.width="100%",p.style.padding="5px",p.style.boxSizing="border-box",h.appendChild(f),h.appendChild(p);const A=document.createElement("div");A.style.display="flex",A.style.justifyContent="flex-end",A.style.gap="10px",A.style.marginTop="20px";const C=document.createElement("button");C.textContent="取消",C.addEventListener("click",function(){document.body.removeChild(o),s(null)});const m=document.createElement("button");m.textContent="确认",m.addEventListener("click",function(){document.body.removeChild(o),s({color:u.value,fontSize:parseInt(p.value)})}),A.appendChild(C),A.appendChild(m),r.appendChild(l),r.appendChild(a),r.appendChild(h),r.appendChild(A),o.appendChild(r),document.body.appendChild(o);const y=function(E){E.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",y),s(null))};document.addEventListener("keydown",y)})(this.getStyle(),function(i){i&&e.setStyle(i)})}getStyle(){return{color:this.color,fontSize:this.fontSize,text:this.labelText}}destroy(){try{try{this.clearPolygonEntities()}catch(e){console.warn("清理标签多边形实体时出错:",e)}if(this.handler){try{this.handler.destroy()}catch(e){console.warn("销毁事件处理器时出错:",e)}this.handler=null}if(this.editHandler){try{this.editHandler.destroy()}catch(e){console.warn("销毁编辑事件处理器时出错:",e)}this.editHandler=null}this._centerCoord=null,this._plotInstance=null,this.entity=null,this.positions=null,this.objId=null;try{super.destroy()}catch(e){console.warn("调用父类destroy方法时出错:",e)}}catch(e){console.error("销毁CreateLabel对象时发生错误:",e)}}syncFromEntity(){this.entity&&this.entity.position&&(this._centerCoord=this.entity.position,this._plotInstance=this)}getEntityPositions(){return this.positions}calculateCenter(){return this._centerCoord}}class v0 extends et{constructor(e,t){super(e,t),this.type="point",this.viewer=e;let i={color:Cesium.Color.AQUA,pixelSize:10,outlineWidth:1};this.style=Object.assign(i,t||{}),this.position=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);s&&(t.entity=t.createPoint(s),t.position=s,t.handler&&(t.handler.destroy(),t.handler=null),t.prompt&&(t.prompt.destroy(),t.prompt=null),t.state="endCreate",e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt.update(i.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=e instanceof Cesium.Cartesian3?e:Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]);this.position=i,i&&(this.entity=this.createPoint(i),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(e){if(e.color){let t=Cesium.Color.fromCssColorString(e.color||"#ffff00");t=t.withAlpha(e.colorAlpha),this.entity.point.color=t}if(this.entity.point.outlineWidth=Number(e.outlineWidth),e.outlineColor){let t=Cesium.Color.fromCssColorString(e.outlineColor||"#000000");t=t.withAlpha(e.outlineColorAlpha),this.entity.point.outlineColor=t}this.entity.point.heightReference=Number(e.heightReference),this.entity.point.pixelSize=Number(e.pixelSize),this.style=Object.assign(this.style,e)}}getStyle(){let e={},t=this.entity.point,i=t.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString(),e.outlineWidth=t.outlineWidth._value;let s=t.outlineColor.getValue();return e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString(),t.heightReference!=null&&(e.heightReference=t.heightReference.getValue()),e.pixelSize=Number(t.pixelSize),e}getPositions(e){return e?ce.cartesianToLnglat(this.position):this.position}getLnglats(){return this.getPositions(!0)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,i;this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(i=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!i)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o,t.state="editing"),e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){i&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null,t.state="editing"))},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createPoint(e){if(!e)return;let t=this.viewer.entities.add({position:e,point:{color:this.style.color instanceof Cesium.Color?this.style.color:this.style.color?Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE,outlineColor:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:this.style.outlineColor?Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1):Cesium.Color.BLACK,outlineWidth:this.style.outlineWidth||4,pixelSize:this.style.pixelSize||20,disableDepthTestDistance:Number.MAX_VALUE}});return t.objId=this.objId,t}}class x0 extends et{constructor(e,t){super(e,t),this.type="polygon",this.viewer=e,this.entity=null,this.polyline=null;let i={outlineColor:"#000000",outlineWidth:2};this.style=Object.assign(i,t||{}),this.outline=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer,[]);if(!s||(t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.some(l=>Math.abs(l.x-s.x)<1e-6&&Math.abs(l.y-s.y)<1e-6&&Math.abs(l.z-s.z)<1e-6)))return;t.positions.push(s);let r=t.createPoint(s);r.wz=t.positions.length-1,t.controlPoints.push(r)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(t.positions.length<1){t.prompt.update(i.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt&&t.prompt.update(i.endPosition,"双击结束,右键取消上一步");let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);t.positions.length>=1&&(t.state="creating",t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.polyline)||(t.polyline=t.createPolyline())),t.positions.length==3&&(Cesium.defined(t.entity)||(t.entity=t.createPolygon(t.style),!t.style.outline&&t.polyline&&(t.polyline.show=!1),t.entity.objId=t.objId)))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==2&&t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null,t.polyline&&(t.polyline.show=!0)),t.positions.length==1&&(t.polyline&&(t.viewer.entities.remove(t.polyline),t.polyline=null),t.prompt&&t.prompt.update(i.endPosition,"单击开始绘制"),t.positions=[],t.movePush=!1))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(i){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.movePush=!1,e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(i){this.entity=this.createPolygon(),this.polyline=this.createPolyline(),this.polyline.show=this.style.outline,this.positions=i;for(let s=0;s<i.length;s++){let o=i[s],r=Cesium.Cartographic.fromCartesian(i[s]),l=this.createPoint(o);l.point.heightReference=this.style.heightReference,l.ctgc=r,l.wz=this.controlPoints.length,this.controlPoints.push(l)}this.state="endCreate",this.entity.objId=this.objId,t&&t(this.entity)}}getStyle(){if(!this.entity)return;let e={},t=this.entity.polygon;if(t.material instanceof Cesium.ColorMaterialProperty){e.material="common";let s=t.material.color.getValue();e.colorAlpha=s.alpha,e.color=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}if(e.fill=t.fill?t.fill.getValue():!1,t.heightReference){let s=t.heightReference.getValue();e.heightReference=Number(s)}let i=this.polyline.polyline;if(i&&this.polyline.show){e.outlineWidth=i.width.getValue(),e.outline=!0;let s=i.material.color.getValue();e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}else e.outline=!1;return e}setStyle(e){if(!e)return;this.polyline.show=e.outline;let t=this.polyline.polyline;t.width=e.outlineWidth,this.polyline.clampToGround=!!e.heightReference;let s=(e.outlineColor instanceof Cesium.Color?e.outlineColor:Cesium.Color.fromCssColorString(e.outlineColor)).withAlpha(e.outlineColorAlpha||1);t.material=s,e.heightReference!=null&&(this.entity.polygon.heightReference=Number(e.heightReference));let r=(e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color)).withAlpha(e.colorAlpha||1);this.entity.polygon.material=r,e.fill!=null&&(this.entity.polygon.fill=e.fill),this.style=Object.assign(this.style,e)}createPolygon(){let e=this;this.style.color=this.style.color||Cesium.Color.WHITE,this.style.outlineColor=this.style.outlineColor||Cesium.Color.BLACK;let t={polygon:{hierarchy:new Cesium.CallbackProperty(function(){return new Cesium.PolygonHierarchy(e.positions)},!1),heightReference:Number(this.style.heightReference),show:!0,fill:this.style.fill==null?!0:this.style.fill,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1)}};return this.style.heightReference||(t.polygon.height=0,t.polygon.perPositionHeight=!0),this.viewer.entities.add(t)}createPolyline(){let e=this;return this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions.concat(e.positions[0])},!1),clampToGround:!!this.style.heightReference,material:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1),width:this.style.outlineWidth||1}})}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.polyline&&(this.viewer.entities.remove(this.polyline),this.polyline=null),this.positions=[],this.style=null,this.modifyPoint&&(this.viewer.entities.remove(this.modifyPoint),this.modifyPoint=null);for(let e=0;e<this.controlPoints.length;e++){let t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.state="no",this.prompt&&this.prompt.destroy(),this.polyline&&(this.polyline=null,this.viewer.entities.remove(this.polyline)),this.forbidDrawWorld(!1)}}class I0 extends et{constructor(e,t){super(e,t),this.type="rectangle",this.viewer=e,this.style=t||{},this.leftup=null,this.rightdown=null,this.leftdownPoint=null,this.rightupPoint=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(i){const s=t.getCatesian3FromPX(i.position,t.viewer,[]);if(s)if(t.entity)t.endCreate(),e&&e(t.entity);else{t.leftup=s.clone(),t.rightdown=s.clone(),t.entity=t._createPolyline();const o=t._calcCornerCartesian("leftdown"),r=t._calcCornerCartesian("rightup");t.leftdownPoint=t.createPoint(o),t.leftdownPoint.typeAttr="leftdown",t.leftdownPoint.show=!1,t.rightupPoint=t.createPoint(r),t.rightupPoint.typeAttr="rightup",t.rightupPoint.show=!1}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(!t.entity){t.prompt?.update(i.endPosition,"单击开始绘制");return}t.prompt?.update(i.endPosition,"单击结束");const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);s&&(t.rightdown=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.leftdownPoint&&(this.leftdownPoint.show=!0),this.rightupPoint&&(this.rightupPoint.show=!0),this.modifyHandler.setInputAction(function(i){const s=t.viewer.scene.pick(i.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(i.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="leftdown"?t._dragCorner(s,"leftdown"):t.modifyPoint.typeAttr==="rightup"&&t._dragCorner(s,"rightup"),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildRectPositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildRectPositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildRectPositions(){if(!this.leftup||!this.rightdown)return[];const e=this._calcCornerCartesian("leftdown"),t=this.leftup,i=this._calcCornerCartesian("rightup"),s=this.rightdown;return[e,s,i,t,e]}_calcCornerCartesian(e){const t=Cesium.Ellipsoid.WGS84,i=t.cartesianToCartographic(this.leftup),s=t.cartesianToCartographic(this.rightdown),o=Math.min(i.longitude,s.longitude),r=Math.max(i.longitude,s.longitude),l=Math.min(i.latitude,s.latitude),a=Math.max(i.latitude,s.latitude);if(e==="leftdown")return Cesium.Cartesian3.fromRadians(o,l);if(e==="rightup")return Cesium.Cartesian3.fromRadians(r,a)}_updateAuxPoints(){if(!this.leftup||!this.rightdown)return;const e=this._calcCornerCartesian("leftdown"),t=this._calcCornerCartesian("rightup");this.leftdownPoint&&(this.leftdownPoint.position=e),this.rightupPoint&&(this.rightupPoint.position=t)}_dragCorner(e,t){const i=Cesium.Ellipsoid.WGS84,s=i.cartesianToCartographic(this.leftup),o=i.cartesianToCartographic(this.rightdown);let r=Math.min(s.longitude,o.longitude),l=Math.max(s.longitude,o.longitude),a=Math.min(s.latitude,o.latitude),c=Math.max(s.latitude,o.latitude);const u=i.cartesianToCartographic(e);t==="leftdown"?(r=u.longitude,a=u.latitude):(l=u.longitude,c=u.latitude),this.leftup=Cesium.Cartesian3.fromRadians(r,c),this.rightdown=Cesium.Cartesian3.fromRadians(l,a)}syncFromEntity(){if(!this.entity||!this.leftup||!this.rightdown)return;const e=Cesium.Cartesian3.midpoint(this.leftup,this.rightdown,new Cesium.Cartesian3),t=this.entity._centerCoord;if(!t)return;const i=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.leftup=new Cesium.Cartesian3(this.leftup.x+i,this.leftup.y+s,this.leftup.z+o),this.rightdown=new Cesium.Cartesian3(this.rightdown.x+i,this.rightdown.y+s,this.rightdown.z+o);const r=this.entity.objId,l=this.entity._plotInstance;this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=l,this.entity.objId=r;const a=this._calcCornerCartesian("leftdown"),c=this._calcCornerCartesian("rightup");this.leftdownPoint=this.createPoint(a),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=this.state==="editing",this.rightupPoint=this.createPoint(c),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.leftup||!this.rightdown)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.leftup=Cesium.Cartesian3.add(this.leftup,t,new Cesium.Cartesian3),this.rightdown=Cesium.Cartesian3.add(this.rightdown,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update rectangle positions:",t),!1}}getPositions(e){return e?ce.cartesiansToLnglats([this.leftup,this.rightdown],this.viewer):[this.leftup,this.rightdown]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let i=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(i=i.withAlpha(t.colorAlpha)),this.entity.polyline.material=i,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.prompt?.destroy(),this.prompt=null}catch{}}createByPositions(e,t){if(!e||e.length<2)return!1;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length<2)return!1;if(i.length===2)this.leftup=Cesium.Cartesian3.clone(i[0]),this.rightdown=Cesium.Cartesian3.clone(i[1]);else if(i.length>=4){let s=1/0,o=1/0,r=-1/0,l=-1/0;i.forEach(a=>{const c=Cesium.Ellipsoid.WGS84.cartesianToCartographic(a);c&&(s=Math.min(s,c.longitude),o=Math.min(o,c.latitude),r=Math.max(r,c.longitude),l=Math.max(l,c.latitude))}),this.leftup=Cesium.Cartesian3.fromRadians(s,l),this.rightdown=Cesium.Cartesian3.fromRadians(r,o)}if(this.entity?this._updatePolyline():this.entity=this._createPolyline(),!this.leftdownPoint){const s=this._calcCornerCartesian("leftdown");this.leftdownPoint=this.createPoint(s),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=!1}if(!this.rightupPoint){const s=this._calcCornerCartesian("rightup");this.rightupPoint=this.createPoint(s),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=!1}this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),!0}}class B0 extends et{constructor(e,t){super(e,t),t=t||{},this.movePush=!1,this.type="polyline",this.maxPointNum=t.maxPointNum||Number.MAX_VALUE}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],i=this.createPoint(t);this.style.clampToGround&&(i.point.heightReference=1),i.wz=this.controlPoints.length,this.controlPoints.push(i)}}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer,[t.entity]);if(!s)return;t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.push(s);let o=t.createPoint(s);o.wz=t.positions.length-1,t.controlPoints.push(o),t.positions.length==t.maxPointNum&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(t.state="creating",t.positions.length<1){t.prompt.update(i.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt.update(i.endPosition,"右键取消上一步,双击结束");let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity]);s&&(t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.entity)||(t.entity=t.createPolyline())))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==1&&(t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null),t.prompt.update(i.endPosition,"单击开始绘制"),t.movePush=!1,t.positions=[]))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(i){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.positions.pop(),e.viewer.entities.remove(e.controlPoints.pop()),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e||e.length<1)return;this.state="startCreate";let i=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);if(i){this.entity=this.createPolyline(this.style),this.positions=i,t&&t(this.entity);for(let s=0;s<i.length;s++){let o=i[s],r=this.createPoint(o);this.style.clampToGround&&(r.point.heightReference=1),r.wz=this.controlPoints.length,this.controlPoints.push(r)}this.state="endCreate"}}setStyle(e){if(!e)return;let t=this.getMaterial(e.material,e);this.entity.polyline.material=t,this.entity.polyline.clampToGround=!!e.clampToGround,e.width&&(this.entity.polyline.width=e.width||3),this.style=Object.assign(this.style,e)}getStyle(){if(!this.entity)return;let e={},t=this.entity.polyline;this.style.animateType!=null&&(e.animateType=this.style.animateType,e.image=this.style.image,e.duration=this.style.duration),t.material instanceof Cesium.ColorMaterialProperty?e.material="common":(e.material="flowline",t.material instanceof animate.FlowLineMaterial,e.duration=t.material._duration,e.image=t.material.url);let i=t.material.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString(),e.width=t.width._value;let s=t.clampToGround?t.clampToGround.getValue():!1;return e.clampToGround=!!s,e}createPolyline(){let e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions},!1),show:!0,material:this.getMaterial(this.style.animateType,this.style),width:this.style.width||3,clampToGround:this.style.clampToGround}});return t.objId=this.objId,t}getMaterial(e,t){t=t||{};let i=null,s=t.color||Cesium.Color.WHITE;return s=s instanceof Cesium.Color?s:Cesium.Color.fromCssColorString(t.color),s=s.withAlpha(t.colorAlpha||1),e=="flowline"||e=="flyline"||(i=s),i}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],i=this.createPoint(t);this.style.clampToGround&&(i.point.heightReference=1),i.wz=this.controlPoints.length,this.controlPoints.push(i)}}getPositions(e){return e?util.cartesiansToLnglats(this.positions,this.viewer):this.positions}}class S0 extends et{constructor(e,t={}){super(e,t),this.type="freehandLine",this.maxPositions=t.maxPositions||1e4,this.minDistance=t.minDistance||2,this.renderInterval=t.renderInterval||30,this.style=Object.assign({smoothness:2,angleThreshold:3,curveResolution:3},t||{}),this.positions=[],this._stagingBuffer=[],this._flushScheduled=!1,this._flushRAF=null,this._lastFlushTime=0,this.isDrawing=!1,this.handler=null,this.startPointEntity=null,this.entity=null,this.lastAddPosition=null}start(e){if(this.state==="creating"||this.state==="startCreate")return;if(this.state="startCreate",this.positions=[],this._stagingBuffer.length=0,this._lastFlushTime=0,this.isDrawing=!1,this.lastAddPosition=null,this._cancelFlush(),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>Oa).then(({default:i})=>{this.prompt=new i(this.viewer,this.promptStyle)}),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.entity=this.createFreehandLine();const t=this;this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(i){t.state="creating",t.isDrawing=!0,t.forbidDrawWorld(!0),t.positions=[],t._stagingBuffer.length=0,t.lastAddPosition=null;let s=t._fastPick(i.position);if(!s){t.isDrawing=!1;return}const o=Cesium.Cartesian3.clone(s);if(t._pushToStaging(o),t.lastAddPosition=o,t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t.startPointEntity=t.viewer.entities.add({position:o,point:{pixelSize:6,color:Cesium.Color.RED,outlineColor:Cesium.Color.WHITE,outlineWidth:1}}),t._scheduleFlush(!0)},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(i){if(!t.isDrawing){t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"单击开始绘制");return}if(t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"松键结束"),!i||!i.endPosition||t.positions.length+t._stagingBuffer.length>=t.maxPositions)return;let s=t._fastPick(i.endPosition);if(!s||t.lastAddPosition&&Cesium.Cartesian3.distance(t.lastAddPosition,s)<=t.minDistance)return;const o=Cesium.Cartesian3.clone(s);t._pushToStaging(o),t.lastAddPosition=o,t._scheduleFlush()},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction(function(i){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.RIGHT_DOWN)}_pushToStaging(e){this._stagingBuffer.push(e)}_scheduleFlush(e=!1){if(this._flushRAF){e&&(this._forceImmediate=!0);return}this._forceImmediate=e||!1;const t=this,i=function(){t._flushRAF=null;const s=performance.now();(t._forceImmediate||s-t._lastFlushTime>=t.renderInterval)&&(t._flushToPositions(),t._lastFlushTime=s),t._forceImmediate=!1};this._flushRAF=requestAnimationFrame(i)}_cancelFlush(){if(this._flushRAF){try{cancelAnimationFrame(this._flushRAF)}catch{}this._flushRAF=null}this._forceImmediate=!1}_fastPick(e){if(this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){const i=this.viewer.camera.getPickRay(e);let s=null;return i&&(s=this.viewer.scene.globe.pick(i,this.viewer.scene)),s||(s=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),s}let t=null;try{t=this.viewer.scene.pickPosition(e)}catch{}if(!t){const i=this.viewer.camera.getPickRay(e);i&&(t=this.viewer.scene.globe.pick(i,this.viewer.scene))}return t}_flushToPositions(){if(!this._stagingBuffer||this._stagingBuffer.length===0)return;const e=this._stagingBuffer;this._stagingBuffer=[];const t=Math.max(0,Math.min(2,Number(this.style.smoothness||1)));let i=e;if(t>0){const l=(u,h)=>{if(!u||u.length<2)return u;h=Math.max(1,h|0);const f=[u[0]],p=u.length;for(let A=0;A<p-1;A++){const C=A>0?u[A-1]:u[A],m=u[A],y=u[A+1],E=A+2<p?u[A+2]:u[A+1];for(let x=1;x<h;x++){const M=x/h,T=M*M,S=T*M,I=-.5*C.x+1.5*m.x-1.5*y.x+.5*E.x,g=-.5*C.y+1.5*m.y-1.5*y.y+.5*E.y,k=-.5*C.z+1.5*m.z-1.5*y.z+.5*E.z,P=C.x-2.5*m.x+2*y.x-.5*E.x,F=C.y-2.5*m.y+2*y.y-.5*E.y,L=C.z-2.5*m.z+2*y.z-.5*E.z,G=-.5*C.x+.5*y.x,O=-.5*C.y+.5*y.y,v=-.5*C.z+.5*y.z,w=m.x,b=m.y,B=m.z,R=I*S+P*T+G*M+w,U=g*S+F*T+O*M+b,N=k*S+L*T+v*M+B;f.push(new Cesium.Cartesian3(R,U,N))}f.push(y)}return f},a=Math.max(1,Number(this.style.curveResolution)||1);i.length<200&&a>1&&(i=l(i,a));const c=u=>{if(!u||u.length<2)return u;const h=[];h.push(u[0]);for(let f=0;f<u.length-1;f++){const p=u[f],A=u[f+1],C=new Cesium.Cartesian3(p.x*.75+A.x*.25,p.y*.75+A.y*.25,p.z*.75+A.z*.25),m=new Cesium.Cartesian3(p.x*.25+A.x*.75,p.y*.25+A.y*.75,p.z*.25+A.z*.75);h.push(C),h.push(m)}return h.push(u[u.length-1]),h};i=i.slice(),i.length<300&&(i=c(i),t===2&&i.length<300&&(i=c(i)))}const s=(Number(this.style.angleThreshold)||6)*(Math.PI/180),o=this.positions,r=(l,a,c,u)=>{if(!l||!a||!c)return!1;const h=a.x-l.x,f=a.y-l.y,p=a.z-l.z,A=c.x-a.x,C=c.y-a.y,m=c.z-a.z,y=Math.hypot(h,f,p),E=Math.hypot(A,C,m);if(y===0||E===0)return!1;const x=(h*A+f*C+p*m)/(y*E),M=Math.max(-1,Math.min(1,x)),T=Math.acos(M);return Math.abs(T)<=u};for(let l=0;l<i.length;l++){const a=i[l];if(o.length===0){o.push(Cesium.Cartesian3.clone(a));continue}const c=o[o.length-1];if(!(Cesium.Cartesian3.distance(c,a)<=this.minDistance*.5)){if(o.length>=2){const h=o[o.length-2],f=o[o.length-1],p=a;if(r(h,f,p,s)){o.pop(),o.push(Cesium.Cartesian3.clone(p));continue}}if(o.push(Cesium.Cartesian3.clone(a)),o.length>this.maxPositions){const h=o.length-this.maxPositions;h>0&&o.splice(0,h)}}}try{this.viewer.scene.requestRender()}catch{}}endCreate(e){if(this.state==="endCreate")return;if(this.state="endCreate",this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._flushToPositions(),this._cancelFlush(),!this.positions||this.positions.length<2){if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}e&&e(null);return}const t=this.positions.map(i=>Cesium.Cartesian3.clone(i));this.positions=t;try{this.viewer.scene.requestRender()}catch{}e&&e(this.entity)}done(e){this.isDrawing&&(this.isDrawing=!1,this.forbidDrawWorld(!1),this.endCreate(e))}createFreehandLine(){const e=this,t=this.getMaterial(this.style.animateType,this.style),i=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions||[]},!1),show:!0,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1}});return i.objId=this.objId||null,this.entity=i,i}getMaterial(e,t){t=t||{};try{let i=t.color||Cesium.Color.RED;typeof i=="string"&&(i=Cesium.Color.fromCssColorString(i));const s=t.colorAlpha!==void 0?t.colorAlpha:1;return i=i.withAlpha(s),i}catch{return Cesium.Color.RED}}updatePositions(e){if(!e||e.length<1)return!1;try{let t=[];if(e[0]instanceof Cesium.Cartesian3?t=e.map(i=>Cesium.Cartesian3.clone(i)):t=ce&&ce.lnglatsToCartesians?ce.lnglatsToCartesians(e):e,!t||t.length===0)return!1;this.positions=t.map(i=>Cesium.Cartesian3.clone(i)),this._stagingBuffer.length=0;try{this.viewer.scene.requestRender()}catch{}return!0}catch{return!1}}setStyle(e){if(!e||(this.style=Object.assign(this.style||{},e),!this.entity||!this.entity.polyline))return;const t=this.getMaterial(this.style.animateType,this.style);try{this.entity.polyline.material=t}catch{}if(e.width!==void 0)try{this.entity.polyline.width=e.width}catch{}if(e.clampToGround!==void 0)try{this.entity.polyline.clampToGround=!!e.clampToGround}catch{}}createByPositions(e,t){if(!e||e.length<1)return!1;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length<1)return!1;this.positions=i.map(s=>Cesium.Cartesian3.clone(s)),this.entity||this.createFreehandLine(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch{}return t&&t(this.entity),!0}destroy(){if(this._cancelFlush(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.positions=[],this._stagingBuffer=[],this.isDrawing=!1;try{this.endCreate()}catch{}}}class M0 extends et{constructor(e,t={}){if(!e)throw new Error("CreateArrow requires viewer");if(super(e,t),this.type="arrow",this.style=t||{},this.arrowAngle=t.arrowAngle||Math.PI/6,this.positions=[],this.lineEntity=null,this.arrowEntity=null,this.controlPoints=[],this.handler=null,this._finalized=!1,this._editRenderHandler=null,this.Cesium=this._getCesium(),!this.Cesium)throw new Error("Cesium not found")}_getCesium(){return typeof window<"u"&&window.Cesium?window.Cesium:typeof Cesium<"u"?Cesium:this.viewer&&this.viewer.constructor&&this.viewer.constructor.Cesium?this.viewer.constructor.Cesium:null}start(e){if(!this.viewer||!this.Cesium)return e&&e(null),this;if(this.state==="creating"||this.state==="startCreate")return this;this.state="startCreate",this._cleanup(!1),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>Oa).then(({default:i})=>{this.prompt=new i(this.viewer,this.promptStyle)}).catch(()=>{});try{this.forbidDrawWorld(!0)}catch{}const t=this;return this.handler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(i){if(t.state==="startCreate"){t.state="creating",t._finalized=!1;let s=t.getCatesian3FromPX(i.position);if(!s)return;t.positions=[t.Cesium.Cartesian3.clone(s),t.Cesium.Cartesian3.clone(s)],t._createLineEntity(),t._createArrowEntity(),t._createControlPoints(),t.prompt&&i&&i.position&&t.prompt.update(i.position,"再次单击完成绘制")}else if(t.state==="creating"){if(t.state="endCreate",t._finalized=!0,t._finalizeEntities(),t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(t.entity||t.lineEntity)}try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(i){if(t.state==="startCreate"){t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"单击开始绘制");return}if(t.state==="creating"){let s=t.getCatesian3FromPX(i.endPosition);if(!s)return;if(t.positions[1]=s,t.controlPoints[1])try{t.controlPoints[1].position.setValue(s)}catch{}try{t.viewer.scene.requestRender()}catch{}}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(){if(t.state==="creating"){if(t.state="endCreate",t._finalized=!1,t.lineEntity){try{t.viewer.entities.remove(t.lineEntity)}catch{}t.lineEntity=null}if(t.arrowEntity){try{t.viewer.entities.remove(t.arrowEntity)}catch{}t.arrowEntity=null}t.controlPoints.length&&(t.controlPoints.forEach(i=>{try{t.viewer.entities.remove(i)}catch{}}),t.controlPoints=[])}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(null)},this.Cesium.ScreenSpaceEventType.RIGHT_DOWN),this}_computeArrowPositions(e,t){if(!e||!t)return[];const i=this.Cesium.Cartesian3.distance(e,t);if(i<=1e-6)return[];const s=this.style.arrowLengthFactor!==void 0?this.style.arrowLengthFactor:.15,o=this.style.arrowMinSize!==void 0?this.style.arrowMinSize:1.5,r=this.style.arrowMaxSize!==void 0?this.style.arrowMaxSize:Number.MAX_VALUE;let l=this.style.arrowFixedSize!==void 0?this.style.arrowFixedSize:i*s;l<o&&(l=o),l>r&&(l=r);const a=this.Cesium.Cartesian3.subtract(t,e,new this.Cesium.Cartesian3);this.Cesium.Cartesian3.normalize(a,a);const c=this.Cesium.Transforms.eastNorthUpToFixedFrame(t),u=this.Cesium.Matrix4.getColumn(c,2,new this.Cesium.Cartesian3),h=new this.Cesium.Cartesian3(a.x-u.x*this.Cesium.Cartesian3.dot(a,u),a.y-u.y*this.Cesium.Cartesian3.dot(a,u),a.z-u.z*this.Cesium.Cartesian3.dot(a,u));let f;this.Cesium.Cartesian3.magnitudeSquared(h)<1e-6?f=this.Cesium.Matrix4.getColumn(c,0,new this.Cesium.Cartesian3):(this.Cesium.Cartesian3.normalize(h,h),f=this.Cesium.Cartesian3.cross(u,h,new this.Cesium.Cartesian3),this.Cesium.Cartesian3.normalize(f,f));const p=this.Cesium.Cartesian3.multiplyByScalar(a,-l,new this.Cesium.Cartesian3),A=this.Cesium.Cartesian3.add(t,p,new this.Cesium.Cartesian3),C=this.style.arrowWidthScale!==void 0?this.style.arrowWidthScale:1,m=Math.sin(this.arrowAngle)*l*C,y=this.Cesium.Cartesian3.multiplyByScalar(f,m,new this.Cesium.Cartesian3),E=this.Cesium.Cartesian3.multiplyByScalar(f,-m,new this.Cesium.Cartesian3),x=this.Cesium.Cartesian3.add(A,y,new this.Cesium.Cartesian3),M=this.Cesium.Cartesian3.add(A,E,new this.Cesium.Cartesian3);return[t,x,M,t]}_createLineEntity(){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}const e=this,t=this._getMaterial(),i=new this.Cesium.CallbackProperty(function(){return!e.positions||e.positions.length<2?[]:[e.positions[0],e.positions[1]]},!1);this.lineEntity=this.viewer.entities.add({polyline:{positions:i,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),this.entity=this.lineEntity}_createArrowEntity(){if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}const e=this,t=this._getMaterial(),i=new this.Cesium.CallbackProperty(function(){if(!e.positions||e.positions.length<2)return[];const s=e.positions[0],o=e.positions[1];return e._computeArrowPositions(s,o)},!1);this.arrowEntity=this.viewer.entities.add({polyline:{positions:i,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),console.log("this.arrowEntity",this.arrowEntity)}_createControlPoints(){if(this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(e=>{try{this.viewer.entities.remove(e)}catch{}}),this.controlPoints=[]),!(!this.positions||this.positions.length<2))for(let e=0;e<2;e++)try{const t=this.createPoint(this.positions[e]);t.wz=e,this.controlPoints.push(t)}catch{}}_finalizeEntities(){if(this.lineEntity&&this.lineEntity.polyline)try{const e=this.Cesium.Cartesian3.clone(this.positions[0]),t=this.Cesium.Cartesian3.clone(this.positions[1]);this.lineEntity.polyline.positions=[e,t]}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const e=this.positions[0],t=this.positions[1];this.arrowEntity.polyline.positions=this._computeArrowPositions(e,t)}catch{}this.entity=this.lineEntity,this.entity&&(this.entity.arrowEntity=this.arrowEntity,this.entity.positions=[this.positions[0],this.positions[1]],this.positions=[this.positions[0],this.positions[1]]);try{this.viewer.scene.requestRender()}catch{}}startEdit(e){super.startEdit(e),(!this.controlPoints||this.controlPoints.length<2)&&this._createControlPoints();for(let t=0;t<this.controlPoints.length;t++)try{this.controlPoints[t].show=!0}catch{}if(this.lineEntity&&this.lineEntity.polyline)try{const t=this;this.lineEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){return!t.positions||t.positions.length<2?[]:[t.positions[0],t.positions[1]]},!1)}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const t=this;this.arrowEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){if(!t.positions||t.positions.length<2)return[];const i=t.positions[0],s=t.positions[1];return t._computeArrowPositions(i,s)},!1)}catch{}if(!this._editRenderHandler){this._editRenderHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);const t=this;this._editRenderHandler.setInputAction(function(i){if(t.modifyPoint)try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE)}}endEdit(e){if(super.endEdit(e),this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}this._finalized=!0,this._finalizeEntities()}createByPositions(e,t){if(!e||e.length<2)return!1;let i=e[0],s=e[1];if(!(i instanceof this.Cesium.Cartesian3))if(Array.isArray(i)&&i.length>=2)i=this.Cesium.Cartesian3.fromDegrees(i[0],i[1]),s=this.Cesium.Cartesian3.fromDegrees(s[0],s[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(i),this.Cesium.Cartesian3.clone(s)],this._createLineEntity(),this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),this.state="endCreate",t&&t(this.entity||this.lineEntity),!0}updatePositions(e){if(!e||e.length<2)return!1;let t=e[0],i=e[1];if(!(t instanceof this.Cesium.Cartesian3))if(Array.isArray(t)&&t.length>=2)t=this.Cesium.Cartesian3.fromDegrees(t[0],t[1]),i=this.Cesium.Cartesian3.fromDegrees(i[0],i[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(t),this.Cesium.Cartesian3.clone(i)],this.lineEntity||this._createLineEntity(),this.arrowEntity||this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),!0}setStyle(e){if(!e)return;this.style=Object.assign(this.style||{},e),e.arrowAngle!==void 0&&(this.arrowAngle=e.arrowAngle);const t=this._getMaterial();if(this.lineEntity&&this.lineEntity.polyline){try{this.lineEntity.polyline.material=t}catch{}if(e.width!==void 0)try{this.lineEntity.polyline.width=e.width}catch{}}if(this.arrowEntity&&this.arrowEntity.polyline)try{this.arrowEntity.polyline.material=t}catch{}}endCreate(e){if(this.state!=="endCreate"){if(this.state="endCreate",this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._finalized=!0,this._finalizeEntities(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}try{this.forbidDrawWorld(!1)}catch{}e&&e(this.entity||this.lineEntity)}}done(e){this.isDrawing&&(this.isDrawing=!1,this.endCreate(e))}getEntity(){return this.entity||this.lineEntity}destroy(){this._cleanup(!0),this.state=null}_cleanup(e=!0){if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}if(e){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(t=>{try{this.viewer.entities.remove(t)}catch{}}),this.controlPoints=[]),this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.positions=[],this.isDrawing=!1,this._finalized=!1;try{this.forbidDrawWorld(!1)}catch{}}_getMaterial(){try{let e=this.style.color||this.Cesium.Color.RED;typeof e=="string"&&(e=this.Cesium.Color.fromCssColorString(e));const t=this.style.colorAlpha!==void 0?this.style.colorAlpha:1;return e.withAlpha(t)}catch{return this.Cesium.Color.RED}}}class T0{constructor(e,t){if(!e){console.warn("缺少必要参数!--viewer");return}if(t=t||{},this.viewer=e,this.Cesium=window.Cesium||window.cesium,this.entityObjArr=[],this.handler=null,!this.Cesium){console.error("Cesium实例未找到!");return}this.removeHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.startEditFun=null,this.endEditFun=null,this.removeFun=null,this.editingFun=void 0,this.deleteEntityObj=null,this.bindEdit(),this.bindRemove(),this.canEdit=t.canEdit==null?!0:t.canEdit,this.fireEdit=t.fireEdit==null?!0:t.fireEdit,this.nowDrawEntityObj=null,this.nowEditEntityObj=null}on(e,t){e=="startEdit"&&(this.startEditFun=t),e=="endEdit"&&(this.endEditFun=t),e=="remove"&&(this.removeFun=t),e=="endCreate"&&(this.endCreateFun=t),e=="editing"&&(this.editingFun=t)}openEdit(){this.canEdit=!0}closeEdit(){this.endEdit(),this.canEdit=!1}start(e){if(!e||!e.type)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this;this.endEdit(),this.nowDrawEntityObj&&(this.nowDrawEntityObj.state=="startCreate"||this.nowDrawEntityObj.state=="creating")&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);let i=this.createByType(e);if(i)return i.attr=e||{},i.start(function(s){t.nowDrawEntityObj=void 0,t.entityObjArr.push(i),e.success&&e.success(i,s),t.endCreateFun&&t.endCreateFun(i,s),e.show==!1&&i.setVisible(!1),t.canEdit&&t.fireEdit&&(i.startEdit(function(){t.editingFun&&t.editingFun(i,i.entity)}),t.nowEditEntityObj=i,t.startEditFun&&t.startEditFun(i,s))}),this.nowDrawEntityObj=i,i}end(){this.nowDrawEntityObj}startEditOne(e){if(!this.canEdit)return;this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);let t=this;e&&(e.startEdit(function(){t.editingFun&&t.editingFun(e,e.entity)}),this.startEditFun&&this.startEditFun(e,e.getEntity()),this.nowEditEntityObj=e)}updateOneStyle(e,t){e&&e.setStyle(t)}createByPositions(e){if(e=e||{},e||(e={}),!e.positions)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this,i=this.createByType(e);if(i)return i.attr=e,i.createByPositions(e.positions,function(s){t.entityObjArr.push(i),i.setStyle(e.style),e.success&&e.success(i,s),t.endCreateFun&&t.endCreateFun(i,s),e.show==!1&&i.setVisible(!1),t.canEdit&&t.fireEdit&&(i.startEdit(function(){t.editingFun&&t.editingFun(i,i.entity)}),t.startEditFun&&t.startEditFun(i,s),t.nowEditEntityObj=i)}),i}createByGeojson(e){let{features:t}=e,i=[];for(let s=0;s<t.length;s++){let o=t[s];const{properties:r,geometry:l}=o;let a=r.plotType;const c=l.type,u=l.coordinates;let h=[],f="";switch(c){case"LineString":h=ce.lnglatsToCartesians(u),f="polyline";break;case"Polygon":h=ce.lnglatsToCartesians(u[0]),f="polygon";break;case"Point":h=ce.lnglatsToCartesians([u])[0],f=a;break}this.fireEdit=!1;let p=this.createByPositions({type:f,styleType:a,positions:h,style:r.style});p&&i.push(p)}return i}toGeojson(){let e={type:"FeatureCollection",features:[]};if(this.entityObjArr.length==0)return null;for(let t=0;t<this.entityObjArr.length;t++){let i=this.entityObjArr[t],s=i.getPositions(!0),o=[];for(let c=0;c<s.length;c++)o.push([s[c][0],s[c][1]]);let r=i.getStyle(),l=this.transType(i.type),a={type:"Feature",properties:{plotType:i.type,style:r},geometry:{type:l,coordinates:[]}};switch(l){case"Polygon":a.geometry.coordinates=[o];break;case"Point":a.geometry.coordinates=o;break;case"LineString":a.geometry.coordinates=o;break}a.properties=Object.assign(a.properties,i.properties),e.features.push(a)}return e}transType(e){let t="";switch(e){case"polyline":t="LineString";break;case"polygon":t="Polygon";break;case"point":case"gltfModel":case"label":case"billboard":t="Point";break;default:t=e}return t}destroy(){this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null),this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null,this.handler&&(this.handler.destroy(),this.handler=null),this.removeHandler&&(this.removeHandler.destroy(),this.removeHandler=null)}removeOne(e){e&&e&&(e.state!="endCreate"||e.state!="endEdit"?e.destroy():this.removeByObjId(e.objId))}removeAll(){this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null),this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null}hasEntityObj(e){return e?this.getEntityObjByObjId(e.objId)!={}:!1}removeByObjId(e){let t=this.getEntityObjByObjId(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}removeById(e){let t=this.getEntityObjById(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}zoomToByObjId(e){let t=this.getEntityObjByObjId(e);t.entityObj&&t.entityObj.zoomTo()}getEntityObjByField(e,t){let i={};if(t)for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr[e]==t){i.entityObj=o,i.index=s;break}}else for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr.id==e){i.entityObj=o,i.index=s;break}}return i}setVisible(e,t){let i=this.getEntityObjByField("id",e);i.entityObj&&i.entityObj.setVisible(t)}getEntityObjByObjId(e){if(!e)return;let t={};for(let i=0;i<this.entityObjArr.length;i++){let s=this.entityObjArr[i];if(s.objId==e){t.entityObj=s,t.index=i;break}}return t}getEntityObjById(e){if(!e)return;let t={};for(let i=0;i<this.entityObjArr.length;i++){let s=this.entityObjArr[i];if(s.attr.id==e){t.entityObj=s,t.index=i;break}}return t}bindEdit(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const i=e.viewer.scene.drillPick(t.position)||[];let s=-1,o;for(let r=0;r<i.length&&s===-1;r++){const l=i[r].id;if(l){for(let a=0;a<e.entityObjArr.length;a++)if(l.objId==e.entityObjArr[a].objId&&e.entityObjArr[a].state!="startCreate"&&e.entityObjArr[a].state!="creating"){s=a,o=l;break}}}s!==-1?(e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=null),e.entityObjArr[s].startEdit(function(){e.editingFun&&e.editingFun(e.nowEditEntityObj,e.nowEditEntityObj.entity)}),e.startEditFun&&e.startEditFun(e.entityObjArr[s],o),e.nowEditEntityObj=e.entityObjArr[s]):e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=void 0)},Cesium.ScreenSpaceEventType.LEFT_CLICK)}bindRemove(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const i=e.viewer.scene.drillPick(t.position)||[];let s;for(let o=0;o<i.length;o++){const r=i[o].id;if(r){for(let l=0;l<e.entityObjArr.length;l++)if(r.objId==e.entityObjArr[l].objId){s=r.objId;break}if(s)break}}s&&e.createDelteDom(t.position,s)},Cesium.ScreenSpaceEventType.RIGHT_CLICK)}createDelteDom(e,t){if(!t)return;let i=window.document.createElement("span");i.style.background="rgba(0,0,0,0.5)",i.style.position="absolute",i.style.color="white",i.style.left=e.x+10+"px",i.style.top=e.y+10+"px",i.style.padding="4px",i.style.cursor="pointer",i.id="easy3d-plot-delete",i.setAttribute("objId",t),i.innerHTML="删除",window.document.getElementById(this.viewer.container.id).appendChild(i);const o=window.document.getElementById("easy3d-plot-delete");if(!o)return;let r=this;o.addEventListener("click",l=>{let a=i.getAttribute("objId");r.removeByObjId(a)}),document.addEventListener("click",function(){o.remove()})}endEdit(){this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].endEdit()}done(){this.nowEditEntityObj&&(this.nowEditEntityObj.done(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=void 0),this.nowDrawEntityObj&&(this.nowDrawEntityObj.done(),this.entityObjArr.push(this.nowDrawEntityObj),this.endCreateFun&&this.endCreateFun(this.nowDrawEntityObj,this.nowDrawEntityObj.getEntity()),this.nowDrawEntityObj=void 0)}getEntityObjArr(){return this.entityObjArr}createByType(e){let t,i="";return e=e||{},e.type=="polyline"&&(t=new B0(this.viewer,e.style),i="折线_"),e.type=="freehandLine"&&(t=new S0(this.viewer,e.style),i="手绘线_"),e.type=="polygon"&&(t=new x0(this.viewer,e.style),i="面_"),e.type=="billboard"&&(t=new Yg(this.viewer,e.style),i="图标_"),(e.type=="circle"||e.type=="ellipse")&&(t=new Vg(this.viewer,e.style),i="圆_"),e.type=="rectangle"&&(t=new I0(this.viewer,e.style),i="矩形_"),e.type=="gltfModel"&&(t=new Wg(this.viewer,e.style),i="模型_"),e.type=="point"&&(t=new v0(this.viewer,e.style),i="点_"),e.type=="label"&&(t=new b0(this.viewer,e.style),i="文字_"),e.type=="arrow"&&(t=new M0(this.viewer,e.style)),t&&(t.name=i+new Date().getTime()),t}}class lo{viewer;Cesium;drawTool;flatTool;tileset;tilesets;flatTools;selectedEntityObj;selectionOutline;centerHandle;_dragHandler;_listeners;currentColor;currentWidth;originalDoubleClickAction=null;constructor({viewer:e,cesium:t}){window.Cesium=t,this.viewer=e,this.Cesium=t,this.drawTool=null,this.flatTool=null,this.tileset=null,this.tilesets=null,this.flatTools=null,this.selectedEntityObj=null,this.selectionOutline=null,this.centerHandle=null,this._dragHandler=null,this._listeners=[],this.currentColor=this.Cesium.Color.fromCssColorString("#ff0000"),this.currentWidth=1,this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.initDrawTool()}setCurrentColor(e){typeof e=="string"?this.currentColor=this.Cesium.Color.fromCssColorString(e):this.currentColor=e}setCurrentWidth(e){this.currentWidth=e}initDrawTool(){this.drawTool||(this.drawTool=new T0(this.viewer,{canEdit:!0,fireEdit:!0}),this.drawTool.on("startEdit",(e,t)=>{this.selectedEntityObj=e,this.showEntityOutline(e)}),this.drawTool.on("endEdit",(e,t)=>{this.selectedEntityObj=null,this.hideEntityOutline()}),this.drawTool.on("remove",(e,t)=>{this.selectedEntityObj===e&&(this.selectedEntityObj=null,this.hideEntityOutline())}))}showEntityOutline(e){this.hideEntityOutline(),!(!e||!e.getEntity())&&this.createCenterHandle(e)}hideEntityOutline(){if(this.selectionOutline){try{this.viewer.entities.remove(this.selectionOutline)}catch{}this.selectionOutline=null}if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}if(this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}}createCenterHandle(e){if(!e||!e.getEntity())return;if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}const t=e.getEntity();let i=null;if(t._plotInstance&&typeof t._plotInstance.syncFromEntity=="function")try{t._plotInstance.syncFromEntity();const s=t._plotInstance;s.leftup&&s.rightdown&&(i=this.Cesium.Cartesian3.midpoint(s.leftup,s.rightdown,new this.Cesium.Cartesian3))}catch(s){console.warn("plotInstance.syncFromEntity failed",s)}if(!i){if(e.positions&&e.positions.length)i=this.calculateCenter(e.positions);else if(t.position&&t.position.getValue)i=t.position.getValue();else if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const s=t.polyline.positions.getValue();i=this.calculateCenter(s)}else if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const s=t.polygon.hierarchy.getValue().positions;i=this.calculateCenter(s)}else if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue)try{const s=t.rectangle.coordinates.getValue(),o=(s.west+s.east)/2,r=(s.south+s.north)/2;i=this.Cesium.Cartesian3.fromRadians(o,r,0)}catch{}}i&&(this.centerHandle=this.viewer.entities.add({position:i,point:{pixelSize:10,color:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLUE,outlineWidth:2}}),this.addDragHandler(e,i))}calculateCenter(e){if(!e||e.length===0)return null;const t=e.map(r=>r);let i=0,s=0,o=0;for(let r=0;r<t.length;r++)i+=t[r].x,s+=t[r].y,o+=t[r].z;return new this.Cesium.Cartesian3(i/t.length,s/t.length,o/t.length)}getEntityPositions(e){const t=e.getEntity();if(e.positions&&Array.isArray(e.positions))return e.positions.slice();if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const i=t.polyline.positions.getValue();return Array.isArray(i)?i.slice():[]}if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const i=t.polygon.hierarchy.getValue();return i&&i.positions?i.positions.slice():[]}if(t.position&&t.position.getValue)return[t.position.getValue()];if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue){const i=t.rectangle.coordinates.getValue();return[this.Cesium.Cartesian3.fromDegrees(i.west,i.south),this.Cesium.Cartesian3.fromDegrees(i.east,i.south),this.Cesium.Cartesian3.fromDegrees(i.east,i.north),this.Cesium.Cartesian3.fromDegrees(i.west,i.north)]}return[]}addDragHandler(e,t){if(console.log("移动线段"),this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}let i=!1,s,o=0;const r=16,l=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);this._dragHandler=l;const a=c=>{let u;try{u=this.viewer.scene.pickPosition(c)}catch{}if(!this.Cesium.defined(u)){const h=this.viewer.camera.getPickRay(c);h&&(u=this.viewer.scene.globe.pick(h,this.viewer.scene))}return this.Cesium.defined(u)||(u=this.viewer.scene.camera.pickEllipsoid(c,this.viewer.scene.globe.ellipsoid)),u};l.setInputAction(c=>{let u=!1;const h=this.viewer.scene.drillPick(c.position)||[];for(let f=0;f<h.length;f++){const p=h[f].id;if(p&&p===this.centerHandle){u=!0;break}}if(u){i=!0;const f=a(c.position);this.Cesium.defined(f)&&(s=f.clone()),o=performance.now(),this.viewer.scene.screenSpaceCameraController.enableRotate=!1,this.viewer.scene.screenSpaceCameraController.enableTranslate=!1,this.viewer.scene.screenSpaceCameraController.enableZoom=!1,this.viewer.scene.screenSpaceCameraController.enableTilt=!1,this.viewer.scene.screenSpaceCameraController.enableLook=!1}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),l.setInputAction(c=>{if(!i||!this.Cesium.defined(s))return;const u=performance.now();if(u-o<r)return;o=u;const h=a(c.endPosition);if(!this.Cesium.defined(h))return;const f=this.Cesium.Cartesian3.subtract(h,s,new this.Cesium.Cartesian3);if(this.centerHandle&&this.centerHandle.position&&this.centerHandle.position.setValue){const p=this.centerHandle.position.getValue(this.Cesium.JulianDate.now());if(p){const A=this.Cesium.Cartesian3.add(p,f,new this.Cesium.Cartesian3);this.centerHandle.position.setValue(A)}}this.moveEntity(e,f);try{this.viewer.scene.requestRender()}catch{}s=h.clone()},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),l.setInputAction(()=>{if(i){i=!1,this.viewer.scene.screenSpaceCameraController.enableRotate=!0,this.viewer.scene.screenSpaceCameraController.enableTranslate=!0,this.viewer.scene.screenSpaceCameraController.enableZoom=!0,this.viewer.scene.screenSpaceCameraController.enableTilt=!0,this.viewer.scene.screenSpaceCameraController.enableLook=!0;const c=e.getEntity();if(c.state="done",c&&c.rectangle&&c.rectangle.coordinates)try{const u=c.rectangle.coordinates.getValue?c.rectangle.coordinates.getValue():c.rectangle.coordinates;u&&c.rectangle.coordinates.setValue(u)}catch(u){console.warn("Failed to refresh rectangle coordinates",u)}e&&this.selectedEntityObj!==e&&this.showEntityOutline(e)}},this.Cesium.ScreenSpaceEventType.LEFT_UP)}moveEntity(e,t){const i=e.getEntity();if(!i)return;const s=o=>this.Cesium.Cartesian3.add(o,t,new this.Cesium.Cartesian3);if(i.position){const o=i.position.getValue?i.position.getValue():i.position,r=s(o);i.position.setValue?i.position.setValue(r):i.position=r,i.state="moving",e.positions&&e.positions.length===1&&(e.positions[0]=r);return}if(i.polyline){if(i._plotInstance&&i._plotInstance.type==="rectangle"&&typeof i._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(i._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update rectangle positions:",l)}if(i._plotInstance&&i._plotInstance.type==="circle"&&typeof i._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(i._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update circle positions:",l)}const r=(e.positions&&Array.isArray(e.positions)?e.positions:i.polyline.positions.getValue?i.polyline.positions.getValue():[]).map(l=>s(l));if(e.updatePositions&&typeof e.updatePositions=="function")e.updatePositions(r);else if(e.positions&&Array.isArray(e.positions)&&(e.positions=r),i.polyline&&i.polyline.positions)try{i.polyline.positions instanceof this.Cesium.CallbackProperty||(i.polyline.positions=r)}catch{i.polyline.positions=r}}}startFreehandLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"freehandLine",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t,smoothness:2,minDistance:.01,angleThreshold:.8,renderInterval:16,curveResolution:3},e)})}startArrow(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"arrow",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startStraightLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"polyline",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startEllipse(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"circle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,outline:!0,fill:!1,clampToGround:!t},e)})}startImage(e,t){this.initDrawTool();const i=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"billboard",style:Object.assign({image:e,width:t&&t.width?t.width:50,height:t&&t.height?t.height:50,clampToGround:!i},t)})}startRectangle(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"rectangle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,clampToGround:!t},e)})}clearAll(){this.drawTool&&this.drawTool.removeAll(),this.hideEntityOutline()}destroy(){this.clearAll(),this.originalDoubleClickAction&&(this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null)}getAllEntities(){return this.drawTool&&typeof this.drawTool.getEntityObjArr=="function"?this.drawTool.getEntityObjArr():[]}saveAnnotations(){try{const e=this.getAllEntities(),t={freehand:[],arrow:[],text:[],image:[],polyline:[],rectangle:[],ellipse:[],other:[]};e.forEach(o=>{if(o&&typeof o=="object"){const r=o.type||o.constructor&&o.constructor.name,l={type:r,style:{}};switch(!0){case["freehandLine","CreateFreehandLine","polyline","CreatePolyline","arrow","CreateArrow"].includes(r):l.id=o.objId||o.id||Date.now().toString(),o.style&&(l.style={color:o.style.color,width:o.style.width,opacity:o.style.opacity,...o.style}),o.positions&&Array.isArray(o.positions)&&(l.positions=o.positions.map(a=>a&&typeof a=="object"&&a.x!==void 0&&a.y!==void 0&&a.z!==void 0?{x:a.x,y:a.y,z:a.z}:a)),["freehandLine","CreateFreehandLine"].includes(r)&&(l.isEdit=o.isEdit!==void 0?o.isEdit:!0,l.isFreehand=!0);break;case["rectangle","CreateRectangle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(c=>({x:c.x,y:c.y,z:c.z}));else{const c=o.getEntity?o.getEntity():o;if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const u=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(u)&&(a=u.map(h=>({x:h.x,y:h.y,z:h.z})))}else if(c.rectangle&&c.rectangle.coordinates&&c.rectangle.coordinates.getValue){const u=c.rectangle.coordinates.getValue(this.viewer.clock.currentTime);a=[{west:u.west,south:u.south,east:u.east,north:u.north}]}}catch{}}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];const c=o.getEntity?o.getEntity():o;if(c&&c._plotInstance&&c._plotInstance.type==="circle"&&c._plotInstance.center&&c._plotInstance.radiusPoint){const u=c._plotInstance;a=[{x:u.center.x,y:u.center.y,z:u.center.z},{x:u.radiusPoint.x,y:u.radiusPoint.y,z:u.radiusPoint.z}]}else if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(u=>({x:u.x,y:u.y,z:u.z}));else if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const u=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(u)&&(a=u.map(h=>({x:h.x,y:h.y,z:h.z})))}else if(c.ellipse&&c.ellipse.center&&c.ellipse.center.getValue&&c.ellipse.semiMajorAxis&&c.ellipse.semiMajorAxis.getValue){const u=c.ellipse.center.getValue(this.viewer.clock.currentTime),h=c.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime);if(u&&h){const f={x:u.x,y:u.y,z:u.z||0},p={x:f.x+h,y:f.y,z:f.z};a=[f,p]}}}catch{}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["label","CreateLabel"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label){const c={};try{const u=a.label.fillColor&&a.label.fillColor.getValue?a.label.fillColor.getValue(this.viewer.clock.currentTime):a.label.fillColor;u&&(c.color=u)}catch{}a.label.font&&(c.font=a.label.font),l.style=c}}catch{}if(o.text)l.text=o.text;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label&&a.label.text){const c=a.label.text.getValue?a.label.text.getValue(this.viewer.clock.currentTime):a.label.text;c&&(l.text=c)}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const c=a.position.getValue(this.viewer.clock.currentTime);c&&(l.position={x:c.x,y:c.y,z:c.z})}}catch{}break;case["billboard","CreateBillboard"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.billboard){const c={};try{const u=a.billboard.image&&a.billboard.image.getValue?a.billboard.image.getValue(this.viewer.clock.currentTime):a.billboard.image;if(u){if(typeof u=="string")c.image=u;else if(u&&u.src)try{const h=u;if(typeof document<"u"&&h instanceof HTMLImageElement){const f=document.createElement("canvas");f.width=h.naturalWidth||h.width||1,f.height=h.naturalHeight||h.height||1;const p=f.getContext("2d");p?(p.drawImage(h,0,0),c.image=f.toDataURL()):c.image=h.src}else c.image=u.src}catch{c.image=u.src}}}catch{}a.billboard.width&&(c.width=a.billboard.width),a.billboard.height&&(c.height=a.billboard.height),l.style=c}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const c=a.position.getValue(this.viewer.clock.currentTime);c&&(l.position={x:c.x,y:c.y,z:c.z})}}catch{}break;default:o.style&&(l.style=o.style),o.position&&(l.position=o.position);break}switch(!0){case["freehandLine","CreateFreehandLine"].includes(r):t.freehand.push(l);break;case["arrow","CreateArrow"].includes(r):t.arrow.push(l);break;case["label","CreateLabel"].includes(r):t.text.push(l);break;case["billboard","CreateBillboard"].includes(r):t.image.push(l);break;case["polyline","CreatePolyline"].includes(r):t.polyline.push(l);break;case["rectangle","CreateRectangle"].includes(r):t.rectangle.push(l);break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):t.ellipse.push(l);break;default:t.other.push(l)}}});const i={version:"1.0",exportTime:new Date().toISOString(),totalEntities:e.length,annotations:t},s=JSON.stringify(i);return console.log("标注数据已按类型分类保存,只包含重绘所需信息:",s),s}catch(e){return console.error("保存标注失败:",e),!1}}loadAnnotations(e){try{const t=typeof e=="string"?JSON.parse(e):e;if(!t.annotations)return console.error("标注数据格式错误,缺少annotations字段"),!1;const i=t.annotations;let s=0;const o=(r,l)=>{Array.isArray(r)&&r.forEach(a=>{if(a.style){if(a.style.color&&typeof a.style.color=="object"){const c=a.style.color;a.style.color=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}if(a.style.outlineColor&&typeof a.style.outlineColor=="object"){const c=a.style.outlineColor;a.style.outlineColor=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}}switch(l){case"freehand":case"polyline":case"arrow":if(a.positions&&a.positions.length>0){const c=a.positions.map(f=>f&&typeof f=="object"?new this.Cesium.Cartesian3(f.x,f.y,f.z):f),u={type:l==="freehand"?"freehandLine":l,style:a.style||{},positions:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))},h=this.drawTool.createByPositions(u);if(h&&h.getEntity()){s++,h.isEdit=!0;const f=h.getEntity();f&&!f._plotInstance&&(f._plotInstance=h),f&&!f.objId&&(f.objId=h.objId),console.log(`Loaded ${l} entity with objId: ${h.objId}`)}}break;case"rectangle":{try{if(a.positions&&a.positions.length){let c=[];if(a.positions[0]&&a.positions[0].x!==void 0)c=a.positions.map(u=>new this.Cesium.Cartesian3(u.x,u.y,u.z!==void 0?u.z:0));else if(a.positions[0]&&a.positions[0].west!==void 0){const u=a.positions[0];c=[this.Cesium.Cartesian3.fromRadians(u.west,u.south),this.Cesium.Cartesian3.fromRadians(u.east,u.south),this.Cesium.Cartesian3.fromRadians(u.east,u.north),this.Cesium.Cartesian3.fromRadians(u.west,u.north),this.Cesium.Cartesian3.fromRadians(u.west,u.south)]}if(c.length){const u=JSON.parse(JSON.stringify(a.style||{}));if(u.color&&typeof u.color=="string"&&!u.color.startsWith("rgba"))try{const p=JSON.parse(u.color);p.red!==void 0&&(u.color=`rgba(${Math.round(p.red*255)}, ${Math.round(p.green*255)}, ${Math.round(p.blue*255)}, ${p.alpha||1})`)}catch{}const h={type:"rectangle",positions:c,style:u,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let f=null;try{f=this.drawTool.createByPositions(h)}catch(p){console.warn("drawTool.createByPositions(rectangle) failed",p)}if(f){s++,f.isEdit=!0;const p=f.getEntity?f.getEntity():f.entity||f;p&&(p._plotInstance=f,p.objId=f.objId||a.id,p.pickable=!0,p.polyline&&(p.polyline.pickWidth=10),console.log(`Loaded rectangle entity with objId: ${p.objId}, color: ${u.color}`))}}}}catch(c){console.warn("load rectangle failed",c)}break}case"text":if(a.position){const c=a.text||"文字标注",u={type:"label",style:a.style||{},text:c,position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};u.style.fontSize||(u.style.fontSize=14),u.style.fontFamily||(u.style.fontFamily="Arial");let h;try{!u.positions&&u.position&&(u.positions=u.position),h=this.drawTool.createByPositions(u),!h&&this.drawTool.startText&&(console.log("使用startText创建文字"),this.drawTool.startText(u.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.text=c,this.drawTool.currentEntity.position=u.position,h=this.drawTool.currentEntity))}catch(f){console.log("创建文字失败",f)}if(!h)try{const f=this.viewer.entities.add({position:u.position,label:Object.assign({text:c,font:u.style&&u.style.font||"14pt Source Han Sans CN",fillColor:u.style&&u.style.fillColor||this.Cesium.Color.WHITE,outlineColor:u.style&&u.style.outlineColor||this.Cesium.Color.BLACK,outlineWidth:u.style&&u.style.outlineWidth||2,verticalOrigin:u.style&&u.style.verticalOrigin||this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:u.style&&u.style.pixelOffset||new this.Cesium.Cartesian2(0,-10)},u.style&&u.style.label?u.style.label:{})}),p={getEntity:()=>f,entity:f,style:u.style||{},type:"label",objId:a.id||`label_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(f)};try{f.objId=p.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(p)),h=p}catch(f){console.warn("回退创建文字实体失败",f)}h&&(s++,h.isEdit=!0)}break;case"image":if(a.position){const c={type:"billboard",style:a.style||{},position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};c.style.image||(console.log("使用默认图片占位符"),c.style.image="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4="),c.style.width||(c.style.width=50),c.style.height||(c.style.height=50);let u;try{!c.positions&&c.position&&(c.positions=c.position),u=this.drawTool.createByPositions(c),!u&&this.drawTool.startImage&&(console.log("使用startImage创建图片"),this.drawTool.startImage(c.style.image,c.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.position=c.position,u=this.drawTool.currentEntity))}catch(h){console.log("创建图片失败",h)}if(!u)try{const h=c.style&&c.style.image?c.style.image:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4=",f=this.viewer.entities.add({position:c.position,billboard:{image:h,width:c.style&&c.style.width?c.style.width:50,height:c.style&&c.style.height?c.style.height:50,verticalOrigin:c.style&&c.style.verticalOrigin||this.Cesium.VerticalOrigin.CENTER,scale:c.style&&c.style.scale||1}}),p={getEntity:()=>f,entity:f,style:c.style||{},type:"billboard",objId:a.id||`billboard_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(f)};try{f.objId=p.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(p)),u=p}catch(h){console.warn("回退创建图片实体失败",h)}u&&(s++,u.isEdit=!0)}break;case"ellipse":case"circle":{try{const c=JSON.parse(JSON.stringify(a.style||{}));if(c.color&&typeof c.color=="string"&&!c.color.startsWith("rgba"))try{const f=JSON.parse(c.color);f.red!==void 0&&(c.color=`rgba(${Math.round(f.red*255)}, ${Math.round(f.green*255)}, ${Math.round(f.blue*255)}, ${f.alpha||1})`)}catch{}let u=[],h=!1;if(a.positions&&a.positions.length&&(a.positions[0]&&a.positions[0].x!==void 0&&(u=a.positions.map(f=>new this.Cesium.Cartesian3(f.x,f.y,f.z!==void 0?f.z:0))),u.length)){const f={type:l,positions:u,style:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let p=null;try{if(p=this.drawTool.createByPositions(f),p){s++,p.isEdit=!0;const A=p.getEntity?p.getEntity():p.entity||p;A&&(A._plotInstance=p,A.objId=p.objId||a.id,A.pickable=!0,A.polyline&&(A.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${A.objId} using positions`)),h=!0}}catch(A){console.warn(`drawTool.createByPositions(${l}) failed`,A)}}if(!h&&a.center&&a.radius)try{const f=new this.Cesium.Cartesian3(a.center.x,a.center.y,a.center.z||0),p=this.Cesium.Cartesian3.add(f,new this.Cesium.Cartesian3(a.radius,0,0),new this.Cesium.Cartesian3),C={type:l,positions:[f,p],style:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let m=null;try{if(m=this.drawTool.createByPositions(C),m){s++,m.isEdit=!0;const y=m.getEntity?m.getEntity():m.entity||m;y&&(y._plotInstance=m,y.objId=m.objId||a.id,y.pickable=!0,y.polyline&&(y.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${y.objId} using center and radius`))}}catch(y){console.warn(`drawTool.createByPositions(${l}) with center/radius failed`,y)}}catch(f){console.warn(`Fallback creation for ${l} failed`,f)}}catch(c){console.warn(`load ${l} failed`,c)}break}default:console.log(`尝试加载未知类型实体: ${l}`);break}})};return Object.keys(i).forEach(r=>{o(i[r],r)}),console.log(`成功加载 ${s} 个标注实体`),this.drawTool&&typeof this.drawTool.bindEdit=="function"&&this.drawTool.bindEdit(),!0}catch(t){return console.error("加载标注失败:",t),!1}}changeEntityColor(e){try{if(!this.selectedEntityObj)return!1;if(this.selectedEntityObj.setStyle&&typeof this.selectedEntityObj.setStyle=="function")try{return this.selectedEntityObj.setStyle({color:e}),console.log("通过实体对象的setStyle方法修改颜色成功"),!0}catch(s){console.warn("通过setStyle修改颜色失败,尝试直接修改实体:",s)}const t=this.selectedEntityObj.getEntity();if(!t)return!1;let i;try{i=this.Cesium.Color.fromCssColorString(e)}catch(s){console.warn("Invalid color format:",e,s),i=e}if(t.polyline)try{t.polyline.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.polyline.material=i}else if(t.polygon)try{t.polygon.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.polygon.material=i}else if(t.rectangle){const s=t.rectangle.outline,o=t.rectangle.outlineWidth;try{t.rectangle.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.rectangle.material=i}t.rectangle.outlineColor=i,s!==void 0&&(t.rectangle.outline=s),o!==void 0&&(t.rectangle.outlineWidth=o)}else if(t.ellipse||t.circle){const s=t.ellipse||t.circle,o=s.outline,r=s.outlineColor,l=s.outlineWidth;s.material=i,o!==void 0&&(s.outline=o),r!==void 0&&(s.outlineColor=r),l!==void 0&&(s.outlineWidth=l)}return!0}catch(t){return console.error("changeEntityColor failed",t),!1}}changeColor(e){return this.changeEntityColor(e)}setLineWidth(e){if(!this.selectedEntityObj)return!1;const t=this.selectedEntityObj.getEntity();let i=2;if(typeof e=="number")i=e;else switch(e){case"thin":i=2;break;case"medium":i=4;break;case"thick":i=8;break}if(t.polyline)t.polyline.width=i;else if(t.polygon&&t.polygon.outline)t.polygon.outlineWidth=i;else if(t.rectangle&&t.rectangle.outline)t.rectangle.outlineWidth=i;else if((t.ellipse||t.circle)&&(t.ellipse?.outline||t.circle?.outline)){const s=t.ellipse||t.circle;s.outlineWidth=i}return!0}changeWidth(e){return this.setLineWidth(e)}deleteSelectedEntity(){if(!this.selectedEntityObj)return!1;if(typeof this.drawTool.removeOne=="function")this.drawTool.removeOne(this.selectedEntityObj);else if(typeof this.drawTool.remove=="function")this.drawTool.remove(this.selectedEntityObj);else return console.error("No remove method found on drawTool"),!1;return this.selectedEntityObj=null,this.hideEntityOutline(),!0}}class tc{viewer;cesium;handler=null;measureEntities=[];originalDoubleClickAction=null;onMeasure=()=>{};activePoints=[];floatingPoint=null;activeShape=null;type=null;unit="m";cursorPosition=null;isSnapping=!1;snapIndicator=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t;const i=this.cesium;this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(i.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(i.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}setUnit(e){this.unit=e}setSnapping(e){this.isSnapping=e,!e&&this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null)}start(e){const t=this.cesium;this.clearActive(),this.type=e,this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(i=>{const s=this.getPickPosition(i.position);s&&this.addPoint(s)},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(i=>{const s=this.getPickPosition(i.endPosition);s&&(this.cursorPosition=s,this.updateFloatingPoint(s))},t.ScreenSpaceEventType.MOUSE_MOVE),this.type==="area"&&this.handler.setInputAction(()=>{this.finish()},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}addPoint(e){const t=this.cesium;this.activePoints.push(e);const i=this.viewer.entities.add({position:e,point:{pixelSize:8,color:t.Color.YELLOW,outlineColor:t.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.measureEntities.push(i),this.type==="distance"){if(this.activePoints.length===1)this.onMeasure(null),this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===2){const s=this.activePoints[0],o=this.activePoints[1];this.activeShape&&(this.viewer.entities.remove(this.activeShape),this.activeShape=null);const r=this.viewer.entities.add({polyline:{positions:[s,o],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(r);const l=t.Cartesian3.distance(s,o),a=t.Cartesian3.midpoint(s,o,new t.Cartesian3);this.addLabel(a,this.formatDistance(l));const c=t.Transforms.eastNorthUpToFixedFrame(s),u=t.Matrix4.inverse(c,new t.Matrix4),h=t.Matrix4.multiplyByPoint(u,o,new t.Cartesian3),f=h.x,p=h.y,A=h.z,C=t.Matrix4.getColumn(c,0,new t.Cartesian3),m=t.Matrix4.getColumn(c,1,new t.Cartesian3),y=t.Cartesian3.multiplyByScalar(C,f,new t.Cartesian3),E=t.Cartesian3.add(s,y,new t.Cartesian3),x=t.Cartesian3.multiplyByScalar(m,p,new t.Cartesian3),M=t.Cartesian3.add(E,x,new t.Cartesian3);if(this.viewer.scene.mode!==t.SceneMode.SCENE2D){const T=this.viewer.entities.add({polyline:{positions:[s,E],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.RED}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(1,0,0,.5)})}}),S=this.viewer.entities.add({polyline:{positions:[E,M],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.GREEN}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,1,0,.5)})}}),I=this.viewer.entities.add({polyline:{positions:[M,o],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.BLUE}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,0,1,.5)})}});this.measureEntities.push(T,S,I)}this.onMeasure({type:"distance",dx:f,dy:p,dz:A,dist:l}),this.activePoints=[]}}else if(this.type==="angle"){if(this.activePoints.length===1)this.onMeasure(null);else if(this.activePoints.length===2)this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length<2)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===3){const s=this.activePoints[0],o=this.activePoints[1],r=this.activePoints[2];if(this.activeShape){this.viewer.entities.remove(this.activeShape);const a=this.viewer.entities.add({polyline:{positions:[s,o,r],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(a)}const l=this.calculateAngle(s,o,r);this.addLabel(o,`${l.toFixed(1)}°`),this.onMeasure({type:"angle",angle:l}),this.finish()}}else this.type==="area"&&this.activePoints.length===1&&(this.onMeasure(null),this.activeShape=this.viewer.entities.add({polygon:{hierarchy:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return new t.PolygonHierarchy([]);const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),new t.PolygonHierarchy(s)},!1),material:t.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:t.Color.YELLOW,outlineWidth:2},polyline:{positions:new t.CallbackProperty(()=>{const s=[...this.activePoints];return this.cursorPosition&&(s.push(this.cursorPosition),s.push(s[0])),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW,clampToGround:!1}}),this.measureEntities.push(this.activeShape))}updateFloatingPoint(e){const t=this.cesium;this.floatingPoint||(this.floatingPoint=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:5,color:t.Color.RED,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))}finish(){const e=this.cesium;if(this.type==="distance"&&this.activePoints.length>1){let t=0;for(let s=0;s<this.activePoints.length-1;s++)t+=e.Cartesian3.distance(this.activePoints[s],this.activePoints[s+1]);const i=this.activePoints[this.activePoints.length-1];this.addLabel(i,`Total: ${this.formatDistance(t)}`)}else if(this.type==="area"&&this.activePoints.length>=3){const t=this.calculateArea(this.activePoints),i=this.calculateCenter(this.activePoints);this.addLabel(i,`面积: ${this.formatArea(t)}`),this.onMeasure({type:"area",area:t})}this.clearActive()}clearAll(){this.clear(),this.onMeasure(null)}clear(){this.clearActive(),this.measureEntities.forEach(e=>this.viewer.entities.remove(e)),this.measureEntities=[]}stop(){this.clearActive(),this.onMeasure(null)}destroy(){if(this.clear(),this.originalDoubleClickAction){const e=this.cesium;this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null}}clearActive(){const e=this.cesium;if(this.handler&&(this.handler.destroy(),this.handler=null),this.floatingPoint&&(this.viewer.entities.remove(this.floatingPoint),this.floatingPoint=null),this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null),this.activeShape){if(this.type==="distance"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const i=this.viewer.entities.add({polyline:{positions:t,width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(i)}else if(this.type==="area"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const i=this.viewer.entities.add({polygon:{hierarchy:new e.PolygonHierarchy(t),material:e.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:e.Color.YELLOW,outlineWidth:2},polyline:{positions:[...t,t[0]],width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(i)}this.activeShape=null}this.activePoints=[],this.type=null,this.cursorPosition=null}getPickPosition(e){const t=this.cesium;let i;try{i=this.viewer.scene.pickPosition(e)}catch{}if(!i||!t.defined(i)){const s=this.viewer.camera.getPickRay(e);s&&(i=this.viewer.scene.globe.pick(s,this.viewer.scene))}if((!i||!t.defined(i))&&(i=this.viewer.scene.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),!i||!t.defined(i))return null;if(this.isSnapping){const s=this.snapToVertex(e);if(s)i=s;else{const o=this.snapTo3DTileFeature(e);o&&(i=o)}}return this.isSnapping&&(this.snapIndicator||(this.snapIndicator=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:10,color:t.Color.GREEN.withAlpha(.5),outlineColor:t.Color.GREEN,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))),i}snapTo3DTileFeature(e){const t=this.cesium,i=10,s=[{x:0,y:0},{x:-i,y:0},{x:i,y:0},{x:0,y:-i},{x:0,y:i},{x:-i,y:-i},{x:i,y:-i},{x:-i,y:i},{x:i,y:i}];for(let o=0;o<s.length;o++){const r=s[o];if(!r)continue;const l=new t.Cartesian2(e.x+r.x,e.y+r.y);let a=null;try{a=this.viewer.scene.pick(l)}catch{}if(t.defined(a)&&(a instanceof t.Cesium3DTileFeature||a.primitive&&a.primitive instanceof t.PointPrimitive))try{const c=this.viewer.scene.pickPosition(l);if(c)return c}catch{}}return null}snapToVertex(e){const t=this.cesium,i=this.viewer.entities.values;let s=20,o=null;for(let r=0;r<i.length;r++){const l=i[r];if(!l.show)continue;let a=[];if(l.polyline&&l.polyline.positions){const c=l.polyline.positions.getValue(t.JulianDate.now());c&&(a=c)}else if(l.polygon&&l.polygon.hierarchy){const c=l.polygon.hierarchy.getValue(t.JulianDate.now());c&&c.positions&&(a=c.positions)}else if(l.position){const c=l.position.getValue(t.JulianDate.now());c&&(a=[c])}else if(l.rectangle&&l.rectangle.coordinates){const c=l.rectangle.coordinates.getValue(t.JulianDate.now());c&&(a=[t.Cartesian3.fromRadians(c.west,c.south),t.Cartesian3.fromRadians(c.east,c.south),t.Cartesian3.fromRadians(c.east,c.north),t.Cartesian3.fromRadians(c.west,c.north)])}for(let c=0;c<a.length;c++){const u=a[c];try{const h=this.viewer.scene.cartesianToCanvasCoordinates(u);if(h){const f=t.Cartesian2.distance(h,e);f<s&&(s=f,o=u)}}catch{}}}return o}addLabel(e,t){const i=this.cesium,s=this.viewer.entities.add({position:e,label:{text:t,font:"14px sans-serif",fillColor:i.Color.WHITE,style:i.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:i.VerticalOrigin.BOTTOM,pixelOffset:new i.Cartesian2(0,-10),disableDepthTestDistance:Number.POSITIVE_INFINITY,showBackground:!0,backgroundColor:new i.Color(0,0,0,.5)}});this.measureEntities.push(s)}formatDistance(e){return this.unit==="mm"?`${(e*1e3).toFixed(0)}mm`:this.unit==="cm"?`${(e*100).toFixed(1)}cm`:`${e.toFixed(2)}m`}calculateAngle(e,t,i){const s=this.cesium,o=s.Cartesian3.subtract(e,t,new s.Cartesian3),r=s.Cartesian3.subtract(i,t,new s.Cartesian3);s.Cartesian3.normalize(o,o),s.Cartesian3.normalize(r,r);const l=s.Cartesian3.dot(o,r),a=Math.max(-1,Math.min(1,l)),c=Math.acos(a);return s.Math.toDegrees(c)}calculateArea(e){const t=this.cesium;if(e.length<3)return 0;const i=e[0],s=new t.Cartesian3(0,0,0);for(let o=1;o<e.length-1;o++){const r=e[o],l=e[o+1],a=t.Cartesian3.subtract(r,i,new t.Cartesian3),c=t.Cartesian3.subtract(l,i,new t.Cartesian3),u=t.Cartesian3.cross(a,c,new t.Cartesian3);t.Cartesian3.add(s,u,s)}return t.Cartesian3.magnitude(s)*.5}calculateCenter(e){const t=this.cesium;if(!e||e.length===0)return null;let i=0,s=0,o=0;for(let r=0;r<e.length;r++)i+=e[r].x,s+=e[r].y,o+=e[r].z;return new t.Cartesian3(i/e.length,s/e.length,o/e.length)}formatArea(e){return e>1e6?`${(e/1e6).toFixed(2)} km²`:`${e.toFixed(2)} m²`}}class D0{cesium;viewer;events=new gi;lastBaseMapRequestId=0;currentMode="3d";defaultMapBound={minLon:-180,maxLon:180,minLat:-90,maxLat:90};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}get is2d(){return this.currentMode==="2d"}setGlobeEnvironmentVisible(e){if(this.is2d){this.viewer.scene.globe.show=e,this.viewer.scene.globe.showGroundAtmosphere=!1,this.viewer.scene.skyAtmosphere.show=!1,this.viewer.scene.sun.show=!1,this.viewer.scene.moon.show=!1,this.viewer.scene.skyBox.show=!1;return}const{scene:t}=this.viewer;t.globe&&(t.globe.show=e,t.globe.showGroundAtmosphere=e),t.skyAtmosphere&&(t.skyAtmosphere.show=e),t.sun&&(t.sun.show=e),t.moon&&(t.moon.show=e),t.skyBox&&(t.skyBox.show=e)}setGlobeColor(e){this.viewer.scene.globe.baseColor=this.cesium.Color.fromCssColorString(e)}setBackgroundColor(e){const t=this.viewer.container;t&&(t.style.background=e);try{const i=this.cesium.Color.fromCssColorString(e);i?(this.viewer.scene.backgroundColor=i,this.viewer.scene.globe.baseColor=i):(this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT)}catch{this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT}}async setTerrainEnable(e){if(!(this.is2d&&e))if(e)try{const t=this.cesium.ArcGISTiledElevationTerrainProvider.fromUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"),i=new Promise((s,o)=>setTimeout(()=>o(new Error("ArcGIS Terrain request timed out")),5e3));this.viewer.terrainProvider=await Promise.race([t,i])}catch(t){console.warn("Failed to load ArcGIS terrain (or timed out), trying Cesium World Terrain...",t);try{this.cesium.Terrain&&this.cesium.Terrain.fromWorldTerrain?this.viewer.terrainProvider=await this.cesium.Terrain.fromWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0}):this.viewer.terrainProvider=this.cesium.createWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0})}catch(i){console.error("Failed to enable terrain (both ArcGIS and Ion failed):",i),this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}}else this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}setDepthTestEnable(e){this.viewer.scene.globe.depthTestAgainstTerrain=e}setCadMode(e){this.currentMode!==e&&(this.currentMode=e,this.is2d?this._enable2DMode():this._enable3DMode())}_enable2DMode(){const e=this.cesium,t=this.viewer.scene,i=t.screenSpaceCameraController;t.morphTo2D(0),t.postProcessStages.fxaa.enabled=!1,this.setBackgroundColor("#000000"),this.setGlobeColor("#000000"),this.viewer.imageryLayers.removeAll(),this.setGlobeEnvironmentVisible(!0),i.zoomFactor=4,i.enableZoomInertia=!1,i.minimumZoomDistance=0,i.maximumZoomDistance=1e6,this.viewer.camera.setView({orientation:{heading:0,pitch:e.Math.toRadians(-90),roll:0}})}_enable3DMode(){this.viewer.scene.morphTo3D(0),this.setMouseHabit(0),this.setCollisionDetection(!0),this.viewer.scene.screenSpaceCameraController.minimumZoomDistance=1}async changeBaseMap(e,t){if(this.is2d){this.viewer.imageryLayers.removeAll();return}const i=Date.now();this.lastBaseMapRequestId=i;const s=this.viewer.imageryLayers,o=[];if(e==="tianditu"){const r=t?.token||"c25f14fb6bd4397cf8fe45144ff768d6",l=t?.layerType||"img_w",a=l.split("_"),c=a[0]||"img",u=a[1]||"w";let h="";c==="img"?h="cia":c==="vec"?h="cva":c==="ter"&&(h="cta");const f=h?`${h}_${u}`:"";o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${l}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${c}&STYLE=default&TILEMATRIXSET=${u}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:c,style:"default",format:"tiles",tileMatrixSetID:u,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]})),t.showAnnotation!==!1&&f&&o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${f}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${h}&STYLE=default&TILEMATRIXSET=${u}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:h,style:"default",format:"tiles",tileMatrixSetID:u,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]}))}else if(e==="arcgis"){console.log("Switching to ArcGIS...");const r=t?.url||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";try{if(this.cesium.ArcGisMapServerImageryProvider.fromUrl){const l=this.cesium.ArcGisMapServerImageryProvider.fromUrl(r,{enablePickFeatures:!1}),a=new Promise((u,h)=>setTimeout(()=>h(new Error("ArcGIS metadata request timed out")),3e3)),c=await Promise.race([l,a]);o.push(c)}else o.push(new this.cesium.ArcGisMapServerImageryProvider({url:r,enablePickFeatures:!1}))}catch(l){console.warn("ArcGIS provider failed (or timed out), fallback to XYZ template",l),o.push(new this.cesium.UrlTemplateImageryProvider({url:`${r}/tile/{z}/{y}/{x}`,maximumLevel:19,credit:"ArcGIS Layer"}))}}else if(e==="tianditu_img")return this.changeBaseMap("tianditu",{...t,layerType:"img_w"});if(this.lastBaseMapRequestId!==i){console.log("BaseMap switch cancelled due to new request.");return}s.removeAll(),o.forEach(r=>s.addImageryProvider(r))}async searchLocation(e,t){if(!e)return null;if(!t)throw new Error("缺少天地图 Token");const s=JSON.stringify({keyWord:e,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}),o=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(s)}&type=query&tk=${encodeURIComponent(t)}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}setShadowsEnable(e){this.is2d||(this.viewer.shadows=e,this.viewer.terrainShadows=e?this.cesium.ShadowMode.ENABLED:this.cesium.ShadowMode.DISABLED,this.viewer.shadowMap&&(this._shadowDarkness===void 0?this.viewer.shadowMap.darkness=e?.7:.3:this.viewer.shadowMap.darkness=this._shadowDarkness))}_shadowDarkness;setShadowDarkness(e){this.is2d||(this._shadowDarkness=e,this.viewer.shadowMap&&(this.viewer.shadowMap.darkness=e))}setTime(e){if(this.is2d)return;let t;if(e instanceof Date)t=e;else{const s=this.cesium.JulianDate.now();t=this.cesium.JulianDate.toDate(s),t.setHours(e),t.setMinutes(0),t.setSeconds(0)}const i=this.cesium.JulianDate.fromDate(t);this.viewer.clock.currentTime=i}setModelColorAdjustment(e){if(this.is2d)return;const t=this.viewer,i=this.cesium;if(!t||!t.scene)return;const s=e.brightness!==void 0?e.brightness:1,o=e.contrast!==void 0?e.contrast:1,r=e.saturation!==void 0?e.saturation:1,l=t.scene.primitives,a=l.length,c=!!i.CustomShader;for(let u=0;u<a;++u){const h=l.get(u);if(h instanceof i.Cesium3DTileset)if(c)if(h.customShader&&h.customShader.isModelAdjustment)e.brightness!==void 0&&h.customShader.setUniform("u_brightness",s),e.contrast!==void 0&&h.customShader.setUniform("u_contrast",o),e.saturation!==void 0&&h.customShader.setUniform("u_saturation",r);else{const f=new i.CustomShader({uniforms:{u_brightness:{type:i.UniformType.FLOAT,value:s},u_contrast:{type:i.UniformType.FLOAT,value:o},u_saturation:{type:i.UniformType.FLOAT,value:r}},fragmentShaderText:`
97
+ `;this.promptDiv=window.document.createElement("div"),this.promptDiv.className=`easy3d-prompt ${this.opt.className}`,this.promptDiv.id=h,this.promptDiv.innerHTML=f,window.document.getElementById(o).appendChild(this.promptDiv);const A=window.document.getElementById(`prompt-close-${this.opt.id}`);let C=this;A&&A.addEventListener("click",m=>{C.hide(),C.opt.close&&C.opt.close()}),this.promptDom=window.document.getElementById(h),this.position=this.transPosition(this.opt.position),i==2&&this.bindRender(),this.opt.show==!1&&this.hide(),this.containerW=this.viewer.container.offsetWidth,this.containerH=this.viewer.container.offsetHeight,this.containerLeft=this.viewer.container.offsetLeft,this.containerTop=this.viewer.container.offsetTop,this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,this.opt.success&&this.opt.success()}destroy(){this.promptDiv&&(window.document.getElementById(this.viewer.container.id).removeChild(this.promptDiv),this.promptDiv=null),this.rendHandler&&(this.rendHandler(),this.rendHandler=null)}bindRender(){let e=this;this.rendHandler=this.viewer.scene.postRender.addEventListener(function(){if(!e.isShow&&e.promptDom){e.promptDom.style.display="none";return}if(e.position)if(e.position instanceof Cesium.Cartesian3){let t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(e.viewer.scene,e.position);if(!t)return;new Cesium.EllipsoidalOccluder(e.viewer.scene.globe.ellipsoid,e.viewer.scene.camera.position).isPointVisible(e.position)?e.promptDom&&(e.promptDom.style.display="block"):e.promptDom&&(e.promptDom.style.display="none"),e.setByPX({x:t.x,y:t.y})}else e.setByPX({x:e.position.x,y:e.position.y})},this)}update(e,t){e instanceof Cesium.Cartesian3&&(this.position=e.clone(),e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e)),this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,e&&this.setByPX(e),t&&this.setContent(t)}isInView(){if(!this.position)return!1;let e=null;this.position instanceof Cesium.Cartesian2?e=this.position:e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,this.position);const i=new Cesium.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.position).isPointVisible(this.position);let s=!1;return e?(e.x>this.containerLeft&&e.x<this.containerLeft+this.containerW&&e.y>this.containerTop&&e.y<this.containerTop+this.containerH&&(s=!0),i&&s):s}setVisible(e){this.isInView(this.position)&&e?(this.isShow=!0,this.promptDom&&(this.promptDom.style.display="block")):(this.isShow=!1,this.promptDom&&(this.promptDom.style.display="none"))}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}setContent(e){let t=window.document.getElementById(`prompt-content-${this.opt.id}`);t.innerHTML=e}setByPX(e){e&&this.promptDom&&(this.promptDom.offsetWidth,this.promptDom.offsetHeight,this.opt.type==1?(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)+"px"):(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)-Number(this.contentW)/2+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)-Number(this.contentH)+"px"))}transPosition(e){let t;return Array.isArray(e)?t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0).clone():e instanceof Cesium.Cartesian3?t=e.clone():t=e,t}}const Oa=Object.freeze(Object.defineProperty({__proto__:null,default:At},Symbol.toStringTag,{value:"Module"}));let ce={};ce.cartesianToLnglat=function(n,e){if(!n)return[];var t=Cesium.Cartographic.fromCartesian(n),i=Cesium.Math.toDegrees(t.latitude),s=Cesium.Math.toDegrees(t.longitude),o=t.height;return[s,i,o]},ce.getViewCenter=n=>{if(n){var e=n.camera.computeViewRectangle(),t=e.west/Math.PI*180,i=e.north/Math.PI*180,s=e.east/Math.PI*180,o=e.south/Math.PI*180;return[(s+t)/2,(i+o)/2]}},ce.cartesiansToLnglats=function(n,e){if(!(!n||n.length<1)){if(e=e||window.viewer,!e){console.log("util.cartesiansToLnglats方法缺少viewer对象");return}for(var t=[],i=0;i<n.length;i++)t.push(ce.cartesianToLnglat(n[i],e));return t}},ce.lnglatsToCartesians=function(n){if(!(!n||n.length<1)){for(var e=[],t=0;t<n.length;t++){var i=Cesium.Cartesian3.fromDegrees(n[t][0],n[t][1],n[t][2]||0);e.push(i)}return e}},ce.flyTo=function(n,e){if(!e){console.log("util.flyTo缺少viewer对象");return}n=n||{};let t=n.center;if(!t){console.log("缺少定位坐标!");return}if(t instanceof Cesium.Cartesian3&&e.camera.flyToBoundingSphere(new Cesium.BoundingSphere(t),{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(n.heading||0),Cesium.Math.toRadians(n.pitch||-60),n.range||1e4)}),t instanceof Array){var i=new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(t[0],t[1],t[2]));e.camera.flyToBoundingSphere(i,{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(n.heading||0),Cesium.Math.toRadians(n.pitch||-60),n.range||1e4)})}},ce.getCameraView=function(n){if(n=n||window.viewer,!n){console.log("util.getCameraView缺少viewer对象");return}var e=n.camera,t=e.position,i=e.heading,s=e.pitch,o=e.roll,r=Cesium.Cartographic.fromCartesian(t),l={x:Cesium.Math.toDegrees(r.longitude),y:Cesium.Math.toDegrees(r.latitude),z:r.height,heading:Cesium.Math.toDegrees(i),pitch:Cesium.Math.toDegrees(s),roll:Cesium.Math.toDegrees(o)};return l},ce.setCameraView=function(n,e){if(e=e||window.viewer,!e){console.log("util.setCameraView缺少viewer对象");return}if(n){var t=n.destination||Cesium.Cartesian3.fromDegrees(n.x,n.y,n.z);e.camera.flyTo({destination:t,orientation:{heading:Cesium.Math.toRadians(n.heading||0),pitch:Cesium.Math.toRadians(n.pitch||0),roll:Cesium.Math.toRadians(n.roll||0)},duration:n.duration===void 0?3:n.duration,complete:n.complete})}},ce.computeAreaOfTriangle=function(n,e,t){if(!n||!e||!t)return console.log("传入坐标有误!"),0;var i=Cesium.Cartesian3.distance(n,e),s=Cesium.Cartesian3.distance(e,t),o=Cesium.Cartesian3.distance(t,n),r=(i+s+o)/2;return Math.sqrt(r*(r-i)*(r-s)*(r-o))};class et{constructor(e,t){this.viewer=e,this.style=t||{},this.objId=+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0)),this.handler=void 0,this.modifyHandler=void 0,this.type="",this.positions=[],this.state=null,this.prompt=null,this.controlPoints=[],this.modifyPoint=null,this.entity=null,this.pointStyle={},this.promptStyle=this.style.prompt||{show:!0},this.properties={},this.clientScale=1}getCatesian3FromPX(e){if(e=this.transpx(e),this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){let o=this.viewer.camera.getPickRay(e),r=null;return o&&(r=this.viewer.scene.globe.pick(o,this.viewer.scene)),r||(r=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),r}let t=this.viewer.scene.drillPick(e);this.viewer.scene.render();let i,s=!1;for(let o=0;o<t.length;o++)if(t[o]&&t[o].primitive&&t[o].primitive instanceof Cesium.Cesium3DTileset){s=!0;break}if(s)i=this.viewer.scene.pickPosition(e);else{let o=this.viewer.camera.getPickRay(e);if(!o)return null;i=this.viewer.scene.globe.pick(o,this.viewer.scene)}return i}setClientScale(e){e=e||1,this.clientScale=e}transpx(e){return{x:e.x/(this.clientScale||1),y:e.y/(this.clientScale||1)}}getEntity(){return this.entity}getPositions(e){return e?ce.cartesiansToLnglats(this.positions,this.viewer):this.positions}getLnglats(){return ce.cartesiansToLnglats(this.positions,this.viewer)}setOwnProp(e){this.entity&&(this.entity.ownProp=e)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}setVisible(e){this.entity&&(this.entity.show=e)}forbidDrawWorld(e){this.viewer.scene.screenSpaceCameraController.enableRotate=!e,this.viewer.scene.screenSpaceCameraController.enableTilt=!e,this.viewer.scene.screenSpaceCameraController.enableTranslate=!e,this.viewer.scene.screenSpaceCameraController.enableInputs=!e}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.positions=[],this.style=null;for(var e=0;e<this.controlPoints.length;e++){var t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.modifyPoint=null,this.prompt&&(this.prompt.destroy(),this.prompt=null),this.state="no",this.forbidDrawWorld(!1)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this;for(let i=0;i<t.controlPoints.length;i++){let s=t.controlPoints[i];s&&(s.show=!0)}this.entity.show=!0,this.modifyHandler.setInputAction(function(i){if(!t.entity)return;let s=t.viewer.scene.pick(i.position);Cesium.defined(s)&&s.id&&(s.id.objId||(t.modifyPoint=s.id),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(t.positions.length<1||!t.modifyPoint)return;let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.position.setValue(s),t.positions[t.modifyPoint.wz]=s,t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(i){t.modifyPoint&&(t.modifyPoint=null,t.forbidDrawWorld(!1),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){for(let t=0;t<this.controlPoints.length;t++){let i=this.controlPoints[t];i&&(i.show=!1)}this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}endCreate(){}done(){}createPoint(e){if(!e)return;this.pointStyle.color=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE,this.pointStyle.outlineColor=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE;let t=this.pointStyle.color instanceof Cesium.Color?this.pointStyle.color:Cesium.Color.fromCssColorString(this.pointStyle.color);t=t.withAlpha(this.pointStyle.colorAlpha||1);let i=this.pointStyle.outlineColor instanceof Cesium.Color?this.pointStyle.outlineColor:Cesium.Color.fromCssColorString(this.pointStyle.outlineColor);return i=i.withAlpha(this.pointStyle.outlineColorAlpha||1),this.viewer.entities.add({position:e,point:{pixelSize:this.pointStyle.property||10,color:t,outlineWidth:this.pointStyle.outlineWidth||0,outlineColor:i,disableDepthTestDistance:Number.POSITIVE_INFINITY},show:!1})}transfromLineMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let i=e.color.getValue();t.colorAlpha=i.alpha,t.colorHex=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}return t}transfromGonMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let i=e.color.getValue();t.colorAlpha=i.alpha,t.colorHex=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}return t}setAttr(e){this.properties.attr=e||{}}getAttr(){return this.properties.attr}zoomTo(){this.entity&&this.viewer.zoomTo(this.entity)}}const Wg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAptJREFUOE+FVD1oU1EYvecVCU5acHFqsggKSlUcdDGZuvhToeAgYuIuaUcHMZ0c2+JuAg4dKrS6iFPiooMUAyqCS5PFTVpBKJKa4/nez817yateeOTm3vOd75zv3u/C5QySx50b3HMO89oupyBdzTvOHawBR3t5sRhfJH+tiqiu9X4UDJH80Tc169ywGCeZcY7CDZaB6b00hyckd6WKbW2WFLQoYCtPga0JW40I3Y6wt4T1alOE382OBuaBk7l20gnIHQkoyEFA5/YrQClUGhKS/YZ+FmVpVhuejNzXemhfwU4BWAUKywlxRBoYfguYkWohosXBruY14JS3Sf6Ik1CJpqRkaAe0ovSyeGJrRPrNiJr6ziu+K8LPCqBqdraYtdRPMms/GmRPxNiTGiP3g/ykcrELnKuKcNtAPeBCKHkU/EUKgw5wWvsJ4VcLFPbMGOG2HdBN4GJJhO9UVMju5VaacHxOfjClsux0AJd8kkj5+7LdEOAKRNgWoYEqGVBWbVvqoTpRiSsTicUhQidC0ZBvjFAXdE4WJwe5qUM7ovtmmGtmbWKQr0UYiHDOCF9JmdXwulTkgddj8O2JrkrQ5EuJQRW4URThhv2pAwvT+YTNotaLQO0fJXlhTaFTXrBTXlfA0CypPndy6vPU6nMVeOAvdDox+Tx0IA4V8G4n7pRnVht7XbRYi1swCiOfyIF7DDzMeUia1v8ftd8H7lvipPVs47dZOqb+1I2v+ReEbMSWGxnLZBgTPyYFK8molyMlK9aXpk6krgHU1/JqGmPN5qaipJplYMm7ytiISA9kn7LvevpVzwZSRmWnlAb6WNWeqX6r66SXacm78ZbHlahuChhaj1uL6TH146dmSsIW8ChTggRx6N06zO7/1v8CLeIaJJK0e+4AAAAASUVORK5CYII=";class zg extends et{constructor(e,t){super(e,t),this.type="billboard",this.viewer=e;let i={verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1};this.style=Object.assign({},i,t||{}),this.entity=null,this.style.hasOwnProperty("image")||console.warn("CreateBillboard: 未在 style 中指定 image,后续将使用回退图或占位图。"),this.position=null,this._defaultFallback=Wg,this.prompt=null,this.modifyHandler=null,this._globalMouseUpHandler=null,this._isDragging=!1,this._editPickedEntity=null,this.controlPoints=[],this.modifyPoint=null,this._isScaling=!1,this._fileInput=null}_preloadImage(e,t=7e3){return new Promise((i,s)=>{if(!e)return s(new Error("empty url"));try{const o=new window.Image;o.crossOrigin="anonymous";let r=!1;const l=()=>{r||(r=!0,clearTimeout(c),i(o))},a=u=>{r||(r=!0,clearTimeout(c),s(new Error("image load error: "+e)))};o.onload=l,o.onerror=a;const c=setTimeout(()=>{r||(r=!0,o.onload=o.onerror=null,s(new Error("image load timeout: "+e)))},t);o.src=e}catch(o){s(o)}})}createBillboard(e){if(!e)return;const t=this.style.fallbackImage||this._defaultFallback,i=this.viewer.entities.add({position:e,billboard:{image:t,scale:this.style.scale||1,pixelOffset:this.style.pixelOffset,heightReference:this.style.heightReference==null?Cesium.HeightReference.CLAMP_TO_GROUND:Number(this.style.heightReference),verticalOrigin:Cesium.VerticalOrigin.BOTTOM,color:this.style.color?this.style.color instanceof Cesium.Color?this.style.color.withAlpha(this.style.colorAlpha||1):Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE}});i.objId=this.objId;const s=this.style.image;if(s)this._preloadImage(s,7e3).then(o=>{try{i.billboard.image=o,this.style.image=s}catch(r){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",r);try{i.billboard.image=s}catch{}}try{this.viewer.scene.requestRender()}catch{}}).catch(o=>{console.error("CreateBillboard: image load failed:",o.message," URL:",s," 使用回退图:",t);try{this.viewer.scene.requestRender()}catch{}});else try{this.viewer.scene.requestRender()}catch{}return this.position=e.clone(),this.entity=i,i}updateBillboardImage(e){if(!this.entity||!this.entity.billboard)return;const t=this.style.fallbackImage||this._defaultFallback;if(!e){try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}return}try{this.entity.billboard.image=t}catch{}this._preloadImage(e,7e3).then(i=>{try{this.entity.billboard.image=i}catch(s){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",s);try{this.entity.billboard.image=e}catch{}}this.style.image=e;try{this.viewer.scene.requestRender()}catch{}}).catch(i=>{console.error("CreateBillboard: updateBillboardImage failed to load:",i.message," URL:",e);try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}})}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);if(s){if(t.position=s.clone(),t.entity=t.createBillboard(t.position),t.handler){try{t.handler.destroy()}catch{}t.handler=null}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}t.state="endCreate",e&&e(t.entity)}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt&&t.prompt.update&&t.prompt.update(i.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;if(e.handler){try{e.handler.destroy()}catch{}e.handler=null}if(e.prompt){try{e.prompt.destroy()}catch{}e.prompt=null}e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=null;e instanceof Cesium.Cartesian3?i=e.clone():i=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0)),i&&(this.position=i.clone(),this.entity=this.createBillboard(this.position),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(!e)return;let t=this.entity&&this.entity.billboard;if(t){if(e.image!=null&&this.updateBillboardImage(e.image),e.heightReference!=null){let i=1;e.heightReference==!0?i=1:i=Number(e.heightReference);try{t.heightReference=i}catch{}}if(e.scale!=null)try{t.scale=Number(e.scale)}catch{}if(e.color){let i=e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color);i=i.withAlpha(e.colorAlpha||1);try{t.color=i}catch{}}}this.style=Object.assign(this.style,e)}getStyle(){let e={},t=this.entity&&this.entity.billboard;if(e.image=this.style.image,t&&t.heightReference)try{let i=t.heightReference.getValue();e.heightReference=Number(i)}catch{}if(t&&t.scale)try{e.scale=t.scale.getValue()}catch{}if(t&&t.color)try{let i=t.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString()}catch{}return e}startEdit(e){if(this._cleanupEditState(),!this.entity)return;this.state="startEdit",this.controlPoints=[],this.showControlPoints(),this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);let t=this,i=null,s=!1;const o=()=>{if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}i=null,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}};window.addEventListener("mouseup",o,!0),this._globalMouseUpHandler=o,this.modifyHandler.setInputAction(function(r){const l=t.viewer.scene.pick(r.position);if(Cesium.defined(l)&&l.id){if(l.id===t.entity){i=l.id,s=!0,t._isDragging=!0,t._editPickedEntity=i,t.modifyPoint=null;try{t.forbidDrawWorld(!0)}catch{}}else if(t.controlPoints.includes(l.id)){t.modifyPoint=l.id,s=!0,t._isDragging=!0,i=t.entity;try{t.forbidDrawWorld(!0)}catch{}}}},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(r){if(!s)return;let l=t.getCatesian3FromPX(r.endPosition,t.viewer);if(l){if(Cesium.defined(i)){try{i.position.setValue(l)}catch{i.position=l}t.position=l.clone(),t.controlPoints&&t.controlPoints.length>0&&t.controlPoints.forEach(a=>{try{a.position.setValue(l)}catch(c){console.warn("更新控制点位置失败:",c);try{a.position=l.clone()}catch(u){console.error("重新设置控制点位置失败:",u)}}})}t.state="editing",e&&e()}},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}},Cesium.ScreenSpaceEventType.LEFT_UP),this.modifyHandler.setInputAction(function(){if(t._isScaling){t._isScaling=!1,t._isDragging=!1,t._scalingControlPoint=null,delete t._initialScale,delete t._initialMousePosition,t.viewer.canvas.style.cursor="",t._hideScaleHint();try{t.forbidDrawWorld(!1)}catch{}}if(s){s=!1,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}}if(t.hideControlPoints(),t.modifyHandler){try{t.modifyHandler.destroy()}catch{}t.modifyHandler=null}t._globalMouseUpHandler&&(window.removeEventListener("mouseup",t._globalMouseUpHandler,!0),t._globalMouseUpHandler=null),t.state="endEdit"},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.modifyHandler.setInputAction(function(r){const l=t.viewer.scene.pick(r.position);Cesium.defined(l)&&l.id===t.entity&&t._handleDoubleClick()},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}createControlPoint(e){return e?this.viewer.entities.add({position:e,point:{pixelSize:8,color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}}):null}createYellowControlPoint(e){if(!e)return null;const t=this.viewer.entities.add({position:e,point:{pixelSize:10,color:Cesium.Color.YELLOW,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return t.isYellowControl=!0,t}createScaleControlPoint(e,t){if(!e)return null;let i=Cesium.Color.GREEN;t==="bottomLeft"&&(i=Cesium.Color.BLUE);const s=this.viewer.entities.add({position:e,point:{pixelSize:10,color:i,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return s.isScaleControl=!0,s.corner=t,s}_calculateSpecialPosition(e){return this._calculateCornerPosition(e,"bottomRight")}_calculateCornerPosition(e,t){if(!e)return null;const s=50*(this.style.scale||1),o=this.viewer.camera,r=new Cesium.Cartesian3,l=new Cesium.Cartesian3,a=new Cesium.Cartesian3;Cesium.Cartesian3.clone(o.direction,r),Cesium.Cartesian3.clone(o.right,l),Cesium.Cartesian3.clone(o.up,a),Cesium.Cartesian3.normalize(r,r),Cesium.Cartesian3.normalize(l,l),Cesium.Cartesian3.normalize(a,a);const c=new Cesium.Cartesian3;Cesium.Cartesian3.multiplyByScalar(l,s,c),Cesium.Cartesian3.multiplyByScalar(a,s,a),Cesium.Cartesian3.add(c,a,c);const u=new Cesium.Ray(e,r),h=this.viewer.scene.globe.pick(u,this.viewer.scene),p=Cesium.Cartesian3.distance(e,h||e)*.001;return Cesium.Cartesian3.multiplyByScalar(c,p,c),Cesium.Cartesian3.add(e,c,new Cesium.Cartesian3)}showControlPoints(){if(this.controlPoints=this.controlPoints||[],this._isDragging){this.position&&this.controlPoints.length>0&&this.controlPoints.forEach(e=>{try{e.position.setValue(this.position)}catch{try{e.position=this.position.clone()}catch(i){console.warn("更新拖拽中控制点位置失败:",i)}}});return}if(this.controlPoints.length>0&&([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(i){console.warn("移除控制点失败:",i)}}),this.controlPoints.length=0),this.position&&this.viewer&&!this._isDragging){const e=this.createControlPoint(this.position);e&&(e.wz=0,this.controlPoints.push(e))}}hideControlPoints(){this.controlPoints&&Array.isArray(this.controlPoints)&&this.controlPoints.length>0?([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(i){console.warn("移除控制点失败:",i)}}),this.controlPoints.length=0):(!this.controlPoints||!Array.isArray(this.controlPoints))&&(this.controlPoints=[]),this.topRightControlPoint=null,this.bottomLeftControlPoint=null,this.scaleControlPoint=null,this.modifyPoint=null}endEdit(e){if(this.hideControlPoints(),this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}try{this.forbidDrawWorld(!1)}catch{}this.viewer&&this.viewer.canvas&&(this.viewer.canvas.style.cursor=""),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null,this.state="endEdit",e&&e(this.entity)}_cleanupEditState(){if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}if(this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}this.controlPoints=this.controlPoints||[],this.hideControlPoints(),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null;try{this.forbidDrawWorld(!1)}catch{}}_showScaleHint(e){this._scaleHintElement||(this._scaleHintElement=document.createElement("div"),this._scaleHintElement.style.position="absolute",this._scaleHintElement.style.background="rgba(0, 0, 0, 0.7)",this._scaleHintElement.style.color="white",this._scaleHintElement.style.padding="4px 8px",this._scaleHintElement.style.borderRadius="4px",this._scaleHintElement.style.fontSize="12px",this._scaleHintElement.style.pointerEvents="none",this._scaleHintElement.style.zIndex="10000",document.body.appendChild(this._scaleHintElement)),this._scaleHintElement.textContent=`缩放: ${e.toFixed(2)}x`,this._scaleHintElement.style.left=`${window.event.clientX+10}px`,this._scaleHintElement.style.top=`${window.event.clientY-30}px`,this._scaleHintElement.style.display="block"}_hideScaleHint(){this._scaleHintElement&&(this._scaleHintElement.style.display="none")}move(e){if(!this.entity)return;let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0));try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone(),this.state="editing"}_createFileInput(){if(this._fileInput)return this._fileInput;const e=document.createElement("input");return e.type="file",e.accept="image/*",e.style.display="none",e.onchange=t=>{this._handleFileUpload(t)},document.body.appendChild(e),this._fileInput=e,e}_handleFileUpload(e){const t=e.target.files[0];if(!t)return;if(!t.type.match("image.*")){console.warn("请选择有效的图片文件");return}const i=new FileReader;i.onload=s=>{this.updateBillboardImage(s.target.result),this._fileInput&&(this._fileInput.value="")},i.onerror=s=>{console.error("文件读取失败:",s)},i.readAsDataURL(t)}_handleDoubleClick(){this._createFileInput().click()}editImage(e){return e?(this.updateBillboardImage(e),!0):(console.warn("CreateBillboard.editImage: 未提供有效的图片URL"),!1)}remove(){try{this.endEdit()}catch{}if(this.entity){this.state="no";try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}}getPositions(e){return e?ce.cartesianToLnglat(this.position,this.viewer):this.position}getLnglats(){return this.getPositions(!0)}setPosition(e){let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0);try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone()}destroy(){try{this.endEdit()}catch{}if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.position=null,this.state="no",this._isDragging=!1,this._editPickedEntity=null}}class jg extends et{constructor(e,t){super(e,t),this.type="circle",this.viewer=e,this.style=t||{},this.center=null,this.radiusPoint=null,this.radiusPointEntity=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null,this.pointsCount=64}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(i){const s=t.getCatesian3FromPX(i.position,t.viewer,[]);s&&(t.entity?(t.endCreate(),e&&e(t.entity)):(t.center=s.clone(),t.radiusPoint=s.clone(),t.entity=t._createPolyline(),t.radiusPointEntity=t.createPoint(t.radiusPoint),t.radiusPointEntity.typeAttr="radius",t.radiusPointEntity.show=!1))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(!t.entity){t.prompt?.update(i.endPosition,"单击开始绘制");return}t.prompt?.update(i.endPosition,"单击结束");const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);s&&(t.radiusPoint=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.radiusPointEntity&&(this.radiusPointEntity.show=!0),this.modifyHandler.setInputAction(function(i){const s=t.viewer.scene.pick(i.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(i.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="radius"&&(t.radiusPoint=s.clone()),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildCirclePositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildCirclePositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildCirclePositions(){if(!this.center||!this.radiusPoint)return[];const e=[],t=Cesium.Ellipsoid.WGS84,i=t.cartesianToCartographic(this.center),s=t.cartesianToCartographic(this.radiusPoint),o=Math.abs(s.longitude-i.longitude),r=Math.abs(s.latitude-i.latitude);for(let l=0;l<=this.pointsCount;l++){const a=l/this.pointsCount*Math.PI*2,c=i.longitude+o*Math.cos(a),u=i.latitude+r*Math.sin(a);e.push(Cesium.Cartesian3.fromRadians(c,u))}return e}_updateAuxPoints(){!this.radiusPoint||!this.radiusPointEntity||(this.radiusPointEntity.position=this.radiusPoint)}syncFromEntity(){if(!this.entity||!this.center||!this.radiusPoint)return;const e=this.center,t=this.entity._centerCoord;if(!t)return;const i=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.center=new Cesium.Cartesian3(this.center.x+i,this.center.y+s,this.center.z+o),this.radiusPoint=new Cesium.Cartesian3(this.radiusPoint.x+i,this.radiusPoint.y+s,this.radiusPoint.z+o);const r=this.entity.objId,l=this.entity._plotInstance;this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=l,this.entity.objId=r,this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.center||!this.radiusPoint)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.center=Cesium.Cartesian3.add(this.center,t,new Cesium.Cartesian3),this.radiusPoint=Cesium.Cartesian3.add(this.radiusPoint,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update circle positions:",t),!1}}getPositions(e){return e?ce.cartesiansToLnglats([this.center,this.radiusPoint],this.viewer):[this.center,this.radiusPoint]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let i=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(i=i.withAlpha(t.colorAlpha)),this.entity.polyline.material=i,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.prompt?.destroy(),this.prompt=null}catch{}}_manageRadiusPointEntity(){this.radiusPointEntity?this.radiusPoint&&(this.radiusPointEntity.position=this.radiusPoint):(this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity&&(this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=!1))}createByPositions(e,t){try{if(!e||e.length===0)return console.error("createByPositions: positions array is empty or undefined"),t&&t(null),this;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length===0)return console.error("createByPositions: failed to convert positions to Cartesian3"),t&&t(null),this;if(i.length>=2)this.center=Cesium.Cartesian3.clone(i[0]),this.radiusPoint=Cesium.Cartesian3.clone(i[1]);else if(i.length===1)this.center=Cesium.Cartesian3.clone(i[0]),this._createDefaultRadiusPoint();else return console.error("createByPositions: invalid positions array"),t&&t(null),this;this.entity?this._updatePolyline():this.entity=this._createPolyline(),this._manageRadiusPointEntity(),this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),this}catch(i){return console.error("createByPositions error:",i),t&&t(null),this}}}class $g extends et{constructor(e,t){if(super(e,t),this.type="gltfModel",t=t||{},this.viewer=e,!t.uri){console.warn("请输入模型地址!");return}let i={heading:0,pitch:0,roll:0,minimumPixelSize:24,maximumScale:120};this.style=Object.assign(i,t||{}),this.modelUri=t.uri,this.entity=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);s&&(t.entity.position=s,t.position=s.clone()),t.endCreate(),e&&e(t.entity)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt.update(i.endPosition,"单击新增"),t.state="creating";let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity]);s&&(t.entity?t.entity.position=s:t.entity=t.createGltfModel(s.clone()))},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}createByPositions(e,t){e&&(this.state="startCreate",e instanceof Cesium.Cartesian3?this.position=e:this.position=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0),this.entity=this.createGltfModel(this.position),t(this.entity),this.state="endCreate")}startEdit(e){if(this.state=="startEdit"||this.state=="editing")return;this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,i;this.state="startEdit",this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(i=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!i)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer,[t.entity]);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o.clone()),t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){i&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createGltfModel(e){if(!e)return;let t=Cesium.Math.toRadians(this.style.heading),i=Cesium.Math.toRadians(this.style.pitch),s=Cesium.Math.toRadians(this.style.roll),o=new Cesium.HeadingPitchRoll(t,i,s),r=Cesium.Transforms.headingPitchRollQuaternion(e,o),l=this.viewer.entities.add({position:e,orientation:r,model:{uri:this.modelUri,minimumPixelSize:this.style.minimumPixelSize,maximumScale:this.style.maximumScale,scale:this.style.scale||1,heightReference:this.style.heightReference}});return l.objId=this.objId,l}getPositions(e){return e?ce.cartesianToLnglat(this.position,this.viewer):this.position}getStyle(){let e={},t=this.entity.model;e.minimumPixelSize=t.minimumPixelSize.getValue();let i=this.entity.orientation.getValue(),s=this.entity.position.getValue(this.viewer.clock.currentTime),o=ce.oreatationToHpr(s.clone(),i,!0)||{};e.heading=(o.heading||0)<360?o.heading+360:o.heading,e.pitch=o.pitch||0,e.roll=o.roll||0,e.scale=t.scale.getValue(),e.uri=t.uri.getValue();let r=this.entity.heightReference&&this.entity.heightReference.getValue();return r!=null&&(e.heightReference=Number(r)),e}setStyle(e){e&&(this.setOrientation(e.heading,e.pitch,e.roll),this.entity.model.scale.setValue(e.scale==null?1:e.scale),e.uri&&this.entity.model.uri.setValue(e.uri),e.heightReference!=null&&this.entity.model.heightReference.setValue(Number(e.heightReference)),this.style=Object.assign(this.style,e))}setOrientation(e,t,i){e=e||0,t=t||0,i=i||0,this.style.heading=e,this.style.pitch=t,this.style.roll=i;var s=Cesium.Math.toRadians(e||0),o=Cesium.Math.toRadians(t||0),r=Cesium.Math.toRadians(i||0),l=new Cesium.HeadingPitchRoll(s,o,r),a=this.entity.position._value,c=Cesium.Transforms.headingPitchRollQuaternion(a,l);this.entity&&(this.entity.orientation=c)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.style=null,this.prompt&&(this.prompt.destroy(),this.prompt=null)}}String.prototype.codePointAt||(function(){var n=(function(){try{var t={},i=Object.defineProperty,s=i(t,t,t)&&i}catch{}return s})(),e=function(t){if(this==null)throw TypeError();var i=String(this),s=i.length,o=t?Number(t):0;if(o!=o&&(o=0),!(o<0||o>=s)){var r=i.charCodeAt(o),l;return r>=55296&&r<=56319&&s>o+1&&(l=i.charCodeAt(o+1),l>=56320&&l<=57343)?(r-55296)*1024+l-56320+65536:r}};n?n(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e})();function tn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs,La;function Kg(){if(La)return Qs;La=1;var n=0,e=-3;function t(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function i(g,F){this.source=g,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=F,this.destLen=0,this.ltree=new t,this.dtree=new t}var s=new t,o=new t,r=new Uint8Array(30),l=new Uint16Array(30),a=new Uint8Array(30),c=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new t,f=new Uint8Array(320);function p(g,F,D,P){var L,G;for(L=0;L<D;++L)g[L]=0;for(L=0;L<30-D;++L)g[L+D]=L/D|0;for(G=P,L=0;L<30;++L)F[L]=G,G+=1<<g[L]}function A(g,F){var D;for(D=0;D<7;++D)g.table[D]=0;for(g.table[7]=24,g.table[8]=152,g.table[9]=112,D=0;D<24;++D)g.trans[D]=256+D;for(D=0;D<144;++D)g.trans[24+D]=D;for(D=0;D<8;++D)g.trans[168+D]=280+D;for(D=0;D<112;++D)g.trans[176+D]=144+D;for(D=0;D<5;++D)F.table[D]=0;for(F.table[5]=32,D=0;D<32;++D)F.trans[D]=D}var C=new Uint16Array(16);function m(g,F,D,P){var L,G;for(L=0;L<16;++L)g.table[L]=0;for(L=0;L<P;++L)g.table[F[D+L]]++;for(g.table[0]=0,G=0,L=0;L<16;++L)C[L]=G,G+=g.table[L];for(L=0;L<P;++L)F[D+L]&&(g.trans[C[F[D+L]]++]=L)}function y(g){g.bitcount--||(g.tag=g.source[g.sourceIndex++],g.bitcount=7);var F=g.tag&1;return g.tag>>>=1,F}function E(g,F,D){if(!F)return D;for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var P=g.tag&65535>>>16-F;return g.tag>>>=F,g.bitcount-=F,P+D}function I(g,F){for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var D=0,P=0,L=0,G=g.tag;do P=2*P+(G&1),G>>>=1,++L,D+=F.table[L],P-=F.table[L];while(P>=0);return g.tag=G,g.bitcount-=L,F.trans[D+P]}function M(g,F,D){var P,L,G,N,b,w;for(P=E(g,5,257),L=E(g,5,1),G=E(g,4,4),N=0;N<19;++N)f[N]=0;for(N=0;N<G;++N){var v=E(g,3,0);f[u[N]]=v}for(m(h,f,0,19),b=0;b<P+L;){var B=I(g,h);switch(B){case 16:var R=f[b-1];for(w=E(g,2,3);w;--w)f[b++]=R;break;case 17:for(w=E(g,3,3);w;--w)f[b++]=0;break;case 18:for(w=E(g,7,11);w;--w)f[b++]=0;break;default:f[b++]=B;break}}m(F,f,0,P),m(D,f,P,L)}function k(g,F,D){for(;;){var P=I(g,F);if(P===256)return n;if(P<256)g.dest[g.destLen++]=P;else{var L,G,N,b;for(P-=257,L=E(g,r[P],l[P]),G=I(g,D),N=g.destLen-E(g,a[G],c[G]),b=N;b<N+L;++b)g.dest[g.destLen++]=g.dest[b]}}}function S(g){for(var F,D,P;g.bitcount>8;)g.sourceIndex--,g.bitcount-=8;if(F=g.source[g.sourceIndex+1],F=256*F+g.source[g.sourceIndex],D=g.source[g.sourceIndex+3],D=256*D+g.source[g.sourceIndex+2],F!==(~D&65535))return e;for(g.sourceIndex+=4,P=F;P;--P)g.dest[g.destLen++]=g.source[g.sourceIndex++];return g.bitcount=0,n}function x(g,F){var D=new i(g,F),P,L,G;do{switch(P=y(D),L=E(D,2,0),L){case 0:G=S(D);break;case 1:G=k(D,s,o);break;case 2:M(D,D.ltree,D.dtree),G=k(D,D.ltree,D.dtree);break;default:G=e}if(G!==n)throw new Error("Data error")}while(!P);return D.destLen<D.dest.length?typeof D.dest.slice=="function"?D.dest.slice(0,D.destLen):D.dest.subarray(0,D.destLen):D.dest}return A(s,o),p(r,l,4,3),p(a,c,2,1),r[28]=0,l[28]=258,Qs=x,Qs}var Xg=Kg();const qg=tn(Xg);function nn(n,e,t,i,s){return Math.pow(1-s,3)*n+3*Math.pow(1-s,2)*s*e+3*(1-s)*Math.pow(s,2)*t+Math.pow(s,3)*i}function yt(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}yt.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},yt.prototype.addPoint=function(n,e){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},yt.prototype.addX=function(n){this.addPoint(n,null)},yt.prototype.addY=function(n){this.addPoint(null,n)},yt.prototype.addBezier=function(n,e,t,i,s,o,r,l){const a=[n,e],c=[t,i],u=[s,o],h=[r,l];this.addPoint(n,e),this.addPoint(r,l);for(let f=0;f<=1;f++){const p=6*a[f]-12*c[f]+6*u[f],A=-3*a[f]+9*c[f]-9*u[f]+3*h[f],C=3*c[f]-3*a[f];if(A===0){if(p===0)continue;const I=-C/p;0<I&&I<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],I)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],I)));continue}const m=Math.pow(p,2)-4*C*A;if(m<0)continue;const y=(-p+Math.sqrt(m))/(2*A);0<y&&y<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],y)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],y)));const E=(-p-Math.sqrt(m))/(2*A);0<E&&E<1&&(f===0&&this.addX(nn(a[f],c[f],u[f],h[f],E)),f===1&&this.addY(nn(a[f],c[f],u[f],h[f],E)))}},yt.prototype.addQuad=function(n,e,t,i,s,o){const r=n+.6666666666666666*(t-n),l=e+2/3*(i-e),a=r+1/3*(s-n),c=l+1/3*(o-e);this.addBezier(n,e,r,l,a,c,s,o)};function be(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}be.prototype.moveTo=function(n,e){this.commands.push({type:"M",x:n,y:e})},be.prototype.lineTo=function(n,e){this.commands.push({type:"L",x:n,y:e})},be.prototype.curveTo=be.prototype.bezierCurveTo=function(n,e,t,i,s,o){this.commands.push({type:"C",x1:n,y1:e,x2:t,y2:i,x:s,y:o})},be.prototype.quadTo=be.prototype.quadraticCurveTo=function(n,e,t,i){this.commands.push({type:"Q",x1:n,y1:e,x:t,y:i})},be.prototype.close=be.prototype.closePath=function(){this.commands.push({type:"Z"})},be.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof yt){const e=n;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,n)},be.prototype.getBoundingBox=function(){const n=new yt;let e=0,t=0,i=0,s=0;for(let o=0;o<this.commands.length;o++){const r=this.commands[o];switch(r.type){case"M":n.addPoint(r.x,r.y),e=i=r.x,t=s=r.y;break;case"L":n.addPoint(r.x,r.y),i=r.x,s=r.y;break;case"Q":n.addQuad(i,s,r.x1,r.y1,r.x,r.y),i=r.x,s=r.y;break;case"C":n.addBezier(i,s,r.x1,r.y1,r.x2,r.y2,r.x,r.y),i=r.x,s=r.y;break;case"Z":i=e,s=t;break;default:throw new Error("Unexpected path command "+r.type)}}return n.isEmpty()&&n.addPoint(0,0),n},be.prototype.draw=function(n){n.beginPath();for(let e=0;e<this.commands.length;e+=1){const t=this.commands[e];t.type==="M"?n.moveTo(t.x,t.y):t.type==="L"?n.lineTo(t.x,t.y):t.type==="C"?n.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?n.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&n.closePath()}this.fill&&(n.fillStyle=this.fill,n.fill()),this.stroke&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeWidth,n.stroke())},be.prototype.toPathData=function(n){n=n!==void 0?n:2;function e(s){return Math.round(s)===s?""+Math.round(s):s.toFixed(n)}function t(){let s="";for(let o=0;o<arguments.length;o+=1){const r=arguments[o];r>=0&&o>0&&(s+=" "),s+=e(r)}return s}let i="";for(let s=0;s<this.commands.length;s+=1){const o=this.commands[s];o.type==="M"?i+="M"+t(o.x,o.y):o.type==="L"?i+="L"+t(o.x,o.y):o.type==="C"?i+="C"+t(o.x1,o.y1,o.x2,o.y2,o.x,o.y):o.type==="Q"?i+="Q"+t(o.x1,o.y1,o.x,o.y):o.type==="Z"&&(i+="Z")}return i},be.prototype.toSVG=function(n){let e='<path d="';return e+=this.toPathData(n),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},be.prototype.toDOMElement=function(n){const e=this.toPathData(n),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function Na(n){throw new Error(n)}function Ua(n,e){n||Na(e)}const ie={fail:Na,argument:Ua,assert:Ua},_a=32768,Qa=2147483648,sn={},z={},te={};function Ge(n){return function(){return n}}z.BYTE=function(n){return ie.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},te.BYTE=Ge(1),z.CHAR=function(n){return[n.charCodeAt(0)]},te.CHAR=Ge(1),z.CHARARRAY=function(n){const e=[];for(let t=0;t<n.length;t+=1)e[t]=n.charCodeAt(t);return e},te.CHARARRAY=function(n){return n.length},z.USHORT=function(n){return[n>>8&255,n&255]},te.USHORT=Ge(2),z.SHORT=function(n){return n>=_a&&(n=-(2*_a-n)),[n>>8&255,n&255]},te.SHORT=Ge(2),z.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},te.UINT24=Ge(3),z.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},te.ULONG=Ge(4),z.LONG=function(n){return n>=Qa&&(n=-(2*Qa-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},te.LONG=Ge(4),z.FIXED=z.ULONG,te.FIXED=te.ULONG,z.FWORD=z.SHORT,te.FWORD=te.SHORT,z.UFWORD=z.USHORT,te.UFWORD=te.USHORT,z.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},te.LONGDATETIME=Ge(8),z.TAG=function(n){return ie.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},te.TAG=Ge(4),z.Card8=z.BYTE,te.Card8=te.BYTE,z.Card16=z.USHORT,te.Card16=te.USHORT,z.OffSize=z.BYTE,te.OffSize=te.BYTE,z.SID=z.USHORT,te.SID=te.USHORT,z.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?z.NUMBER16(n):z.NUMBER32(n)},te.NUMBER=function(n){return z.NUMBER(n).length},z.NUMBER16=function(n){return[28,n>>8&255,n&255]},te.NUMBER16=Ge(3),z.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},te.NUMBER32=Ge(5),z.REAL=function(n){let e=n.toString();const t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){const o=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(n*o)/o).toString()}let i="";for(let o=0,r=e.length;o<r;o+=1){const l=e[o];l==="e"?i+=e[++o]==="-"?"c":"b":l==="."?i+="a":l==="-"?i+="e":i+=l}i+=i.length&1?"f":"ff";const s=[30];for(let o=0,r=i.length;o<r;o+=2)s.push(parseInt(i.substr(o,2),16));return s},te.REAL=function(n){return z.REAL(n).length},z.NAME=z.CHARARRAY,te.NAME=te.CHARARRAY,z.STRING=z.CHARARRAY,te.STRING=te.CHARARRAY,sn.UTF8=function(n,e,t){const i=[],s=t;for(let o=0;o<s;o++,e+=1)i[o]=n.getUint8(e);return String.fromCharCode.apply(null,i)},sn.UTF16=function(n,e,t){const i=[],s=t/2;for(let o=0;o<s;o++,e+=2)i[o]=n.getUint16(e);return String.fromCharCode.apply(null,i)},z.UTF16=function(n){const e=[];for(let t=0;t<n.length;t+=1){const i=n.charCodeAt(t);e[e.length]=i>>8&255,e[e.length]=i&255}return e},te.UTF16=function(n){return n.length*2};const Hs={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};sn.MACSTRING=function(n,e,t,i){const s=Hs[i];if(s===void 0)return;let o="";for(let r=0;r<t;r++){const l=n.getUint8(e+r);l<=127?o+=String.fromCharCode(l):o+=s[l&127]}return o};const mi=typeof WeakMap=="function"&&new WeakMap;let Ai;const Jg=function(n){if(!Ai){Ai={};for(let s in Hs)Ai[s]=new String(s)}const e=Ai[n];if(e===void 0)return;if(mi){const s=mi.get(e);if(s!==void 0)return s}const t=Hs[n];if(t===void 0)return;const i={};for(let s=0;s<t.length;s++)i[t.charCodeAt(s)]=s+128;return mi&&mi.set(e,i),i};z.MACSTRING=function(n,e){const t=Jg(e);if(t===void 0)return;const i=[];for(let s=0;s<n.length;s++){let o=n.charCodeAt(s);if(o>=128&&(o=t[o],o===void 0))return;i[s]=o}return i},te.MACSTRING=function(n,e){const t=z.MACSTRING(n,e);return t!==void 0?t.length:0};function Gs(n){return n>=-128&&n<=127}function Zg(n,e,t){let i=0;const s=n.length;for(;e<s&&i<64&&n[e]===0;)++e,++i;return t.push(128|i-1),e}function em(n,e,t){let i=0;const s=n.length;let o=e;for(;o<s&&i<64;){const r=n[o];if(!Gs(r)||r===0&&o+1<s&&n[o+1]===0)break;++o,++i}t.push(i-1);for(let r=e;r<o;++r)t.push(n[r]+256&255);return o}function tm(n,e,t){let i=0;const s=n.length;let o=e;for(;o<s&&i<64;){const r=n[o];if(r===0||Gs(r)&&o+1<s&&Gs(n[o+1]))break;++o,++i}t.push(64|i-1);for(let r=e;r<o;++r){const l=n[r];t.push(l+65536>>8&255,l+256&255)}return o}z.VARDELTAS=function(n){let e=0;const t=[];for(;e<n.length;){const i=n[e];i===0?e=Zg(n,e,t):i>=-128&&i<=127?e=em(n,e,t):e=tm(n,e,t)}return t},z.INDEX=function(n){let e=1;const t=[e],i=[];for(let l=0;l<n.length;l+=1){const a=z.OBJECT(n[l]);Array.prototype.push.apply(i,a),e+=a.length,t.push(e)}if(i.length===0)return[0,0];const s=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,r=[void 0,z.BYTE,z.USHORT,z.UINT24,z.ULONG][o];for(let l=0;l<t.length;l+=1){const a=r(t[l]);Array.prototype.push.apply(s,a)}return Array.prototype.concat(z.Card16(n.length),z.OffSize(o),s,i)},te.INDEX=function(n){return z.INDEX(n).length},z.DICT=function(n){let e=[];const t=Object.keys(n),i=t.length;for(let s=0;s<i;s+=1){const o=parseInt(t[s],0),r=n[o];e=e.concat(z.OPERAND(r.value,r.type)),e=e.concat(z.OPERATOR(o))}return e},te.DICT=function(n){return z.DICT(n).length},z.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},z.OPERAND=function(n,e){let t=[];if(Array.isArray(e))for(let i=0;i<e.length;i+=1)ie.argument(n.length===e.length,"Not enough arguments given for type"+e),t=t.concat(z.OPERAND(n[i],e[i]));else if(e==="SID")t=t.concat(z.NUMBER(n));else if(e==="offset")t=t.concat(z.NUMBER32(n));else if(e==="number")t=t.concat(z.NUMBER(n));else if(e==="real")t=t.concat(z.REAL(n));else throw new Error("Unknown operand type "+e);return t},z.OP=z.BYTE,te.OP=te.BYTE;const yi=typeof WeakMap=="function"&&new WeakMap;z.CHARSTRING=function(n){if(yi){const i=yi.get(n);if(i!==void 0)return i}let e=[];const t=n.length;for(let i=0;i<t;i+=1){const s=n[i];e=e.concat(z[s.type](s.value))}return yi&&yi.set(n,e),e},te.CHARSTRING=function(n){return z.CHARSTRING(n).length},z.OBJECT=function(n){const e=z[n.type];return ie.argument(e!==void 0,"No encoding function for type "+n.type),e(n.value)},te.OBJECT=function(n){const e=te[n.type];return ie.argument(e!==void 0,"No sizeOf function for type "+n.type),e(n.value)},z.TABLE=function(n){let e=[];const t=n.fields.length,i=[],s=[];for(let o=0;o<t;o+=1){const r=n.fields[o],l=z[r.type];ie.argument(l!==void 0,"No encoding function for field type "+r.type+" ("+r.name+")");let a=n[r.name];a===void 0&&(a=r.value);const c=l(a);r.type==="TABLE"?(s.push(e.length),e=e.concat([0,0]),i.push(c)):e=e.concat(c)}for(let o=0;o<i.length;o+=1){const r=s[o],l=e.length;ie.argument(l<65536,"Table "+n.tableName+" too big."),e[r]=l>>8,e[r+1]=l&255,e=e.concat(i[o])}return e},te.TABLE=function(n){let e=0;const t=n.fields.length;for(let i=0;i<t;i+=1){const s=n.fields[i],o=te[s.type];ie.argument(o!==void 0,"No sizeOf function for field type "+s.type+" ("+s.name+")");let r=n[s.name];r===void 0&&(r=s.value),e+=o(r),s.type==="TABLE"&&(e+=2)}return e},z.RECORD=z.TABLE,te.RECORD=te.TABLE,z.LITERAL=function(n){return n},te.LITERAL=function(n){return n.length};function De(n,e,t){for(let i=0;i<e.length;i+=1){const s=e[i];this[s.name]=s.value}if(this.tableName=n,this.fields=e,t){const i=Object.keys(t);for(let s=0;s<i.length;s+=1){const o=i[s],r=t[o];this[o]!==void 0&&(this[o]=r)}}}De.prototype.encode=function(){return z.TABLE(this)},De.prototype.sizeOf=function(){return te.TABLE(this)};function Mn(n,e,t){t===void 0&&(t=e.length);const i=new Array(e.length+1);i[0]={name:n+"Count",type:"USHORT",value:t};for(let s=0;s<e.length;s++)i[s+1]={name:n+s,type:"USHORT",value:e[s]};return i}function Ys(n,e,t){const i=e.length,s=new Array(i+1);s[0]={name:n+"Count",type:"USHORT",value:i};for(let o=0;o<i;o++)s[o+1]={name:n+o,type:"TABLE",value:t(e[o],o)};return s}function Ci(n,e,t){const i=e.length;let s=[];s[0]={name:n+"Count",type:"USHORT",value:i};for(let o=0;o<i;o++)s=s.concat(t(e[o],o));return s}function Ei(n){n.format===1?De.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Mn("glyph",n.glyphs))):ie.assert(!1,"Can't create coverage table format 2 yet.")}Ei.prototype=Object.create(De.prototype),Ei.prototype.constructor=Ei;function wi(n){De.call(this,"scriptListTable",Ci("scriptRecord",n,function(e,t){const i=e.script;let s=i.defaultLangSys;return ie.assert(!!s,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new De("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new De("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(Mn("featureIndex",s.featureIndexes)))}].concat(Ci("langSys",i.langSysRecords,function(o,r){const l=o.langSys;return[{name:"langSysTag"+r,type:"TAG",value:o.tag},{name:"langSys"+r,type:"TABLE",value:new De("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:l.reqFeatureIndex}].concat(Mn("featureIndex",l.featureIndexes)))}]})))}]}))}wi.prototype=Object.create(De.prototype),wi.prototype.constructor=wi;function bi(n){De.call(this,"featureListTable",Ci("featureRecord",n,function(e,t){const i=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new De("featureTable",[{name:"featureParams",type:"USHORT",value:i.featureParams}].concat(Mn("lookupListIndex",i.lookupListIndexes)))}]}))}bi.prototype=Object.create(De.prototype),bi.prototype.constructor=bi;function vi(n,e){De.call(this,"lookupListTable",Ys("lookup",n,function(t){let i=e[t.lookupType];return ie.assert(!!i,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new De("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(Ys("subtable",t.subtables,i)))}))}vi.prototype=Object.create(De.prototype),vi.prototype.constructor=vi;const Z={Table:De,Record:De,Coverage:Ei,ScriptList:wi,FeatureList:bi,LookupList:vi,ushortList:Mn,tableList:Ys,recordList:Ci};function Ha(n,e){return n.getUint8(e)}function Ii(n,e){return n.getUint16(e,!1)}function nm(n,e){return n.getInt16(e,!1)}function Vs(n,e){return n.getUint32(e,!1)}function Ga(n,e){const t=n.getInt16(e,!1),i=n.getUint16(e+2,!1);return t+i/65535}function im(n,e){let t="";for(let i=e;i<e+4;i+=1)t+=String.fromCharCode(n.getInt8(i));return t}function sm(n,e,t){let i=0;for(let s=0;s<t;s+=1)i<<=8,i+=n.getUint8(e+s);return i}function om(n,e,t){const i=[];for(let s=e;s<t;s+=1)i.push(n.getUint8(s));return i}function rm(n){let e="";for(let t=0;t<n.length;t+=1)e+=String.fromCharCode(n[t]);return e}const am={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function H(n,e){this.data=n,this.offset=e,this.relativeOffset=0}H.prototype.parseByte=function(){const n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},H.prototype.parseChar=function(){const n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},H.prototype.parseCard8=H.prototype.parseByte,H.prototype.parseUShort=function(){const n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},H.prototype.parseCard16=H.prototype.parseUShort,H.prototype.parseSID=H.prototype.parseUShort,H.prototype.parseOffset16=H.prototype.parseUShort,H.prototype.parseShort=function(){const n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},H.prototype.parseF2Dot14=function(){const n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},H.prototype.parseULong=function(){const n=Vs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},H.prototype.parseOffset32=H.prototype.parseULong,H.prototype.parseFixed=function(){const n=Ga(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},H.prototype.parseString=function(n){const e=this.data,t=this.offset+this.relativeOffset;let i="";this.relativeOffset+=n;for(let s=0;s<n;s++)i+=String.fromCharCode(e.getUint8(t+s));return i},H.prototype.parseTag=function(){return this.parseString(4)},H.prototype.parseLongDateTime=function(){let n=Vs(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},H.prototype.parseVersion=function(n){const e=Ii(this.data,this.offset+this.relativeOffset),t=Ii(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),e+t/n/10},H.prototype.skip=function(n,e){e===void 0&&(e=1),this.relativeOffset+=am[n]*e},H.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint32(i),i+=4;return this.relativeOffset+=n*4,e},H.prototype.parseOffset16List=H.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint16(i),i+=2;return this.relativeOffset+=n*2,e},H.prototype.parseShortList=function(n){const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getInt16(i),i+=2;return this.relativeOffset+=n*2,e},H.prototype.parseByteList=function(n){const e=new Array(n),t=this.data;let i=this.offset+this.relativeOffset;for(let s=0;s<n;s++)e[s]=t.getUint8(i++);return this.relativeOffset+=n,e},H.prototype.parseList=function(n,e){e||(e=n,n=this.parseUShort());const t=new Array(n);for(let i=0;i<n;i++)t[i]=e.call(this);return t},H.prototype.parseList32=function(n,e){e||(e=n,n=this.parseULong());const t=new Array(n);for(let i=0;i<n;i++)t[i]=e.call(this);return t},H.prototype.parseRecordList=function(n,e){e||(e=n,n=this.parseUShort());const t=new Array(n),i=Object.keys(e);for(let s=0;s<n;s++){const o={};for(let r=0;r<i.length;r++){const l=i[r],a=e[l];o[l]=a.call(this)}t[s]=o}return t},H.prototype.parseRecordList32=function(n,e){e||(e=n,n=this.parseULong());const t=new Array(n),i=Object.keys(e);for(let s=0;s<n;s++){const o={};for(let r=0;r<i.length;r++){const l=i[r],a=e[l];o[l]=a.call(this)}t[s]=o}return t},H.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{const e=Object.keys(n),t={};for(let i=0;i<e.length;i++){const s=e[i],o=n[s];t[s]=o.call(this)}return t}},H.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;const e={};return n&1&&(e.xPlacement=this.parseShort()),n&2&&(e.yPlacement=this.parseShort()),n&4&&(e.xAdvance=this.parseShort()),n&8&&(e.yAdvance=this.parseShort()),n&16&&(e.xPlaDevice=void 0,this.parseShort()),n&32&&(e.yPlaDevice=void 0,this.parseShort()),n&64&&(e.xAdvDevice=void 0,this.parseShort()),n&128&&(e.yAdvDevice=void 0,this.parseShort()),e},H.prototype.parseValueRecordList=function(){const n=this.parseUShort(),e=this.parseUShort(),t=new Array(e);for(let i=0;i<e;i++)t[i]=this.parseValueRecord(n);return t},H.prototype.parsePointer=function(n){const e=this.parseOffset16();if(e>0)return new H(this.data,this.offset+e).parseStruct(n)},H.prototype.parsePointer32=function(n){const e=this.parseOffset32();if(e>0)return new H(this.data,this.offset+e).parseStruct(n)},H.prototype.parseListOfLists=function(n){const e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,s=new Array(t);for(let o=0;o<t;o++){const r=e[o];if(r===0){s[o]=void 0;continue}if(this.relativeOffset=r,n){const l=this.parseOffset16List(),a=new Array(l.length);for(let c=0;c<l.length;c++)this.relativeOffset=r+l[c],a[c]=n.call(this);s[o]=a}else s[o]=this.parseUShortList()}return this.relativeOffset=i,s},H.prototype.parseCoverage=function(){const n=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){const i=new Array(t);for(let s=0;s<t;s++)i[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}}throw new Error("0x"+n.toString(16)+": Coverage format must be 1 or 2.")},H.prototype.parseClassDef=function(){const n=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:H.uShort,end:H.uShort,classId:H.uShort})};throw new Error("0x"+n.toString(16)+": ClassDef format must be 1 or 2.")},H.list=function(n,e){return function(){return this.parseList(n,e)}},H.list32=function(n,e){return function(){return this.parseList32(n,e)}},H.recordList=function(n,e){return function(){return this.parseRecordList(n,e)}},H.recordList32=function(n,e){return function(){return this.parseRecordList32(n,e)}},H.pointer=function(n){return function(){return this.parsePointer(n)}},H.pointer32=function(n){return function(){return this.parsePointer32(n)}},H.tag=H.prototype.parseTag,H.byte=H.prototype.parseByte,H.uShort=H.offset16=H.prototype.parseUShort,H.uShortList=H.prototype.parseUShortList,H.uLong=H.offset32=H.prototype.parseULong,H.uLongList=H.prototype.parseULongList,H.struct=H.prototype.parseStruct,H.coverage=H.prototype.parseCoverage,H.classDef=H.prototype.parseClassDef;const Ya={reserved:H.uShort,reqFeatureIndex:H.uShort,featureIndexes:H.uShortList};H.prototype.parseScriptList=function(){return this.parsePointer(H.recordList({tag:H.tag,script:H.pointer({defaultLangSys:H.pointer(Ya),langSysRecords:H.recordList({tag:H.tag,langSys:H.pointer(Ya)})})}))||[]},H.prototype.parseFeatureList=function(){return this.parsePointer(H.recordList({tag:H.tag,feature:H.pointer({featureParams:H.offset16,lookupListIndexes:H.uShortList})}))||[]},H.prototype.parseLookupList=function(n){return this.parsePointer(H.list(H.pointer(function(){const e=this.parseUShort();ie.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");const t=this.parseUShort(),i=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(H.pointer(n[e])),markFilteringSet:i?this.parseUShort():void 0}})))||[]},H.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){const n=this.parseUShort(),e=this.parseUShort();return ie.argument(n===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:H.offset32,featureTableSubstitutionOffset:H.offset32})})||[]};const q={getByte:Ha,getCard8:Ha,getUShort:Ii,getCard16:Ii,getShort:nm,getULong:Vs,getFixed:Ga,getTag:im,getOffset:sm,getBytes:om,bytesToString:rm,Parser:H};function lm(n,e){e.parseUShort(),n.length=e.parseULong(),n.language=e.parseULong();let t;n.groupCount=t=e.parseULong(),n.glyphIndexMap={};for(let i=0;i<t;i+=1){const s=e.parseULong(),o=e.parseULong();let r=e.parseULong();for(let l=s;l<=o;l+=1)n.glyphIndexMap[l]=r,r++}}function cm(n,e,t,i,s){n.length=e.parseUShort(),n.language=e.parseUShort();let o;n.segCount=o=e.parseUShort()>>1,e.skip("uShort",3),n.glyphIndexMap={};const r=new q.Parser(t,i+s+14),l=new q.Parser(t,i+s+16+o*2),a=new q.Parser(t,i+s+16+o*4),c=new q.Parser(t,i+s+16+o*6);let u=i+s+16+o*8;for(let h=0;h<o-1;h+=1){let f;const p=r.parseUShort(),A=l.parseUShort(),C=a.parseShort(),m=c.parseUShort();for(let y=A;y<=p;y+=1)m!==0?(u=c.offset+c.relativeOffset-2,u+=m,u+=(y-A)*2,f=q.getUShort(t,u),f!==0&&(f=f+C&65535)):f=y+C&65535,n.glyphIndexMap[y]=f}}function dm(n,e){const t={};t.version=q.getUShort(n,e),ie.argument(t.version===0,"cmap table version should be 0."),t.numTables=q.getUShort(n,e+2);let i=-1;for(let o=t.numTables-1;o>=0;o-=1){const r=q.getUShort(n,e+4+o*8),l=q.getUShort(n,e+4+o*8+2);if(r===3&&(l===0||l===1||l===10)||r===0&&(l===0||l===1||l===2||l===3||l===4)){i=q.getULong(n,e+4+o*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");const s=new q.Parser(n,e+i);if(t.format=s.parseUShort(),t.format===12)lm(t,s);else if(t.format===4)cm(t,s,n,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function um(n,e,t){n.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function hm(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function fm(n){let e=!0,t;for(t=n.length-1;t>0;t-=1)if(n.get(t).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}let i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);const s=new Z.Table("cmap",i);for(s.segments=[],t=0;t<n.length;t+=1){const p=n.get(t);for(let A=0;A<p.unicodes.length;A+=1)um(s,p.unicodes[A],t);s.segments=s.segments.sort(function(A,C){return A.start-C.start})}hm(s);const o=s.segments.length;let r=0,l=[],a=[],c=[],u=[],h=[],f=[];for(t=0;t<o;t+=1){const p=s.segments[t];p.end<=65535&&p.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:p.end}),a=a.concat({name:"start_"+t,type:"USHORT",value:p.start}),c=c.concat({name:"idDelta_"+t,type:"SHORT",value:p.delta}),u=u.concat({name:"idRangeOffset_"+t,type:"USHORT",value:p.offset}),p.glyphId!==void 0&&(h=h.concat({name:"glyph_"+t,type:"USHORT",value:p.glyphId}))):r+=1,!e&&p.glyphIndex!==void 0&&(f=f.concat({name:"cmap12Start_"+t,type:"ULONG",value:p.start}),f=f.concat({name:"cmap12End_"+t,type:"ULONG",value:p.end}),f=f.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:p.glyphIndex}))}if(s.segCountX2=(o-r)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(o-r)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(a),s.fields=s.fields.concat(c),s.fields=s.fields.concat(u),s.fields=s.fields.concat(h),s.cmap4Length=14+l.length*2+2+a.length*2+c.length*2+u.length*2+h.length*2,!e){const p=16+f.length*4;s.cmap12Offset=20+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:p},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:f.length/3}]),s.fields=s.fields.concat(f)}return s}const Va={parse:dm,make:fm},xi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],pm=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],gm=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Ft=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Wa(n){this.font=n}Wa.prototype.charToGlyphIndex=function(n){const e=n.codePointAt(0),t=this.font.glyphs;if(t)for(let i=0;i<t.length;i+=1){const s=t.get(i);for(let o=0;o<s.unicodes.length;o+=1)if(s.unicodes[o]===e)return i}return null};function za(n){this.cmap=n}za.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function Bi(n,e){this.encoding=n,this.charset=e}Bi.prototype.charToGlyphIndex=function(n){const e=n.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function Ws(n){switch(n.version){case 1:this.names=Ft.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let e=0;e<n.numberOfGlyphs;e++)n.glyphNameIndex[e]<Ft.length?this.names[e]=Ft[n.glyphNameIndex[e]]:this.names[e]=n.names[n.glyphNameIndex[e]-Ft.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let e=0;e<n.numberOfGlyphs;e++)this.names[e]=Ft[e+n.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}Ws.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},Ws.prototype.glyphIndexToName=function(n){return this.names[n]};function mm(n){let e;const t=n.tables.cmap.glyphIndexMap,i=Object.keys(t);for(let s=0;s<i.length;s+=1){const o=i[s],r=t[o];e=n.glyphs.get(r),e.addUnicode(parseInt(o))}for(let s=0;s<n.glyphs.length;s+=1)e=n.glyphs.get(s),n.cffEncoding?n.isCIDFont?e.name="gid"+s:e.name=n.cffEncoding.charset[s]:n.glyphNames.names&&(e.name=n.glyphNames.glyphIndexToName(s))}function Am(n,e,t,i,s){n.beginPath(),n.moveTo(e,t),n.lineTo(i,s),n.stroke()}const Rt={line:Am};function ym(n,e){let t=e||new be;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(i){t=i}}}function He(n){this.bindConstructorValues(n)}He.prototype.bindConstructorValues=function(n){this.index=n.index||0,this.name=n.name||null,this.unicode=n.unicode||void 0,this.unicodes=n.unicodes||n.unicode!==void 0?[n.unicode]:[],n.xMin&&(this.xMin=n.xMin),n.yMin&&(this.yMin=n.yMin),n.xMax&&(this.xMax=n.xMax),n.yMax&&(this.yMax=n.yMax),n.advanceWidth&&(this.advanceWidth=n.advanceWidth),Object.defineProperty(this,"path",ym(this,n.path))},He.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},He.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},He.prototype.getPath=function(n,e,t,i,s){n=n!==void 0?n:0,e=e!==void 0?e:0,t=t!==void 0?t:72;let o,r;i||(i={});let l=i.xScale,a=i.yScale;if(i.hinting&&s&&s.hinting&&(r=this.path&&s.hinting.exec(this,t)),r)o=s.hinting.getCommands(r),n=Math.round(n),e=Math.round(e),l=a=1;else{o=this.path.commands;const u=1/this.path.unitsPerEm*t;l===void 0&&(l=u),a===void 0&&(a=u)}const c=new be;for(let u=0;u<o.length;u+=1){const h=o[u];h.type==="M"?c.moveTo(n+h.x*l,e+-h.y*a):h.type==="L"?c.lineTo(n+h.x*l,e+-h.y*a):h.type==="Q"?c.quadraticCurveTo(n+h.x1*l,e+-h.y1*a,n+h.x*l,e+-h.y*a):h.type==="C"?c.curveTo(n+h.x1*l,e+-h.y1*a,n+h.x2*l,e+-h.y2*a,n+h.x*l,e+-h.y*a):h.type==="Z"&&c.closePath()}return c},He.prototype.getContours=function(){if(this.points===void 0)return[];const n=[];let e=[];for(let t=0;t<this.points.length;t+=1){const i=this.points[t];e.push(i),i.lastPointOfContour&&(n.push(e),e=[])}return ie.argument(e.length===0,"There are still points left in the current contour."),n},He.prototype.getMetrics=function(){const n=this.path.commands,e=[],t=[];for(let s=0;s<n.length;s+=1){const o=n[s];o.type!=="Z"&&(e.push(o.x),t.push(o.y)),(o.type==="Q"||o.type==="C")&&(e.push(o.x1),t.push(o.y1)),o.type==="C"&&(e.push(o.x2),t.push(o.y2))}const i={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(i.xMin)||(i.xMin=0),isFinite(i.xMax)||(i.xMax=this.advanceWidth),isFinite(i.yMin)||(i.yMin=0),isFinite(i.yMax)||(i.yMax=0),i.rightSideBearing=this.advanceWidth-i.leftSideBearing-(i.xMax-i.xMin),i},He.prototype.draw=function(n,e,t,i,s){this.getPath(e,t,i,s).draw(n)},He.prototype.drawPoints=function(n,e,t,i){function s(c,u,h,f){const p=Math.PI*2;n.beginPath();for(let A=0;A<c.length;A+=1)n.moveTo(u+c[A].x*f,h+c[A].y*f),n.arc(u+c[A].x*f,h+c[A].y*f,2,0,p,!1);n.closePath(),n.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24;const o=1/this.path.unitsPerEm*i,r=[],l=[],a=this.path;for(let c=0;c<a.commands.length;c+=1){const u=a.commands[c];u.x!==void 0&&r.push({x:u.x,y:-u.y}),u.x1!==void 0&&l.push({x:u.x1,y:-u.y1}),u.x2!==void 0&&l.push({x:u.x2,y:-u.y2})}n.fillStyle="blue",s(r,e,t,o),n.fillStyle="red",s(l,e,t,o)},He.prototype.drawMetrics=function(n,e,t,i){let s;e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:24,s=1/this.path.unitsPerEm*i,n.lineWidth=1,n.strokeStyle="black",Rt.line(n,e,-1e4,e,1e4),Rt.line(n,-1e4,t,1e4,t);const o=this.xMin||0;let r=this.yMin||0;const l=this.xMax||0;let a=this.yMax||0;const c=this.advanceWidth||0;n.strokeStyle="blue",Rt.line(n,e+o*s,-1e4,e+o*s,1e4),Rt.line(n,e+l*s,-1e4,e+l*s,1e4),Rt.line(n,-1e4,t+-r*s,1e4,t+-r*s),Rt.line(n,-1e4,t+-a*s,1e4,t+-a*s),n.strokeStyle="green",Rt.line(n,e+c*s,-1e4,e+c*s,1e4)};function Si(n,e,t){Object.defineProperty(n,e,{get:function(){return n.path,n[t]},set:function(i){n[t]=i},enumerable:!0,configurable:!0})}function zs(n,e){if(this.font=n,this.glyphs={},Array.isArray(e))for(let t=0;t<e.length;t++)this.glyphs[t]=e[t];this.length=e&&e.length||0}zs.prototype.get=function(n){return typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]()),this.glyphs[n]},zs.prototype.push=function(n,e){this.glyphs[n]=e,this.length++};function Cm(n,e){return new He({index:e,font:n})}function Em(n,e,t,i,s,o){return function(){const r=new He({index:e,font:n});return r.path=function(){t(r,i,s);const l=o(n.glyphs,r);return l.unitsPerEm=n.unitsPerEm,l},Si(r,"xMin","_xMin"),Si(r,"xMax","_xMax"),Si(r,"yMin","_yMin"),Si(r,"yMax","_yMax"),r}}function wm(n,e,t,i){return function(){const s=new He({index:e,font:n});return s.path=function(){const o=t(n,s,i);return o.unitsPerEm=n.unitsPerEm,o},s}}const on={GlyphSet:zs,glyphLoader:Cm,ttfGlyphLoader:Em,cffGlyphLoader:wm};function ja(n,e){if(n===e)return!0;if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t+=1)if(!ja(n[t],e[t]))return!1;return!0}else return!1}function js(n){let e;return n.length<1240?e=107:n.length<33900?e=1131:e=32768,e}function Ct(n,e,t){const i=[],s=[],o=q.getCard16(n,e);let r,l;if(o!==0){const a=q.getByte(n,e+2);r=e+(o+1)*a+2;let c=e+3;for(let u=0;u<o+1;u+=1)i.push(q.getOffset(n,c,a)),c+=a;l=r+i[o]}else l=e+2;for(let a=0;a<i.length-1;a+=1){let c=q.getBytes(n,r+i[a],r+i[a+1]);t&&(c=t(c)),s.push(c)}return{objects:s,startOffset:e,endOffset:l}}function bm(n){let e="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=n.parseByte(),o=s>>4,r=s&15;if(o===15||(e+=i[o],r===15))break;e+=i[r]}return parseFloat(e)}function vm(n,e){let t,i,s,o;if(e===28)return t=n.parseByte(),i=n.parseByte(),t<<8|i;if(e===29)return t=n.parseByte(),i=n.parseByte(),s=n.parseByte(),o=n.parseByte(),t<<24|i<<16|s<<8|o;if(e===30)return bm(n);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=n.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=n.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function Im(n){const e={};for(let t=0;t<n.length;t+=1){const i=n[t][0],s=n[t][1];let o;if(s.length===1?o=s[0]:o=s,e.hasOwnProperty(i)&&!isNaN(e[i]))throw new Error("Object "+e+" already has key "+i);e[i]=o}return e}function $a(n,e,t){e=e!==void 0?e:0;const i=new q.Parser(n,e),s=[];let o=[];for(t=t!==void 0?t:n.length;i.relativeOffset<t;){let r=i.parseByte();r<=21?(r===12&&(r=1200+i.parseByte()),s.push([r,o]),o=[]):o.push(vm(i,r))}return Im(s)}function Tn(n,e){return e<=390?e=xi[e]:e=n[e-391],e}function Ka(n,e,t){const i={};let s;for(let o=0;o<e.length;o+=1){const r=e[o];if(Array.isArray(r.type)){const l=[];l.length=r.type.length;for(let a=0;a<r.type.length;a++)s=n[r.op]!==void 0?n[r.op][a]:void 0,s===void 0&&(s=r.value!==void 0&&r.value[a]!==void 0?r.value[a]:null),r.type[a]==="SID"&&(s=Tn(t,s)),l[a]=s;i[r.name]=l}else s=n[r.op],s===void 0&&(s=r.value!==void 0?r.value:null),r.type==="SID"&&(s=Tn(t,s)),i[r.name]=s}return i}function xm(n,e){const t={};return t.formatMajor=q.getCard8(n,e),t.formatMinor=q.getCard8(n,e+1),t.size=q.getCard8(n,e+2),t.offsetSize=q.getCard8(n,e+3),t.startOffset=e,t.endOffset=e+4,t}const Xa=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],qa=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Bm(n,e){const t=$a(n,0,n.byteLength);return Ka(t,Xa,e)}function Ja(n,e,t,i){const s=$a(n,e,t);return Ka(s,qa,i)}function Za(n,e,t,i){const s=[];for(let o=0;o<t.length;o+=1){const r=new DataView(new Uint8Array(t[o]).buffer),l=Bm(r,i);l._subrs=[],l._subrsBias=0;const a=l.private[0],c=l.private[1];if(a!==0&&c!==0){const u=Ja(n,c+e,a,i);if(l._defaultWidthX=u.defaultWidthX,l._nominalWidthX=u.nominalWidthX,u.subrs!==0){const h=c+u.subrs,f=Ct(n,h+e);l._subrs=f.objects,l._subrsBias=js(l._subrs)}l._privateDict=u}s.push(l)}return s}function Sm(n,e,t,i){let s,o;const r=new q.Parser(n,e);t-=1;const l=[".notdef"],a=r.parseCard8();if(a===0)for(let c=0;c<t;c+=1)s=r.parseSID(),l.push(Tn(i,s));else if(a===1)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard8();for(let c=0;c<=o;c+=1)l.push(Tn(i,s)),s+=1}else if(a===2)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard16();for(let c=0;c<=o;c+=1)l.push(Tn(i,s)),s+=1}else throw new Error("Unknown charset format "+a);return l}function Mm(n,e,t){let i;const s={},o=new q.Parser(n,e),r=o.parseCard8();if(r===0){const l=o.parseCard8();for(let a=0;a<l;a+=1)i=o.parseCard8(),s[i]=a}else if(r===1){const l=o.parseCard8();i=1;for(let a=0;a<l;a+=1){const c=o.parseCard8(),u=o.parseCard8();for(let h=c;h<=c+u;h+=1)s[h]=i,i+=1}}else throw new Error("Unknown encoding format "+r);return new Bi(s,t)}function Tm(n,e,t){let i,s,o,r;const l=new be,a=[];let c=0,u=!1,h=!1,f=0,p=0,A,C,m,y;if(n.isCIDFont){const S=n.tables.cff.topDict._fdSelect[e.index],x=n.tables.cff.topDict._fdArray[S];A=x._subrs,C=x._subrsBias,m=x._defaultWidthX,y=x._nominalWidthX}else A=n.tables.cff.topDict._subrs,C=n.tables.cff.topDict._subrsBias,m=n.tables.cff.topDict._defaultWidthX,y=n.tables.cff.topDict._nominalWidthX;let E=m;function I(S,x){h&&l.closePath(),l.moveTo(S,x),h=!0}function M(){let S;S=a.length%2!==0,S&&!u&&(E=a.shift()+y),c+=a.length>>1,a.length=0,u=!0}function k(S){let x,g,F,D,P,L,G,N,b,w,v,B,R=0;for(;R<S.length;){let U=S[R];switch(R+=1,U){case 1:M();break;case 3:M();break;case 4:a.length>1&&!u&&(E=a.shift()+y,u=!0),p+=a.pop(),I(f,p);break;case 5:for(;a.length>0;)f+=a.shift(),p+=a.shift(),l.lineTo(f,p);break;case 6:for(;a.length>0&&(f+=a.shift(),l.lineTo(f,p),a.length!==0);)p+=a.shift(),l.lineTo(f,p);break;case 7:for(;a.length>0&&(p+=a.shift(),l.lineTo(f,p),a.length!==0);)f+=a.shift(),l.lineTo(f,p);break;case 8:for(;a.length>0;)i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 10:P=a.pop()+C,L=A[P],L&&k(L);break;case 11:return;case 12:switch(U=S[R],R+=1,U){case 35:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),N=r+a.shift(),b=G+a.shift(),w=N+a.shift(),v=b+a.shift(),B=w+a.shift(),f=v+a.shift(),p=B+a.shift(),a.shift(),l.curveTo(i,s,o,r,G,N),l.curveTo(b,w,v,B,f,p);break;case 34:i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),N=r,b=G+a.shift(),w=r,v=b+a.shift(),B=p,f=v+a.shift(),l.curveTo(i,s,o,r,G,N),l.curveTo(b,w,v,B,f,p);break;case 36:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),N=r,b=G+a.shift(),w=r,v=b+a.shift(),B=w+a.shift(),f=v+a.shift(),l.curveTo(i,s,o,r,G,N),l.curveTo(b,w,v,B,f,p);break;case 37:i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),G=o+a.shift(),N=r+a.shift(),b=G+a.shift(),w=N+a.shift(),v=b+a.shift(),B=w+a.shift(),Math.abs(v-f)>Math.abs(B-p)?f=v+a.shift():p=B+a.shift(),l.curveTo(i,s,o,r,G,N),l.curveTo(b,w,v,B,f,p);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+U),a.length=0}break;case 14:a.length>0&&!u&&(E=a.shift()+y,u=!0),h&&(l.closePath(),h=!1);break;case 18:M();break;case 19:case 20:M(),R+=c+7>>3;break;case 21:a.length>2&&!u&&(E=a.shift()+y,u=!0),p+=a.pop(),f+=a.pop(),I(f,p);break;case 22:a.length>1&&!u&&(E=a.shift()+y,u=!0),f+=a.pop(),I(f,p);break;case 23:M();break;case 24:for(;a.length>2;)i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);f+=a.shift(),p+=a.shift(),l.lineTo(f,p);break;case 25:for(;a.length>6;)f+=a.shift(),p+=a.shift(),l.lineTo(f,p);i=f+a.shift(),s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 26:for(a.length%2&&(f+=a.shift());a.length>0;)i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o,p=r+a.shift(),l.curveTo(i,s,o,r,f,p);break;case 27:for(a.length%2&&(p+=a.shift());a.length>0;)i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r,l.curveTo(i,s,o,r,f,p);break;case 28:x=S[R],g=S[R+1],a.push((x<<24|g<<16)>>16),R+=2;break;case 29:P=a.pop()+n.gsubrsBias,L=n.gsubrs[P],L&&k(L);break;case 30:for(;a.length>0&&(i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p),a.length!==0);)i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),p=r+a.shift(),f=o+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p);break;case 31:for(;a.length>0&&(i=f+a.shift(),s=p,o=i+a.shift(),r=s+a.shift(),p=r+a.shift(),f=o+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p),a.length!==0);)i=f,s=p+a.shift(),o=i+a.shift(),r=s+a.shift(),f=o+a.shift(),p=r+(a.length===1?a.shift():0),l.curveTo(i,s,o,r,f,p);break;default:U<32?console.log("Glyph "+e.index+": unknown operator "+U):U<247?a.push(U-139):U<251?(x=S[R],R+=1,a.push((U-247)*256+x+108)):U<255?(x=S[R],R+=1,a.push(-(U-251)*256-x-108)):(x=S[R],g=S[R+1],F=S[R+2],D=S[R+3],R+=4,a.push((x<<24|g<<16|F<<8|D)/65536))}}}return k(t),e.advanceWidth=E,l}function Dm(n,e,t,i){const s=[];let o;const r=new q.Parser(n,e),l=r.parseCard8();if(l===0)for(let a=0;a<t;a++){if(o=r.parseCard8(),o>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");s.push(o)}else if(l===3){const a=r.parseCard16();let c=r.parseCard16();if(c!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+c);let u;for(let h=0;h<a;h++){if(o=r.parseCard8(),u=r.parseCard16(),o>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");if(u>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+u);for(;c<u;c++)s.push(o);c=u}if(u!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+u)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+l);return s}function km(n,e,t){t.tables.cff={};const i=xm(n,e),s=Ct(n,i.endOffset,q.bytesToString),o=Ct(n,s.endOffset),r=Ct(n,o.endOffset,q.bytesToString),l=Ct(n,r.endOffset);t.gsubrs=l.objects,t.gsubrsBias=js(t.gsubrs);const a=Za(n,e,o.objects,r.objects);if(a.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+a.length);const c=a[0];if(t.tables.cff.topDict=c,c._privateDict&&(t.defaultWidthX=c._privateDict.defaultWidthX,t.nominalWidthX=c._privateDict.nominalWidthX),c.ros[0]!==void 0&&c.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){let A=c.fdArray,C=c.fdSelect;if(A===0||C===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");A+=e;const m=Ct(n,A),y=Za(n,e,m.objects,r.objects);c._fdArray=y,C+=e,c._fdSelect=Dm(n,C,t.numGlyphs,y.length)}const u=e+c.private[1],h=Ja(n,u,c.private[0],r.objects);if(t.defaultWidthX=h.defaultWidthX,t.nominalWidthX=h.nominalWidthX,h.subrs!==0){const A=u+h.subrs,C=Ct(n,A);t.subrs=C.objects,t.subrsBias=js(t.subrs)}else t.subrs=[],t.subrsBias=0;const f=Ct(n,e+c.charStrings);t.nGlyphs=f.objects.length;const p=Sm(n,e+c.charset,t.nGlyphs,r.objects);c.encoding===0?t.cffEncoding=new Bi(pm,p):c.encoding===1?t.cffEncoding=new Bi(gm,p):t.cffEncoding=Mm(n,e+c.encoding,p),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new on.GlyphSet(t);for(let A=0;A<t.nGlyphs;A+=1){const C=f.objects[A];t.glyphs.push(A,on.cffGlyphLoader(t,A,Tm,C))}}function el(n,e){let t,i=xi.indexOf(n);return i>=0&&(t=i),i=e.indexOf(n),i>=0?t=i+xi.length:(t=xi.length+e.length,e.push(n)),t}function Pm(){return new Z.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Fm(n){const e=new Z.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(let t=0;t<n.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:n[t]});return e}function tl(n,e,t){const i={};for(let s=0;s<n.length;s+=1){const o=n[s];let r=e[o.name];r!==void 0&&!ja(r,o.value)&&(o.type==="SID"&&(r=el(r,t)),i[o.op]={name:o.name,type:o.type,value:r})}return i}function nl(n,e){const t=new Z.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=tl(Xa,n,e),t}function il(n){const e=new Z.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],e}function Rm(n){const e=new Z.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(let t=0;t<n.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:n[t]});return e}function Om(){return new Z.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Lm(n,e){const t=new Z.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let i=0;i<n.length;i+=1){const s=n[i],o=el(s,e);t.fields.push({name:"glyph_"+i,type:"SID",value:o})}return t}function Nm(n){const e=[],t=n.path;e.push({name:"width",type:"NUMBER",value:n.advanceWidth});let i=0,s=0;for(let o=0;o<t.commands.length;o+=1){let r,l,a=t.commands[o];if(a.type==="Q"){const c=.3333333333333333,u=2/3;a={type:"C",x:a.x,y:a.y,x1:c*i+u*a.x1,y1:c*s+u*a.y1,x2:c*a.x+u*a.x1,y2:c*a.y+u*a.y1}}if(a.type==="M")r=Math.round(a.x-i),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rmoveto",type:"OP",value:21}),i=Math.round(a.x),s=Math.round(a.y);else if(a.type==="L")r=Math.round(a.x-i),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rlineto",type:"OP",value:5}),i=Math.round(a.x),s=Math.round(a.y);else if(a.type==="C"){const c=Math.round(a.x1-i),u=Math.round(a.y1-s),h=Math.round(a.x2-a.x1),f=Math.round(a.y2-a.y1);r=Math.round(a.x-a.x2),l=Math.round(a.y-a.y2),e.push({name:"dx1",type:"NUMBER",value:c}),e.push({name:"dy1",type:"NUMBER",value:u}),e.push({name:"dx2",type:"NUMBER",value:h}),e.push({name:"dy2",type:"NUMBER",value:f}),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rrcurveto",type:"OP",value:8}),i=Math.round(a.x),s=Math.round(a.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function Um(n){const e=new Z.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let t=0;t<n.length;t+=1){const i=n.get(t),s=Nm(i);e.charStrings.push({name:i.name,type:"CHARSTRING",value:s})}return e}function _m(n,e){const t=new Z.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=tl(qa,n,e),t}function Qm(n,e){const t=new Z.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),i=1/e.unitsPerEm,s={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[i,0,0,i,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},o={},r=[];let l;for(let h=1;h<n.length;h+=1)l=n.get(h),r.push(l.name);const a=[];t.header=Pm(),t.nameIndex=Fm([e.postScriptName]);let c=nl(s,a);t.topDictIndex=il(c),t.globalSubrIndex=Om(),t.charsets=Lm(r,a),t.charStringsIndex=Um(n),t.privateDict=_m(o,a),t.stringIndex=Rm(a);const u=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return s.charset=u,s.encoding=0,s.charStrings=s.charset+t.charsets.sizeOf(),s.private[1]=s.charStrings+t.charStringsIndex.sizeOf(),c=nl(s,a),t.topDictIndex=il(c),t}const sl={parse:km,make:Qm};function Hm(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.fontRevision=Math.round(i.parseFixed()*1e3)/1e3,t.checkSumAdjustment=i.parseULong(),t.magicNumber=i.parseULong(),ie.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=i.parseUShort(),t.unitsPerEm=i.parseUShort(),t.created=i.parseLongDateTime(),t.modified=i.parseLongDateTime(),t.xMin=i.parseShort(),t.yMin=i.parseShort(),t.xMax=i.parseShort(),t.yMax=i.parseShort(),t.macStyle=i.parseUShort(),t.lowestRecPPEM=i.parseUShort(),t.fontDirectionHint=i.parseShort(),t.indexToLocFormat=i.parseShort(),t.glyphDataFormat=i.parseShort(),t}function Gm(n){const e=Math.round(new Date().getTime()/1e3)+2082844800;let t=e;return n.createdTimestamp&&(t=n.createdTimestamp+2082844800),new Z.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],n)}const ol={parse:Hm,make:Gm};function Ym(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.ascender=i.parseShort(),t.descender=i.parseShort(),t.lineGap=i.parseShort(),t.advanceWidthMax=i.parseUShort(),t.minLeftSideBearing=i.parseShort(),t.minRightSideBearing=i.parseShort(),t.xMaxExtent=i.parseShort(),t.caretSlopeRise=i.parseShort(),t.caretSlopeRun=i.parseShort(),t.caretOffset=i.parseShort(),i.relativeOffset+=8,t.metricDataFormat=i.parseShort(),t.numberOfHMetrics=i.parseUShort(),t}function Vm(n){return new Z.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],n)}const rl={parse:Ym,make:Vm};function Wm(n,e,t,i,s){let o,r;const l=new q.Parser(n,e);for(let a=0;a<i;a+=1){a<t&&(o=l.parseUShort(),r=l.parseShort());const c=s.get(a);c.advanceWidth=o,c.leftSideBearing=r}}function zm(n){const e=new Z.Table("hmtx",[]);for(let t=0;t<n.length;t+=1){const i=n.get(t),s=i.advanceWidth||0,o=i.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:s}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:o})}return e}const al={parse:Wm,make:zm};function jm(n){const e=new Z.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:n.length}]);let t="";const i=12+n.length*4;for(let s=0;s<n.length;++s){let o=t.indexOf(n[s]);o<0&&(o=t.length,t+=n[s]),e.fields.push({name:"offset "+s,type:"USHORT",value:i+o}),e.fields.push({name:"length "+s,type:"USHORT",value:n[s].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function $m(n,e){const t=new q.Parser(n,e),i=t.parseULong();ie.argument(i===1,"Unsupported ltag table version."),t.skip("uLong",1);const s=t.parseULong(),o=[];for(let r=0;r<s;r++){let l="";const a=e+t.parseUShort(),c=t.parseUShort();for(let u=a;u<a+c;++u)l+=String.fromCharCode(n.getInt8(u));o.push(l)}return o}const ll={make:jm,parse:$m};function Km(n,e){const t={},i=new q.Parser(n,e);return t.version=i.parseVersion(),t.numGlyphs=i.parseUShort(),t.version===1&&(t.maxPoints=i.parseUShort(),t.maxContours=i.parseUShort(),t.maxCompositePoints=i.parseUShort(),t.maxCompositeContours=i.parseUShort(),t.maxZones=i.parseUShort(),t.maxTwilightPoints=i.parseUShort(),t.maxStorage=i.parseUShort(),t.maxFunctionDefs=i.parseUShort(),t.maxInstructionDefs=i.parseUShort(),t.maxStackElements=i.parseUShort(),t.maxSizeOfInstructions=i.parseUShort(),t.maxComponentElements=i.parseUShort(),t.maxComponentDepth=i.parseUShort()),t}function Xm(n){return new Z.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}const cl={parse:Km,make:Xm},dl=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ul={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},qm={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},hl={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Jm(n,e,t){switch(n){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return ul[e];case 3:return hl[e]}}const $s="utf-16",Zm={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},eA={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function fl(n,e,t){switch(n){case 0:return $s;case 1:return eA[t]||Zm[e];case 3:if(e===1||e===10)return $s;break}}function tA(n,e,t){const i={},s=new q.Parser(n,e),o=s.parseUShort(),r=s.parseUShort(),l=s.offset+s.parseUShort();for(let a=0;a<r;a++){const c=s.parseUShort(),u=s.parseUShort(),h=s.parseUShort(),f=s.parseUShort(),p=dl[f]||f,A=s.parseUShort(),C=s.parseUShort(),m=Jm(c,h,t),y=fl(c,u,h);if(y!==void 0&&m!==void 0){let E;if(y===$s?E=sn.UTF16(n,l+C,A):E=sn.MACSTRING(n,l+C,A,y),E){let I=i[p];I===void 0&&(I=i[p]={}),I[m]=E}}}return o===1&&s.parseUShort(),i}function Ks(n){const e={};for(let t in n)e[n[t]]=parseInt(t);return e}function pl(n,e,t,i,s,o){return new Z.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:i},{name:"length",type:"USHORT",value:s},{name:"offset",type:"USHORT",value:o}])}function nA(n,e){const t=n.length,i=e.length-t+1;e:for(let s=0;s<i;s++)for(;s<i;s++){for(let o=0;o<t;o++)if(e[s+o]!==n[o])continue e;return s}return-1}function gl(n,e){let t=nA(n,e);if(t<0){t=e.length;let i=0;const s=n.length;for(;i<s;++i)e.push(n[i])}return t}function iA(n,e){let t;const i=[],s={},o=Ks(dl);for(let h in n){let f=o[h];if(f===void 0&&(f=h),t=parseInt(f),isNaN(t))throw new Error('Name table entry "'+h+'" does not exist, see nameTableNames for complete list.');s[t]=n[h],i.push(t)}const r=Ks(ul),l=Ks(hl),a=[],c=[];for(let h=0;h<i.length;h++){t=i[h];const f=s[t];for(let p in f){const A=f[p];let C=1,m=r[p],y=qm[m];const E=fl(C,y,m);let I=z.MACSTRING(A,E);I===void 0&&(C=0,m=e.indexOf(p),m<0&&(m=e.length,e.push(p)),y=4,I=z.UTF16(A));const M=gl(I,c);a.push(pl(C,y,m,t,I.length,M));const k=l[p];if(k!==void 0){const S=z.UTF16(A),x=gl(S,c);a.push(pl(3,1,k,t,S.length,x))}}}a.sort(function(h,f){return h.platformID-f.platformID||h.encodingID-f.encodingID||h.languageID-f.languageID||h.nameID-f.nameID});const u=new Z.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:a.length},{name:"stringOffset",type:"USHORT",value:6+a.length*12}]);for(let h=0;h<a.length;h++)u.fields.push({name:"record_"+h,type:"RECORD",value:a[h]});return u.fields.push({name:"strings",type:"LITERAL",value:c}),u}const ml={parse:tA,make:iA},Xs=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function sA(n){for(let e=0;e<Xs.length;e+=1){const t=Xs[e];if(n>=t.begin&&n<t.end)return e}return-1}function oA(n,e){const t={},i=new q.Parser(n,e);t.version=i.parseUShort(),t.xAvgCharWidth=i.parseShort(),t.usWeightClass=i.parseUShort(),t.usWidthClass=i.parseUShort(),t.fsType=i.parseUShort(),t.ySubscriptXSize=i.parseShort(),t.ySubscriptYSize=i.parseShort(),t.ySubscriptXOffset=i.parseShort(),t.ySubscriptYOffset=i.parseShort(),t.ySuperscriptXSize=i.parseShort(),t.ySuperscriptYSize=i.parseShort(),t.ySuperscriptXOffset=i.parseShort(),t.ySuperscriptYOffset=i.parseShort(),t.yStrikeoutSize=i.parseShort(),t.yStrikeoutPosition=i.parseShort(),t.sFamilyClass=i.parseShort(),t.panose=[];for(let s=0;s<10;s++)t.panose[s]=i.parseByte();return t.ulUnicodeRange1=i.parseULong(),t.ulUnicodeRange2=i.parseULong(),t.ulUnicodeRange3=i.parseULong(),t.ulUnicodeRange4=i.parseULong(),t.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),t.fsSelection=i.parseUShort(),t.usFirstCharIndex=i.parseUShort(),t.usLastCharIndex=i.parseUShort(),t.sTypoAscender=i.parseShort(),t.sTypoDescender=i.parseShort(),t.sTypoLineGap=i.parseShort(),t.usWinAscent=i.parseUShort(),t.usWinDescent=i.parseUShort(),t.version>=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function rA(n){return new Z.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],n)}const qs={parse:oA,make:rA,unicodeRanges:Xs,getUnicodeRange:sA};function aA(n,e){const t={},i=new q.Parser(n,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=Ft.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.glyphNameIndex[s]=i.parseUShort();t.names=[];for(let s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=Ft.length){const o=i.parseChar();t.names.push(i.parseString(o))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.offset[s]=i.parseChar();break}return t}function lA(){return new Z.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}const Al={parse:aA,make:lA},Ye=new Array(9);Ye[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),substitute:this.parseOffset16List()};ie.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},Ye[2]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),sequences:this.parseListOfLists()}},Ye[3]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),alternateSets:this.parseListOfLists()}},Ye[4]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};const rn={sequenceIndex:H.uShort,lookupListIndex:H.uShort};Ye[5]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(H.coverage),ruleSets:this.parseListOfLists(function(){const i=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,rn)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(H.coverage),classDef:this.parsePointer(H.classDef),classSets:this.parseListOfLists(function(){const i=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,rn)}})};if(t===3){const i=this.parseUShort(),s=this.parseUShort();return{substFormat:t,coverages:this.parseList(i,H.pointer(H.coverage)),lookupRecords:this.parseRecordList(s,rn)}}ie.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Ye[6]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(rn)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),backtrackClassDef:this.parsePointer(H.classDef),inputClassDef:this.parsePointer(H.classDef),lookaheadClassDef:this.parsePointer(H.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(rn)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(H.pointer(H.coverage)),inputCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),lookupRecords:this.parseRecordList(rn)};ie.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Ye[7]=function(){const e=this.parseUShort();ie.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");const t=this.parseUShort(),i=new H(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:Ye[t].call(i)}},Ye[8]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),backtrackCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),substitutes:this.parseUShortList()}};function cA(n,e){e=e||0;const t=new H(n,e),i=t.parseVersion(1);return ie.argument(i===1||i===1.1,"Unsupported GSUB table version."),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ye)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ye),variations:t.parseFeatureVariationsList()}}const Mi=new Array(9);Mi[1]=function(e){return e.substFormat===1?new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.ushortList("substitute",e.substitute)))},Mi[3]=function(e){return ie.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.tableList("altSet",e.alternateSets,function(t){return new Z.Table("alternateSetTable",Z.ushortList("alternate",t))})))},Mi[4]=function(e){return ie.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(e.coverage)}].concat(Z.tableList("ligSet",e.ligatureSets,function(t){return new Z.Table("ligatureSetTable",Z.tableList("ligature",t,function(i){return new Z.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:i.ligGlyph}].concat(Z.ushortList("component",i.components,i.components.length+1)))}))})))};function dA(n){return new Z.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(n.lookups,Mi)}])}const yl={parse:cA,make:dA};function uA(n,e){const t=new q.Parser(n,e),i=t.parseULong();ie.argument(i===1,"Unsupported META table version."),t.parseULong(),t.parseULong();const s=t.parseULong(),o={};for(let r=0;r<s;r++){const l=t.parseTag(),a=t.parseULong(),c=t.parseULong(),u=sn.UTF8(n,e+a,c);o[l]=u}return o}function hA(n){const e=Object.keys(n).length;let t="";const i=16+e*12,s=new Z.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:i},{name:"numTags",type:"ULONG",value:e}]);for(let o in n){const r=t.length;t+=n[o],s.fields.push({name:"tag "+o,type:"TAG",value:o}),s.fields.push({name:"offset "+o,type:"ULONG",value:i+r}),s.fields.push({name:"length "+o,type:"ULONG",value:n[o].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),s}const Cl={parse:uA,make:hA};function El(n){return Math.log(n)/Math.log(2)|0}function Js(n){for(;n.length%4!==0;)n.push(0);let e=0;for(let t=0;t<n.length;t+=4)e+=(n[t]<<24)+(n[t+1]<<16)+(n[t+2]<<8)+n[t+3];return e%=Math.pow(2,32),e}function wl(n,e,t,i){return new Z.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:i!==void 0?i:0}])}function bl(n){const e=new Z.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=n,e.numTables=n.length;const t=Math.pow(2,El(e.numTables));e.searchRange=16*t,e.entrySelector=El(t),e.rangeShift=e.numTables*16-e.searchRange;const i=[],s=[];let o=e.sizeOf()+wl().sizeOf()*e.numTables;for(;o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0});for(let r=0;r<n.length;r+=1){const l=n[r];ie.argument(l.tableName.length===4,"Table name"+l.tableName+" is invalid.");const a=l.sizeOf(),c=wl(l.tableName,Js(l.encode()),o,a);for(i.push({name:c.tag+" Table Record",type:"RECORD",value:c}),s.push({name:l.tableName+" table",type:"RECORD",value:l}),o+=a,ie.argument(!isNaN(o),"Something went wrong calculating the offset.");o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0})}return i.sort(function(r,l){return r.value.tag>l.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(s),e}function vl(n,e,t){for(let i=0;i<e.length;i+=1){const s=n.charToGlyphIndex(e[i]);if(s>0)return n.glyphs.get(s).getMetrics()}return t}function fA(n){let e=0;for(let t=0;t<n.length;t+=1)e+=n[t];return e/n.length}function pA(n){const e=[],t=[],i=[],s=[],o=[],r=[],l=[];let a,c=0,u=0,h=0,f=0,p=0;for(let T=0;T<n.glyphs.length;T+=1){const Q=n.glyphs.get(T),V=Q.unicode|0;if(isNaN(Q.advanceWidth))throw new Error("Glyph "+Q.name+" ("+T+"): advanceWidth is not a number.");(a>V||a===void 0)&&V>0&&(a=V),c<V&&(c=V);const $=qs.getUnicodeRange(V);if($<32)u|=1<<$;else if($<64)h|=1<<$-32;else if($<96)f|=1<<$-64;else if($<123)p|=1<<$-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Q.name===".notdef")continue;const J=Q.getMetrics();e.push(J.xMin),t.push(J.yMin),i.push(J.xMax),s.push(J.yMax),r.push(J.leftSideBearing),l.push(J.rightSideBearing),o.push(Q.advanceWidth)}const A={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:fA(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,l)};A.ascender=n.ascender,A.descender=n.descender;const C=ol.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:A.xMin,yMin:A.yMin,xMax:A.xMax,yMax:A.yMax,lowestRecPPEM:3,createdTimestamp:n.createdTimestamp}),m=rl.make({ascender:A.ascender,descender:A.descender,advanceWidthMax:A.advanceWidthMax,minLeftSideBearing:A.minLeftSideBearing,minRightSideBearing:A.minRightSideBearing,xMaxExtent:A.maxLeftSideBearing+(A.xMax-A.xMin),numberOfHMetrics:n.glyphs.length}),y=cl.make(n.glyphs.length),E=qs.make({xAvgCharWidth:Math.round(A.advanceWidthAvg),usWeightClass:n.tables.os2.usWeightClass,usWidthClass:n.tables.os2.usWidthClass,usFirstCharIndex:a,usLastCharIndex:c,ulUnicodeRange1:u,ulUnicodeRange2:h,ulUnicodeRange3:f,ulUnicodeRange4:p,fsSelection:n.tables.os2.fsSelection,sTypoAscender:A.ascender,sTypoDescender:A.descender,sTypoLineGap:0,usWinAscent:A.yMax,usWinDescent:Math.abs(A.yMin),ulCodePageRange1:1,sxHeight:vl(n,"xyvw",{yMax:Math.round(A.ascender/2)}).yMax,sCapHeight:vl(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",A).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0}),I=al.make(n.glyphs),M=Va.make(n.glyphs),k=n.getEnglishName("fontFamily"),S=n.getEnglishName("fontSubfamily"),x=k+" "+S;let g=n.getEnglishName("postScriptName");g||(g=k.replace(/\s/g,"")+"-"+S);const F={};for(let T in n.names)F[T]=n.names[T];F.uniqueID||(F.uniqueID={en:n.getEnglishName("manufacturer")+":"+x}),F.postScriptName||(F.postScriptName={en:g}),F.preferredFamily||(F.preferredFamily=n.names.fontFamily),F.preferredSubfamily||(F.preferredSubfamily=n.names.fontSubfamily);const D=[],P=ml.make(F,D),L=D.length>0?ll.make(D):void 0,G=Al.make(),N=sl.make(n.glyphs,{version:n.getEnglishName("version"),fullName:x,familyName:k,weightName:S,postScriptName:g,unitsPerEm:n.unitsPerEm,fontBBox:[0,A.yMin,A.ascender,A.advanceWidthMax]}),b=n.metas&&Object.keys(n.metas).length>0?Cl.make(n.metas):void 0,w=[C,m,y,E,P,M,G,N,I];L&&w.push(L),n.tables.gsub&&w.push(yl.make(n.tables.gsub)),b&&w.push(b);const v=bl(w),B=v.encode(),R=Js(B),U=v.fields;let O=!1;for(let T=0;T<U.length;T+=1)if(U[T].name==="head table"){U[T].value.checkSumAdjustment=2981146554-R,O=!0;break}if(!O)throw new Error("Could not find head table with checkSum to adjust.");return v}const gA={make:bl,fontToTable:pA,computeCheckSum:Js};function Zs(n,e){let t=0,i=n.length-1;for(;t<=i;){const s=t+i>>>1,o=n[s].tag;if(o===e)return s;o<e?t=s+1:i=s-1}return-t-1}function Il(n,e){let t=0,i=n.length-1;for(;t<=i;){const s=t+i>>>1,o=n[s];if(o===e)return s;o<e?t=s+1:i=s-1}return-t-1}function xl(n,e){let t,i=0,s=n.length-1;for(;i<=s;){const o=i+s>>>1;t=n[o];const r=t.start;if(r===e)return t;r<e?i=o+1:s=o-1}if(i>0)return t=n[i-1],e>t.end?0:t}function Dn(n,e){this.font=n,this.tableName=e}Dn.prototype={searchTag:Zs,binSearch:Il,getTable:function(n){let e=this.font.tables[this.tableName];return!e&&n&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let e=!1;for(let t=0;t<n.scripts.length;t++){const i=n.scripts[t].tag;if(i==="DFLT")return i;i==="latn"&&(e=!0)}if(e)return"latn"},getScriptTable:function(n,e){const t=this.getTable(e);if(t){n=n||"DFLT";const i=t.scripts,s=Zs(t.scripts,n);if(s>=0)return i[s].script;if(e){const o={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-s,0,o),o.script}}},getLangSysTable:function(n,e,t){const i=this.getScriptTable(n,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;const s=Zs(i.langSysRecords,e);if(s>=0)return i.langSysRecords[s].langSys;if(t){const o={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-s,0,o),o.langSys}}},getFeatureTable:function(n,e,t,i){const s=this.getLangSysTable(n,e,i);if(s){let o;const r=s.featureIndexes,l=this.font.tables[this.tableName].features;for(let a=0;a<r.length;a++)if(o=l[r[a]],o.tag===t)return o.feature;if(i){const a=l.length;return ie.assert(a===0||t>=l[a-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},l.push(o),r.push(a),o.feature}}},getLookupTables:function(n,e,t,i,s){const o=this.getFeatureTable(n,e,t,s),r=[];if(o){let l;const a=o.lookupListIndexes,c=this.font.tables[this.tableName].lookups;for(let u=0;u<a.length;u++)l=c[a[u]],l.lookupType===i&&r.push(l);if(r.length===0&&s){l={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};const u=c.length;return c.push(l),a.push(u),[l]}}return r},getGlyphClass:function(n,e){switch(n.format){case 1:return n.startGlyph<=e&&e<n.startGlyph+n.classes.length?n.classes[e-n.startGlyph]:0;case 2:const t=xl(n.ranges,e);return t?t.classId:0}},getCoverageIndex:function(n,e){switch(n.format){case 1:const t=Il(n.glyphs,e);return t>=0?t:-1;case 2:const i=xl(n.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{const e=[],t=n.ranges;for(let i=0;i<t.length;i++){const s=t[i],o=s.start,r=s.end;for(let l=o;l<=r;l++)e.push(l)}return e}}};function kn(n){Dn.call(this,n,"gpos")}kn.prototype=Dn.prototype,kn.prototype.init=function(){const n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},kn.prototype.getKerningValue=function(n,e,t){for(let i=0;i<n.length;i++){const s=n[i].subtables;for(let o=0;o<s.length;o++){const r=s[o],l=this.getCoverageIndex(r.coverage,e);if(!(l<0))switch(r.posFormat){case 1:let a=r.pairSets[l];for(let f=0;f<a.length;f++){let p=a[f];if(p.secondGlyph===t)return p.value1&&p.value1.xAdvance||0}break;case 2:const c=this.getGlyphClass(r.classDef1,e),u=this.getGlyphClass(r.classDef2,t),h=r.classRecords[c][u];return h.value1&&h.value1.xAdvance||0}}}return 0},kn.prototype.getKerningTables=function(n,e){if(this.font.tables.gpos)return this.getLookupTables(n,e,"kern",2)};function Ve(n){Dn.call(this,n,"gsub")}function mA(n,e){const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}function Bl(n,e,t){const i=n.subtables;for(let s=0;s<i.length;s++){const o=i[s];if(o.substFormat===e)return o}if(t)return i.push(t),t}Ve.prototype=Dn.prototype,Ve.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ve.prototype.getSingle=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,1);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage);let u;if(a.substFormat===1){const h=a.deltaGlyphId;for(u=0;u<c.length;u++){const f=c[u];i.push({sub:f,by:f+h})}}else{const h=a.substitute;for(u=0;u<c.length;u++)i.push({sub:c[u],by:h[u]})}}}return i},Ve.prototype.getAlternates=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,3);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage),u=a.alternateSets;for(let h=0;h<c.length;h++)i.push({sub:c[h],by:u[h]})}}return i},Ve.prototype.getLigatures=function(n,e,t){const i=[],s=this.getLookupTables(e,t,n,4);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let l=0;l<r.length;l++){const a=r[l],c=this.expandCoverage(a.coverage),u=a.ligatureSets;for(let h=0;h<c.length;h++){const f=c[h],p=u[h];for(let A=0;A<p.length;A++){const C=p[A];i.push({sub:[f].concat(C.components),by:C.ligGlyph})}}}}return i},Ve.prototype.addSingle=function(n,e,t,i){const s=this.getLookupTables(t,i,n,1,!0)[0],o=Bl(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.substitute.splice(l,0,0)),o.substitute[l]=e.by},Ve.prototype.addAlternate=function(n,e,t,i){const s=this.getLookupTables(t,i,n,3,!0)[0],o=Bl(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.alternateSets.splice(l,0,0)),o.alternateSets[l]=e.by},Ve.prototype.addLigature=function(n,e,t,i){const s=this.getLookupTables(t,i,n,4,!0)[0];let o=s.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=o),ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub[0],l=e.sub.slice(1),a={ligGlyph:e.by,components:l};let c=this.binSearch(o.coverage.glyphs,r);if(c>=0){const u=o.ligatureSets[c];for(let h=0;h<u.length;h++)if(mA(u[h].components,l))return;u.push(a)}else c=-1-c,o.coverage.glyphs.splice(c,0,r),o.ligatureSets.splice(c,0,[a])},Ve.prototype.getFeature=function(n,e,t){if(/ss\d\d/.test(n))return this.getSingle(n,e,t);switch(n){case"aalt":case"salt":return this.getSingle(n,e,t).concat(this.getAlternates(n,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(n,e,t)}},Ve.prototype.add=function(n,e,t,i){if(/ss\d\d/.test(n))return this.addSingle(n,e,t,i);switch(n){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(n,e,t,i):this.addAlternate(n,e,t,i);case"dlig":case"liga":case"rlig":return this.addLigature(n,e,t,i)}};function AA(){return typeof window<"u"}function yA(n){const e=new ArrayBuffer(n.length),t=new Uint8Array(e);for(let i=0;i<n.length;++i)t[i]=n[i];return e}function CA(n){const e=new Buffer(n.byteLength),t=new Uint8Array(n);for(let i=0;i<e.length;++i)e[i]=t[i];return e}function an(n,e){if(!n)throw e}function Sl(n,e,t,i,s){let o;return(e&i)>0?(o=n.parseByte(),(e&s)===0&&(o=-o),o=t+o):(e&s)>0?o=t:o=t+n.parseShort(),o}function EA(n,e,t){const i=new q.Parser(e,t);n.numberOfContours=i.parseShort(),n._xMin=i.parseShort(),n._yMin=i.parseShort(),n._xMax=i.parseShort(),n._yMax=i.parseShort();let s,o;if(n.numberOfContours>0){const r=n.endPointIndices=[];for(let a=0;a<n.numberOfContours;a+=1)r.push(i.parseUShort());n.instructionLength=i.parseUShort(),n.instructions=[];for(let a=0;a<n.instructionLength;a+=1)n.instructions.push(i.parseByte());const l=r[r.length-1]+1;s=[];for(let a=0;a<l;a+=1)if(o=i.parseByte(),s.push(o),(o&8)>0){const c=i.parseByte();for(let u=0;u<c;u+=1)s.push(o),a+=1}if(ie.argument(s.length===l,"Bad flags."),r.length>0){const a=[];let c;if(l>0){for(let f=0;f<l;f+=1)o=s[f],c={},c.onCurve=!!(o&1),c.lastPointOfContour=r.indexOf(f)>=0,a.push(c);let u=0;for(let f=0;f<l;f+=1)o=s[f],c=a[f],c.x=Sl(i,o,u,2,16),u=c.x;let h=0;for(let f=0;f<l;f+=1)o=s[f],c=a[f],c.y=Sl(i,o,h,4,32),h=c.y}n.points=a}else n.points=[]}else if(n.numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];let r=!0;for(;r;){s=i.parseUShort();const l={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(l.dx=i.parseShort(),l.dy=i.parseShort()):l.matchedPoints=[i.parseUShort(),i.parseUShort()]:(s&2)>0?(l.dx=i.parseChar(),l.dy=i.parseChar()):l.matchedPoints=[i.parseByte(),i.parseByte()],(s&8)>0?l.xScale=l.yScale=i.parseF2Dot14():(s&64)>0?(l.xScale=i.parseF2Dot14(),l.yScale=i.parseF2Dot14()):(s&128)>0&&(l.xScale=i.parseF2Dot14(),l.scale01=i.parseF2Dot14(),l.scale10=i.parseF2Dot14(),l.yScale=i.parseF2Dot14()),n.components.push(l),r=!!(s&32)}if(s&256){n.instructionLength=i.parseUShort(),n.instructions=[];for(let l=0;l<n.instructionLength;l+=1)n.instructions.push(i.parseByte())}}}function eo(n,e){const t=[];for(let i=0;i<n.length;i+=1){const s=n[i],o={x:e.xScale*s.x+e.scale01*s.y+e.dx,y:e.scale10*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};t.push(o)}return t}function wA(n){const e=[];let t=[];for(let i=0;i<n.length;i+=1){const s=n[i];t.push(s),s.lastPointOfContour&&(e.push(t),t=[])}return ie.argument(t.length===0,"There are still points left in the current contour."),e}function Ml(n){const e=new be;if(!n)return e;const t=wA(n);for(let i=0;i<t.length;++i){const s=t[i];let o=null,r=s[s.length-1],l=s[0];if(r.onCurve)e.moveTo(r.x,r.y);else if(l.onCurve)e.moveTo(l.x,l.y);else{const a={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5};e.moveTo(a.x,a.y)}for(let a=0;a<s.length;++a)if(o=r,r=l,l=s[(a+1)%s.length],r.onCurve)e.lineTo(r.x,r.y);else{let c=l;o.onCurve||((r.x+o.x)*.5,(r.y+o.y)*.5),l.onCurve||(c={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5}),e.quadraticCurveTo(r.x,r.y,c.x,c.y)}e.closePath()}return e}function bA(n,e){if(e.isComposite)for(let t=0;t<e.components.length;t+=1){const i=e.components[t],s=n.get(i.glyphIndex);if(s.getPath(),s.points){let o;if(i.matchedPoints===void 0)o=eo(s.points,i);else{if(i.matchedPoints[0]>e.points.length-1||i.matchedPoints[1]>s.points.length-1)throw Error("Matched points out of range in "+e.name);const r=e.points[i.matchedPoints[0]];let l=s.points[i.matchedPoints[1]];const a={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};l=eo([l],a)[0],a.dx=r.x-l.x,a.dy=r.y-l.y,o=eo(s.points,a)}e.points=e.points.concat(o)}}return Ml(e.points)}function vA(n,e,t,i){const s=new on.GlyphSet(i);for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];r!==l?s.push(o,on.ttfGlyphLoader(i,o,EA,n,e+r,bA)):s.push(o,on.glyphLoader(i,o))}return s}const Tl={getPath:Ml,parse:vA};let Dl,Ot,kl,to;function Pl(n){this.font=n,this.getCommands=function(e){return Tl.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function IA(n){return n}function Fl(n){return Math.sign(n)*Math.round(Math.abs(n))}function xA(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function BA(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function SA(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function MA(n){return Math.sign(n)*Math.floor(Math.abs(n))}const Rl=function(n){const e=this.srPeriod;let t=this.srPhase;const i=this.srThreshold;let s=1;return n<0&&(n=-n,s=-1),n+=i-t,n=Math.trunc(n/e)*e,n+=t,n<0?t*s:n*s},tt={x:1,y:0,axis:"x",distance:function(n,e,t,i){return(t?n.xo:n.x)-(i?e.xo:e.x)},interpolate:function(n,e,t,i){let s,o,r,l,a,c,u;if(!i||i===this){if(s=n.xo-e.xo,o=n.xo-t.xo,a=e.x-e.xo,c=t.x-t.xo,r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){n.x=n.xo+(a+c)/2;return}n.x=n.xo+(a*l+c*r)/u;return}if(s=i.distance(n,e,!0,!0),o=i.distance(n,t,!0,!0),a=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){tt.setRelative(n,n,(a+c)/2,i,!0);return}tt.setRelative(n,n,(a*l+c*r)/u,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,e,t,i,s){if(!i||i===this){n.x=(s?e.xo:e.x)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y;n.x=l+(n.y-a)/i.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},rt={x:0,y:1,axis:"y",distance:function(n,e,t,i){return(t?n.yo:n.y)-(i?e.yo:e.y)},interpolate:function(n,e,t,i){let s,o,r,l,a,c,u;if(!i||i===this){if(s=n.yo-e.yo,o=n.yo-t.yo,a=e.y-e.yo,c=t.y-t.yo,r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){n.y=n.yo+(a+c)/2;return}n.y=n.yo+(a*l+c*r)/u;return}if(s=i.distance(n,e,!0,!0),o=i.distance(n,t,!0,!0),a=i.distance(e,e,!1,!0),c=i.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),u=r+l,u===0){rt.setRelative(n,n,(a+c)/2,i,!0);return}rt.setRelative(n,n,(a*l+c*r)/u,i,!0)},normalSlope:0,setRelative:function(n,e,t,i,s){if(!i||i===this){n.y=(s?e.yo:e.y)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y;n.y=a+i.normalSlope*(n.x-l)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(tt),Object.freeze(rt);function Pn(n,e){this.x=n,this.y=e,this.axis=void 0,this.slope=e/n,this.normalSlope=-n/e,Object.freeze(this)}Pn.prototype.distance=function(n,e,t,i){return this.x*tt.distance(n,e,t,i)+this.y*rt.distance(n,e,t,i)},Pn.prototype.interpolate=function(n,e,t,i){let s,o,r,l,a,c,u;if(r=i.distance(n,e,!0,!0),l=i.distance(n,t,!0,!0),s=i.distance(e,e,!1,!0),o=i.distance(t,t,!1,!0),a=Math.abs(r),c=Math.abs(l),u=a+c,u===0){this.setRelative(n,n,(s+o)/2,i,!0);return}this.setRelative(n,n,(s*c+o*a)/u,i,!0)},Pn.prototype.setRelative=function(n,e,t,i,s){i=i||this;const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*i.x,a=r+t*i.y,c=i.normalSlope,u=this.slope,h=n.x,f=n.y;n.x=(u*h-c*l+a-f)/(u-c),n.y=u*(n.x-h)+f},Pn.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function Fn(n,e){const t=Math.sqrt(n*n+e*e);return n/=t,e/=t,n===1&&e===0?tt:n===0&&e===1?rt:new Pn(n,e)}function at(n,e,t,i){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}at.prototype.nextTouched=function(n){let e=this.nextPointOnContour;for(;!n.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},at.prototype.prevTouched=function(n){let e=this.prevPointOnContour;for(;!n.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};const Rn=Object.freeze(new at(0,0)),TA={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Et(n,e){switch(this.env=n,this.stack=[],this.prog=e,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=tt,this.round=Fl}}Pl.prototype.exec=function(n,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;const t=this.font;let i=this._prepState;if(!i||i.ppem!==e){let s=this._fpgmState;if(!s){Et.prototype=TA,s=this._fpgmState=new Et("fpgm",t.tables.fpgm),s.funcs=[],s.font=t,_.DEBUG&&(console.log("---EXEC FPGM---"),s.step=-1);try{Ot(s)}catch(r){console.log("Hinting error in FPGM:"+r),this._errorState=3;return}}Et.prototype=s,i=this._prepState=new Et("prep",t.tables.prep),i.ppem=e;const o=t.tables.cvt;if(o){const r=i.cvt=new Array(o.length),l=e/t.unitsPerEm;for(let a=0;a<o.length;a++)r[a]=o[a]*l}else i.cvt=[];_.DEBUG&&(console.log("---EXEC PREP---"),i.step=-1);try{Ot(i)}catch(r){this._errorState<2&&console.log("Hinting error in PREP:"+r),this._errorState=2}}if(!(this._errorState>1))try{return kl(n,i)}catch(s){this._errorState<1&&(console.log("Hinting error:"+s),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},kl=function(n,e){const t=e.ppem/e.font.unitsPerEm,i=t;let s=n.components,o,r,l;if(Et.prototype=e,!s)l=new Et("glyf",n.instructions),_.DEBUG&&(console.log("---EXEC GLYPH---"),l.step=-1),to(n,l,t,i),r=l.gZone;else{const a=e.font;r=[],o=[];for(let c=0;c<s.length;c++){const u=s[c],h=a.glyphs.get(u.glyphIndex);l=new Et("glyf",h.instructions),_.DEBUG&&(console.log("---EXEC COMP "+c+"---"),l.step=-1),to(h,l,t,i);const f=Math.round(u.dx*t),p=Math.round(u.dy*i),A=l.gZone,C=l.contours;for(let y=0;y<A.length;y++){const E=A[y];E.xTouched=E.yTouched=!1,E.xo=E.x=E.x+f,E.yo=E.y=E.y+p}const m=r.length;r.push.apply(r,A);for(let y=0;y<C.length;y++)o.push(C[y]+m)}n.instructions&&!l.inhibitGridFit&&(l=new Et("glyf",n.instructions),l.gZone=l.z0=l.z1=l.z2=r,l.contours=o,r.push(new at(0,0),new at(Math.round(n.advanceWidth*t),0)),_.DEBUG&&(console.log("---EXEC COMPOSITE---"),l.step=-1),Ot(l),r.length-=2)}return r},to=function(n,e,t,i){const s=n.points||[],o=s.length,r=e.gZone=e.z0=e.z1=e.z2=[],l=e.contours=[];let a;for(let h=0;h<o;h++)a=s[h],r[h]=new at(a.x*t,a.y*i,a.lastPointOfContour,a.onCurve);let c,u;for(let h=0;h<o;h++)a=r[h],c||(c=a,l.push(h)),a.lastPointOfContour?(a.nextPointOnContour=c,c.prevPointOnContour=a,c=void 0):(u=r[h+1],a.nextPointOnContour=u,u.prevPointOnContour=a);if(!e.inhibitGridFit){if(_.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let h=0;h<o;h++)console.log(h,r[h].x,r[h].y)}if(r.push(new at(0,0),new at(Math.round(n.advanceWidth*t),0)),Ot(e),r.length-=2,_.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let h=0;h<o;h++)console.log(h,r[h].x,r[h].y)}}},Ot=function(n){let e=n.prog;if(!e)return;const t=e.length;let i;for(n.ip=0;n.ip<t;n.ip++){if(_.DEBUG&&n.step++,i=Dl[e[n.ip]],!i)throw new Error("unknown instruction: 0x"+Number(e[n.ip]).toString(16));i(n)}};function Ti(n){const e=n.tZone=new Array(n.gZone.length);for(let t=0;t<e.length;t++)e[t]=new at(0,0)}function Ol(n,e){const t=n.prog;let i=n.ip,s=1,o;do if(o=t[++i],o===88)s++;else if(o===89)s--;else if(o===64)i+=t[i+1]+1;else if(o===65)i+=2*t[i+1]+1;else if(o>=176&&o<=183)i+=o-176+1;else if(o>=184&&o<=191)i+=(o-184+1)*2;else if(e&&s===1&&o===27)break;while(s>0);n.ip=i}function Ll(n,e){_.DEBUG&&console.log(e.step,"SVTCA["+n.axis+"]"),e.fv=e.pv=e.dpv=n}function Nl(n,e){_.DEBUG&&console.log(e.step,"SPVTCA["+n.axis+"]"),e.pv=e.dpv=n}function Ul(n,e){_.DEBUG&&console.log(e.step,"SFVTCA["+n.axis+"]"),e.fv=n}function _l(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log("SPVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.pv=e.dpv=Fn(l,a)}function Ql(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log("SFVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.fv=Fn(l,a)}function DA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.pv=n.dpv=Fn(i,t)}function kA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.fv=Fn(i,t)}function PA(n){const e=n.stack,t=n.pv;_.DEBUG&&console.log(n.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function FA(n){const e=n.stack,t=n.fv;_.DEBUG&&console.log(n.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function RA(n){n.fv=n.pv,_.DEBUG&&console.log(n.step,"SFVTPV[]")}function OA(n){const e=n.stack,t=e.pop(),i=e.pop(),s=e.pop(),o=e.pop(),r=e.pop(),l=n.z0,a=n.z1,c=l[t],u=l[i],h=a[s],f=a[o],p=n.z2[r];_.DEBUG&&console.log("ISECT[], ",t,i,s,o,r);const A=c.x,C=c.y,m=u.x,y=u.y,E=h.x,I=h.y,M=f.x,k=f.y,S=(A-m)*(I-k)-(C-y)*(E-M),x=A*y-C*m,g=E*k-I*M;p.x=(x*(E-M)-g*(A-m))/S,p.y=(x*(I-k)-g*(C-y))/S}function LA(n){n.rp0=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP0[]",n.rp0)}function NA(n){n.rp1=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP1[]",n.rp1)}function UA(n){n.rp2=n.stack.pop(),_.DEBUG&&console.log(n.step,"SRP2[]",n.rp2)}function _A(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP0[]",e),n.zp0=e,e){case 0:n.tZone||Ti(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function QA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP1[]",e),n.zp1=e,e){case 0:n.tZone||Ti(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function HA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZP2[]",e),n.zp2=e,e){case 0:n.tZone||Ti(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function GA(n){const e=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"SZPS[]",e),n.zp0=n.zp1=n.zp2=e,e){case 0:n.tZone||Ti(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function YA(n){n.loop=n.stack.pop(),_.DEBUG&&console.log(n.step,"SLOOP[]",n.loop)}function VA(n){_.DEBUG&&console.log(n.step,"RTG[]"),n.round=Fl}function WA(n){_.DEBUG&&console.log(n.step,"RTHG[]"),n.round=BA}function zA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SMD[]",e),n.minDis=e/64}function jA(n){_.DEBUG&&console.log(n.step,"ELSE[]"),Ol(n,!1)}function $A(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"JMPR[]",e),n.ip+=e-1}function KA(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCVTCI[]",e),n.cvCutIn=e/64}function XA(n){const e=n.stack;_.DEBUG&&console.log(n.step,"DUP[]"),e.push(e[e.length-1])}function no(n){_.DEBUG&&console.log(n.step,"POP[]"),n.stack.pop()}function qA(n){_.DEBUG&&console.log(n.step,"CLEAR[]"),n.stack.length=0}function JA(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SWAP[]"),e.push(t),e.push(i)}function ZA(n){const e=n.stack;_.DEBUG&&console.log(n.step,"DEPTH[]"),e.push(e.length)}function ey(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LOOPCALL[]",t,i);const s=n.ip,o=n.prog;n.prog=n.funcs[t];for(let r=0;r<i;r++)Ot(n),_.DEBUG&&console.log(++n.step,r+1<i?"next loopcall":"done loopcall",r);n.ip=s,n.prog=o}function ty(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"CALL[]",e);const t=n.ip,i=n.prog;n.prog=n.funcs[e],Ot(n),n.ip=t,n.prog=i,_.DEBUG&&console.log(++n.step,"returning from",e)}function ny(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"CINDEX[]",t),e.push(e[e.length-t])}function iy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function sy(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");const e=n.stack,t=n.prog;let i=n.ip;const s=e.pop(),o=i;for(_.DEBUG&&console.log(n.step,"FDEF[]",s);t[++i]!==45;);n.ip=i,n.funcs[s]=t.slice(o+1,i)}function Hl(n,e){const t=e.stack.pop(),i=e.z0[t],s=e.fv,o=e.pv;_.DEBUG&&console.log(e.step,"MDAP["+n+"]",t);let r=o.distance(i,Rn);n&&(r=e.round(r)),s.setRelative(i,Rn,r,o),s.touch(i),e.rp0=e.rp1=t}function Gl(n,e){const t=e.z2,i=t.length-2;let s,o,r;_.DEBUG&&console.log(e.step,"IUP["+n.axis+"]");for(let l=0;l<i;l++)s=t[l],!n.touched(s)&&(o=s.prevTouched(n),o!==s&&(r=s.nextTouched(n),o===r&&n.setRelative(s,s,n.distance(o,o,!1,!0),n,!0),n.interpolate(s,o,r,n)))}function Yl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv;let l=e.loop;const a=e.z2;for(;l--;){const c=t.pop(),u=a[c],h=r.distance(s,s,!1,!0);o.setRelative(u,u,h,r),o.touch(u),_.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-l)+": ":"")+"SHP["+(n?"rp1":"rp2")+"]",c)}e.loop=1}function Vl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv,l=t.pop(),a=e.z2[e.contours[l]];let c=a;_.DEBUG&&console.log(e.step,"SHC["+n+"]",l);const u=r.distance(s,s,!1,!0);do c!==s&&o.setRelative(c,c,u,r),c=c.nextPointOnContour;while(c!==a)}function Wl(n,e){const t=e.stack,i=n?e.rp1:e.rp2,s=(n?e.z0:e.z1)[i],o=e.fv,r=e.pv,l=t.pop();_.DEBUG&&console.log(e.step,"SHZ["+n+"]",l);let a;switch(l){case 0:a=e.tZone;break;case 1:a=e.gZone;break;default:throw new Error("Invalid zone")}let c;const u=r.distance(s,s,!1,!0),h=a.length-2;for(let f=0;f<h;f++)c=a[f],o.setRelative(c,c,u,r)}function oy(n){const e=n.stack;let t=n.loop;const i=n.fv,s=e.pop()/64,o=n.z2;for(;t--;){const r=e.pop(),l=o[r];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-t)+": ":"")+"SHPIX[]",r,s),i.setRelative(l,l,s),i.touch(l)}n.loop=1}function ry(n){const e=n.stack,t=n.rp1,i=n.rp2;let s=n.loop;const o=n.z0[t],r=n.z1[i],l=n.fv,a=n.dpv,c=n.z2;for(;s--;){const u=e.pop(),h=c[u];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-s)+": ":"")+"IP[]",u,t,"<->",i),l.interpolate(h,o,r,a),l.touch(h)}n.loop=1}function zl(n,e){const t=e.stack,i=t.pop()/64,s=t.pop(),o=e.z1[s],r=e.z0[e.rp0],l=e.fv,a=e.pv;l.setRelative(o,r,i,a),l.touch(o),_.DEBUG&&console.log(e.step,"MSIRP["+n+"]",i,s),e.rp1=e.rp0,e.rp2=s,n&&(e.rp0=s)}function ay(n){const e=n.stack,t=n.rp0,i=n.z0[t];let s=n.loop;const o=n.fv,r=n.pv,l=n.z1;for(;s--;){const a=e.pop(),c=l[a];_.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-s)+": ":"")+"ALIGNRP[]",a),o.setRelative(c,i,0,r),o.touch(c)}n.loop=1}function ly(n){_.DEBUG&&console.log(n.step,"RTDG[]"),n.round=xA}function jl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z0[s],r=e.fv,l=e.pv;let a=e.cvt[i];_.DEBUG&&console.log(e.step,"MIAP["+n+"]",i,"(",a,")",s);let c=l.distance(o,Rn);n&&(Math.abs(c-a)<e.cvCutIn&&(c=a),c=e.round(c)),r.setRelative(o,Rn,c,l),e.zp0===0&&(o.xo=o.x,o.yo=o.y),r.touch(o),e.rp0=e.rp1=s}function cy(n){const e=n.prog;let t=n.ip;const i=n.stack,s=e[++t];_.DEBUG&&console.log(n.step,"NPUSHB[]",s);for(let o=0;o<s;o++)i.push(e[++t]);n.ip=t}function dy(n){let e=n.ip;const t=n.prog,i=n.stack,s=t[++e];_.DEBUG&&console.log(n.step,"NPUSHW[]",s);for(let o=0;o<s;o++){let r=t[++e]<<8|t[++e];r&32768&&(r=-((r^65535)+1)),i.push(r)}n.ip=e}function uy(n){const e=n.stack;let t=n.store;t||(t=n.store=[]);const i=e.pop(),s=e.pop();_.DEBUG&&console.log(n.step,"WS",i,s),t[s]=i}function hy(n){const e=n.stack,t=n.store,i=e.pop();_.DEBUG&&console.log(n.step,"RS",i);const s=t&&t[i]||0;e.push(s)}function fy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"WCVTP",t,i),n.cvt[i]=t/64}function py(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"RCVT",t),e.push(n.cvt[t]*64)}function $l(n,e){const t=e.stack,i=t.pop(),s=e.z2[i];_.DEBUG&&console.log(e.step,"GC["+n+"]",i),t.push(e.dpv.distance(s,Rn,n,!1)*64)}function Kl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z1[i],r=e.z0[s],l=e.dpv.distance(r,o,n,n);_.DEBUG&&console.log(e.step,"MD["+n+"]",i,s,"->",l),e.stack.push(Math.round(l*64))}function gy(n){_.DEBUG&&console.log(n.step,"MPPEM[]"),n.stack.push(n.ppem)}function my(n){_.DEBUG&&console.log(n.step,"FLIPON[]"),n.autoFlip=!0}function Ay(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LT[]",t,i),e.push(i<t?1:0)}function yy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"LTEQ[]",t,i),e.push(i<=t?1:0)}function Cy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"GT[]",t,i),e.push(i>t?1:0)}function Ey(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function wy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"EQ[]",t,i),e.push(t===i?1:0)}function by(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function vy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function Iy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function xy(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"IF[]",e),e||(Ol(n,!0),_.DEBUG&&console.log(n.step,"EIF[]"))}function By(n){_.DEBUG&&console.log(n.step,"EIF[]")}function Sy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"AND[]",t,i),e.push(t&&i?1:0)}function My(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"OR[]",t,i),e.push(t||i?1:0)}function Ty(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"NOT[]",t),e.push(t?0:1)}function io(n,e){const t=e.stack,i=t.pop(),s=e.fv,o=e.pv,r=e.ppem,l=e.deltaBase+(n-1)*16,a=e.deltaShift,c=e.z0;_.DEBUG&&console.log(e.step,"DELTAP["+n+"]",i,t);for(let u=0;u<i;u++){const h=t.pop(),f=t.pop();if(l+((f&240)>>4)!==r)continue;let A=(f&15)-8;A>=0&&A++,_.DEBUG&&console.log(e.step,"DELTAPFIX",h,"by",A*a);const C=c[h];s.setRelative(C,C,A*a,o)}}function Dy(n){const t=n.stack.pop();_.DEBUG&&console.log(n.step,"SDB[]",t),n.deltaBase=t}function ky(n){const t=n.stack.pop();_.DEBUG&&console.log(n.step,"SDS[]",t),n.deltaShift=Math.pow(.5,t)}function Py(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"ADD[]",t,i),e.push(i+t)}function Fy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"SUB[]",t,i),e.push(i-t)}function Ry(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"DIV[]",t,i),e.push(i*64/t)}function Oy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MUL[]",t,i),e.push(i*t/64)}function Ly(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"ABS[]",t),e.push(Math.abs(t))}function Ny(n){const e=n.stack;let t=e.pop();_.DEBUG&&console.log(n.step,"NEG[]",t),e.push(-t)}function Uy(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function _y(n){const e=n.stack,t=e.pop();_.DEBUG&&console.log(n.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Di(n,e){const t=e.stack,i=t.pop();_.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function Qy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"WCVTF[]",t,i),n.cvt[i]=t*n.ppem/n.font.unitsPerEm}function so(n,e){const t=e.stack,i=t.pop(),s=e.ppem,o=e.deltaBase+(n-1)*16,r=e.deltaShift;_.DEBUG&&console.log(e.step,"DELTAC["+n+"]",i,t);for(let l=0;l<i;l++){const a=t.pop(),c=t.pop();if(o+((c&240)>>4)!==s)continue;let h=(c&15)-8;h>=0&&h++;const f=h*r;_.DEBUG&&console.log(e.step,"DELTACFIX",a,"by",f),e.cvt[a]+=f}}function Hy(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"SROUND[]",e),n.round=Rl;let t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function Gy(n){let e=n.stack.pop();_.DEBUG&&console.log(n.step,"S45ROUND[]",e),n.round=Rl;let t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function Yy(n){_.DEBUG&&console.log(n.step,"ROFF[]"),n.round=IA}function Vy(n){_.DEBUG&&console.log(n.step,"RUTG[]"),n.round=SA}function Wy(n){_.DEBUG&&console.log(n.step,"RDTG[]"),n.round=MA}function zy(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCANCTRL[]",e)}function Xl(n,e){const t=e.stack,i=t.pop(),s=t.pop(),o=e.z2[i],r=e.z1[s];_.DEBUG&&console.log(e.step,"SDPVTL["+n+"]",i,s);let l,a;n?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.dpv=Fn(l,a)}function jy(n){const e=n.stack,t=e.pop();let i=0;_.DEBUG&&console.log(n.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function $y(n){const e=n.stack,t=e.pop(),i=e.pop(),s=e.pop();_.DEBUG&&console.log(n.step,"ROLL[]"),e.push(i),e.push(t),e.push(s)}function Ky(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MAX[]",t,i),e.push(Math.max(i,t))}function Xy(n){const e=n.stack,t=e.pop(),i=e.pop();_.DEBUG&&console.log(n.step,"MIN[]",t,i),e.push(Math.min(i,t))}function qy(n){const e=n.stack.pop();_.DEBUG&&console.log(n.step,"SCANTYPE[]",e)}function Jy(n){const e=n.stack.pop();let t=n.stack.pop();switch(_.DEBUG&&console.log(n.step,"INSTCTRL[]",e,t),e){case 1:n.inhibitGridFit=!!t;return;case 2:n.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function wt(n,e){const t=e.stack,i=e.prog;let s=e.ip;_.DEBUG&&console.log(e.step,"PUSHB["+n+"]");for(let o=0;o<n;o++)t.push(i[++s]);e.ip=s}function bt(n,e){let t=e.ip;const i=e.prog,s=e.stack;_.DEBUG&&console.log(e.ip,"PUSHW["+n+"]");for(let o=0;o<n;o++){let r=i[++t]<<8|i[++t];r&32768&&(r=-((r^65535)+1)),s.push(r)}e.ip=t}function K(n,e,t,i,s,o){const r=o.stack,l=n&&r.pop(),a=r.pop(),c=o.rp0,u=o.z0[c],h=o.z1[a],f=o.minDis,p=o.fv,A=o.dpv;let C,m,y,E;m=C=A.distance(h,u,!0,!0),y=m>=0?1:-1,m=Math.abs(m),n&&(E=o.cvt[l],i&&Math.abs(m-E)<o.cvCutIn&&(m=E)),t&&m<f&&(m=f),i&&(m=o.round(m)),p.setRelative(h,u,y*m,A),p.touch(h),_.DEBUG&&console.log(o.step,(n?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(i?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"]",n?l+"("+o.cvt[l]+","+E+")":"",a,"(d =",C,"->",y*m,")"),o.rp1=o.rp0,o.rp2=a,e&&(o.rp0=a)}Dl=[Ll.bind(void 0,rt),Ll.bind(void 0,tt),Nl.bind(void 0,rt),Nl.bind(void 0,tt),Ul.bind(void 0,rt),Ul.bind(void 0,tt),_l.bind(void 0,0),_l.bind(void 0,1),Ql.bind(void 0,0),Ql.bind(void 0,1),DA,kA,PA,FA,RA,OA,LA,NA,UA,_A,QA,HA,GA,YA,VA,WA,zA,jA,$A,KA,void 0,void 0,XA,no,qA,JA,ZA,ny,iy,void 0,void 0,void 0,ey,ty,sy,void 0,Hl.bind(void 0,0),Hl.bind(void 0,1),Gl.bind(void 0,rt),Gl.bind(void 0,tt),Yl.bind(void 0,0),Yl.bind(void 0,1),Vl.bind(void 0,0),Vl.bind(void 0,1),Wl.bind(void 0,0),Wl.bind(void 0,1),oy,ry,zl.bind(void 0,0),zl.bind(void 0,1),ay,ly,jl.bind(void 0,0),jl.bind(void 0,1),cy,dy,uy,hy,fy,py,$l.bind(void 0,0),$l.bind(void 0,1),void 0,Kl.bind(void 0,0),Kl.bind(void 0,1),gy,void 0,my,void 0,void 0,Ay,yy,Cy,Ey,wy,by,vy,Iy,xy,By,Sy,My,Ty,io.bind(void 0,1),Dy,ky,Py,Fy,Ry,Oy,Ly,Ny,Uy,_y,Di.bind(void 0,0),Di.bind(void 0,1),Di.bind(void 0,2),Di.bind(void 0,3),void 0,void 0,void 0,void 0,Qy,io.bind(void 0,2),io.bind(void 0,3),so.bind(void 0,1),so.bind(void 0,2),so.bind(void 0,3),Hy,Gy,void 0,void 0,Yy,void 0,Vy,Wy,no,no,void 0,void 0,void 0,void 0,void 0,zy,Xl.bind(void 0,0),Xl.bind(void 0,1),jy,void 0,$y,Ky,Xy,qy,Jy,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,wt.bind(void 0,1),wt.bind(void 0,2),wt.bind(void 0,3),wt.bind(void 0,4),wt.bind(void 0,5),wt.bind(void 0,6),wt.bind(void 0,7),wt.bind(void 0,8),bt.bind(void 0,1),bt.bind(void 0,2),bt.bind(void 0,3),bt.bind(void 0,4),bt.bind(void 0,5),bt.bind(void 0,6),bt.bind(void 0,7),bt.bind(void 0,8),K.bind(void 0,0,0,0,0,0),K.bind(void 0,0,0,0,0,1),K.bind(void 0,0,0,0,0,2),K.bind(void 0,0,0,0,0,3),K.bind(void 0,0,0,0,1,0),K.bind(void 0,0,0,0,1,1),K.bind(void 0,0,0,0,1,2),K.bind(void 0,0,0,0,1,3),K.bind(void 0,0,0,1,0,0),K.bind(void 0,0,0,1,0,1),K.bind(void 0,0,0,1,0,2),K.bind(void 0,0,0,1,0,3),K.bind(void 0,0,0,1,1,0),K.bind(void 0,0,0,1,1,1),K.bind(void 0,0,0,1,1,2),K.bind(void 0,0,0,1,1,3),K.bind(void 0,0,1,0,0,0),K.bind(void 0,0,1,0,0,1),K.bind(void 0,0,1,0,0,2),K.bind(void 0,0,1,0,0,3),K.bind(void 0,0,1,0,1,0),K.bind(void 0,0,1,0,1,1),K.bind(void 0,0,1,0,1,2),K.bind(void 0,0,1,0,1,3),K.bind(void 0,0,1,1,0,0),K.bind(void 0,0,1,1,0,1),K.bind(void 0,0,1,1,0,2),K.bind(void 0,0,1,1,0,3),K.bind(void 0,0,1,1,1,0),K.bind(void 0,0,1,1,1,1),K.bind(void 0,0,1,1,1,2),K.bind(void 0,0,1,1,1,3),K.bind(void 0,1,0,0,0,0),K.bind(void 0,1,0,0,0,1),K.bind(void 0,1,0,0,0,2),K.bind(void 0,1,0,0,0,3),K.bind(void 0,1,0,0,1,0),K.bind(void 0,1,0,0,1,1),K.bind(void 0,1,0,0,1,2),K.bind(void 0,1,0,0,1,3),K.bind(void 0,1,0,1,0,0),K.bind(void 0,1,0,1,0,1),K.bind(void 0,1,0,1,0,2),K.bind(void 0,1,0,1,0,3),K.bind(void 0,1,0,1,1,0),K.bind(void 0,1,0,1,1,1),K.bind(void 0,1,0,1,1,2),K.bind(void 0,1,0,1,1,3),K.bind(void 0,1,1,0,0,0),K.bind(void 0,1,1,0,0,1),K.bind(void 0,1,1,0,0,2),K.bind(void 0,1,1,0,0,3),K.bind(void 0,1,1,0,1,0),K.bind(void 0,1,1,0,1,1),K.bind(void 0,1,1,0,1,2),K.bind(void 0,1,1,0,1,3),K.bind(void 0,1,1,1,0,0),K.bind(void 0,1,1,1,0,1),K.bind(void 0,1,1,1,0,2),K.bind(void 0,1,1,1,0,3),K.bind(void 0,1,1,1,1,0),K.bind(void 0,1,1,1,1,1),K.bind(void 0,1,1,1,1,2),K.bind(void 0,1,1,1,1,3)];const Zy=Array.from||(n=>n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]);function de(n){n=n||{},n.empty||(an(n.familyName,"When creating a new Font object, familyName is required."),an(n.styleName,"When creating a new Font object, styleName is required."),an(n.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),an(n.ascender,"When creating a new Font object, ascender is required."),an(n.descender,"When creating a new Font object, descender is required."),an(n.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:n.familyName||" "},fontSubfamily:{en:n.styleName||" "},fullName:{en:n.fullName||n.familyName+" "+n.styleName},postScriptName:{en:n.postScriptName||(n.familyName+n.styleName).replace(/\s/g,"")},designer:{en:n.designer||" "},designerURL:{en:n.designerURL||" "},manufacturer:{en:n.manufacturer||" "},manufacturerURL:{en:n.manufacturerURL||" "},license:{en:n.license||" "},licenseURL:{en:n.licenseURL||" "},version:{en:n.version||"Version 0.1"},description:{en:n.description||" "},copyright:{en:n.copyright||" "},trademark:{en:n.trademark||" "}},this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.tables={os2:{usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,fsSelection:n.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new on.GlyphSet(this,n.glyphs||[]),this.encoding=new Wa(this),this.position=new kn(this),this.substitution=new Ve(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new Pl(this)}})}de.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)!==null},de.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},de.prototype.charToGlyph=function(n){const e=this.charToGlyphIndex(n);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},de.prototype.stringToGlyphs=function(n,e){e=e||this.defaultRenderOptions;const t=Zy(n),i=[];for(let l=0;l<t.length;l+=1){const a=t[l];i.push(this.charToGlyphIndex(a))}let s=i.length;if(e.features){const l=e.script||this.substitution.getDefaultScriptName();let a=[];e.features.liga&&(a=a.concat(this.substitution.getFeature("liga",l,e.language))),e.features.rlig&&(a=a.concat(this.substitution.getFeature("rlig",l,e.language)));for(let c=0;c<s;c+=1)for(let u=0;u<a.length;u++){const h=a[u],f=h.sub,p=f.length;let A=0;for(;A<p&&f[A]===i[c+A];)A++;A===p&&(i.splice(c,p,h.by),s=s-p+1)}}const o=new Array(s),r=this.glyphs.get(0);for(let l=0;l<s;l+=1)o[l]=this.glyphs.get(i[l])||r;return o},de.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},de.prototype.nameToGlyph=function(n){const e=this.nameToGlyphIndex(n);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},de.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},de.prototype.getKerningValue=function(n,e){n=n.index||n,e=e.index||e;const t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,n,e):this.kerningPairs[n+","+e]||0},de.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},de.prototype.forEachGlyph=function(n,e,t,i,s,o){e=e!==void 0?e:0,t=t!==void 0?t:0,i=i!==void 0?i:72,s=s||this.defaultRenderOptions;const r=1/this.unitsPerEm*i,l=this.stringToGlyphs(n,s);let a;if(s.kerning){const c=s.script||this.position.getDefaultScriptName();a=this.position.getKerningTables(c,s.language)}for(let c=0;c<l.length;c+=1){const u=l[c];if(o.call(this,u,e,t,i,s),u.advanceWidth&&(e+=u.advanceWidth*r),s.kerning&&c<l.length-1){const h=a?this.position.getKerningValue(a,u.index,l[c+1].index):this.getKerningValue(u,l[c+1]);e+=h*r}s.letterSpacing?e+=s.letterSpacing*i:s.tracking&&(e+=s.tracking/1e3*i)}return e},de.prototype.getPath=function(n,e,t,i,s){const o=new be;return this.forEachGlyph(n,e,t,i,s,function(r,l,a,c){const u=r.getPath(l,a,c,s,this);o.extend(u)}),o},de.prototype.getPaths=function(n,e,t,i,s){const o=[];return this.forEachGlyph(n,e,t,i,s,function(r,l,a,c){const u=r.getPath(l,a,c,s,this);o.push(u)}),o},de.prototype.getAdvanceWidth=function(n,e,t){return this.forEachGlyph(n,0,0,e,t,function(){})},de.prototype.draw=function(n,e,t,i,s,o){this.getPath(e,t,i,s,o).draw(n)},de.prototype.drawPoints=function(n,e,t,i,s,o){this.forEachGlyph(e,t,i,s,o,function(r,l,a,c){r.drawPoints(n,l,a,c)})},de.prototype.drawMetrics=function(n,e,t,i,s,o){this.forEachGlyph(e,t,i,s,o,function(r,l,a,c){r.drawMetrics(n,l,a,c)})},de.prototype.getEnglishName=function(n){const e=this.names[n];if(e)return e.en},de.prototype.validate=function(){const n=this;function e(i,s){}function t(i){const s=n.getEnglishName(i);s&&s.trim().length>0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0},de.prototype.toTables=function(){return gA.fontToTable(this)},de.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},de.prototype.toArrayBuffer=function(){const e=this.toTables().encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<e.length;s++)i[s]=e[s];return t},de.prototype.download=function(n){const e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");n=n||e.replace(/\s/g,"")+"-"+t+".otf";const i=this.toArrayBuffer();if(AA())if(window.URL=window.URL||window.webkitURL,window.URL){const s=new DataView(i),o=new Blob([s],{type:"font/opentype"});let r=document.createElement("a");r.href=window.URL.createObjectURL(o),r.download=n;let l=document.createEvent("MouseEvents");l.initEvent("click",!0,!1),r.dispatchEvent(l)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{const s=require("fs"),o=CA(i);s.writeFileSync(n,o)}},de.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},de.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},de.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function ql(n,e){const t=JSON.stringify(n);let i=256;for(let s in e){let o=parseInt(s);if(!(!o||o<256)){if(JSON.stringify(e[s])===t)return o;i<=o&&(i=o+1)}}return e[i]=n,i}function e0(n,e,t){const i=ql(e.name,t);return[{name:"tag_"+n,type:"TAG",value:e.tag},{name:"minValue_"+n,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:i}]}function t0(n,e,t){const i={},s=new q.Parser(n,e);return i.tag=s.parseTag(),i.minValue=s.parseFixed(),i.defaultValue=s.parseFixed(),i.maxValue=s.parseFixed(),s.skip("uShort",1),i.name=t[s.parseUShort()]||{},i}function n0(n,e,t,i){const s=ql(e.name,i),o=[{name:"nameID_"+n,type:"USHORT",value:s},{name:"flags_"+n,type:"USHORT",value:0}];for(let r=0;r<t.length;++r){const l=t[r].tag;o.push({name:"axis_"+n+" "+l,type:"FIXED",value:e.coordinates[l]<<16})}return o}function i0(n,e,t,i){const s={},o=new q.Parser(n,e);s.name=i[o.parseUShort()]||{},o.skip("uShort",1),s.coordinates={};for(let r=0;r<t.length;++r)s.coordinates[t[r].tag]=o.parseFixed();return s}function s0(n,e){const t=new Z.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:n.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:n.instances.length},{name:"instanceSize",type:"USHORT",value:4+n.axes.length*4}]);t.offsetToData=t.sizeOf();for(let i=0;i<n.axes.length;i++)t.fields=t.fields.concat(e0(i,n.axes[i],e));for(let i=0;i<n.instances.length;i++)t.fields=t.fields.concat(n0(i,n.instances[i],n.axes,e));return t}function o0(n,e,t){const i=new q.Parser(n,e),s=i.parseULong();ie.argument(s===65536,"Unsupported fvar table version.");const o=i.parseOffset16();i.skip("uShort",1);const r=i.parseUShort(),l=i.parseUShort(),a=i.parseUShort(),c=i.parseUShort(),u=[];for(let p=0;p<r;p++)u.push(t0(n,e+o+p*l,t));const h=[],f=e+o+r*l;for(let p=0;p<a;p++)h.push(i0(n,f+p*c,u,t));return{axes:u,instances:h}}const r0={make:s0,parse:o0},We=new Array(10);We[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(H.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(H.coverage),values:this.parseValueRecordList()};ie.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},We[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();ie.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");const i=this.parsePointer(H.coverage),s=this.parseUShort(),o=this.parseUShort();if(t===1)return{posFormat:t,coverage:i,valueFormat1:s,valueFormat2:o,pairSets:this.parseList(H.pointer(H.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}})))};if(t===2){const r=this.parsePointer(H.classDef),l=this.parsePointer(H.classDef),a=this.parseUShort(),c=this.parseUShort();return{posFormat:t,coverage:i,valueFormat1:s,valueFormat2:o,classDef1:r,classDef2:l,class1Count:a,class2Count:c,classRecords:this.parseList(a,H.list(c,function(){return{value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}}))}}},We[3]=function(){return{error:"GPOS Lookup 3 not supported"}},We[4]=function(){return{error:"GPOS Lookup 4 not supported"}},We[5]=function(){return{error:"GPOS Lookup 5 not supported"}},We[6]=function(){return{error:"GPOS Lookup 6 not supported"}},We[7]=function(){return{error:"GPOS Lookup 7 not supported"}},We[8]=function(){return{error:"GPOS Lookup 8 not supported"}},We[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function a0(n,e){e=e||0;const t=new H(n,e),i=t.parseVersion(1);return ie.argument(i===1||i===1.1,"Unsupported GPOS table version "+i),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We),variations:t.parseFeatureVariationsList()}}const l0=new Array(10);function c0(n){return new Z.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(n.lookups,l0)}])}const d0={parse:a0,make:c0};function u0(n){const e={};n.skip("uShort");const t=n.parseUShort();ie.argument(t===0,"Unsupported kern sub-table version."),n.skip("uShort",2);const i=n.parseUShort();n.skip("uShort",3);for(let s=0;s<i;s+=1){const o=n.parseUShort(),r=n.parseUShort(),l=n.parseShort();e[o+","+r]=l}return e}function h0(n){const e={};n.skip("uShort"),n.parseULong()>1&&console.warn("Only the first kern subtable is supported."),n.skip("uLong");const s=n.parseUShort()&255;if(n.skip("uShort"),s===0){const o=n.parseUShort();n.skip("uShort",3);for(let r=0;r<o;r+=1){const l=n.parseUShort(),a=n.parseUShort(),c=n.parseShort();e[l+","+a]=c}}return e}function f0(n,e){const t=new q.Parser(n,e),i=t.parseUShort();if(i===0)return u0(t);if(i===1)return h0(t);throw new Error("Unsupported kern table version ("+i+").")}const p0={parse:f0};function g0(n,e,t,i){const s=new q.Parser(n,e),o=i?s.parseUShort:s.parseULong,r=[];for(let l=0;l<t+1;l+=1){let a=o.call(s);i&&(a*=2),r.push(a)}return r}const m0={parse:g0};function A0(n,e){require("fs").readFile(n,function(i,s){if(i)return e(i.message);e(null,yA(s))})}function y0(n,e){const t=new XMLHttpRequest;t.open("get",n,!0),t.responseType="arraybuffer",t.onload=function(){return t.response?e(null,t.response):e("Font could not be loaded: "+t.statusText)},t.onerror=function(){e("Font could not be loaded")},t.send()}function Jl(n,e){const t=[];let i=12;for(let s=0;s<e;s+=1){const o=q.getTag(n,i),r=q.getULong(n,i+4),l=q.getULong(n,i+8),a=q.getULong(n,i+12);t.push({tag:o,checksum:r,offset:l,length:a,compression:!1}),i+=16}return t}function C0(n,e){const t=[];let i=44;for(let s=0;s<e;s+=1){const o=q.getTag(n,i),r=q.getULong(n,i+4),l=q.getULong(n,i+8),a=q.getULong(n,i+12);let c;l<a?c="WOFF":c=!1,t.push({tag:o,offset:r,compression:c,compressedLength:l,length:a}),i+=20}return t}function we(n,e){if(e.compression==="WOFF"){const t=new Uint8Array(n.buffer,e.offset+2,e.compressedLength-2),i=new Uint8Array(e.length);if(qg(t,i),i.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");return{data:new DataView(i.buffer,0),offset:0}}else return{data:n,offset:e.offset}}function E0(n){let e,t;const i=new de({empty:!0}),s=new DataView(n,0);let o,r=[];const l=q.getTag(s,0);if(l==="\0\0\0"||l==="true"||l==="typ1")i.outlinesFormat="truetype",o=q.getUShort(s,4),r=Jl(s,o);else if(l==="OTTO")i.outlinesFormat="cff",o=q.getUShort(s,4),r=Jl(s,o);else if(l==="wOFF"){const k=q.getTag(s,4);if(k==="\0\0\0")i.outlinesFormat="truetype";else if(k==="OTTO")i.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);o=q.getUShort(s,12),r=C0(s,o)}else throw new Error("Unsupported OpenType signature "+l);let a,c,u,h,f,p,A,C,m,y,E;for(let k=0;k<o;k+=1){const S=r[k];let x;switch(S.tag){case"cmap":x=we(s,S),i.tables.cmap=Va.parse(x.data,x.offset),i.encoding=new za(i.tables.cmap);break;case"cvt ":x=we(s,S),E=new q.Parser(x.data,x.offset),i.tables.cvt=E.parseShortList(S.length/2);break;case"fvar":c=S;break;case"fpgm":x=we(s,S),E=new q.Parser(x.data,x.offset),i.tables.fpgm=E.parseByteList(S.length);break;case"head":x=we(s,S),i.tables.head=ol.parse(x.data,x.offset),i.unitsPerEm=i.tables.head.unitsPerEm,e=i.tables.head.indexToLocFormat;break;case"hhea":x=we(s,S),i.tables.hhea=rl.parse(x.data,x.offset),i.ascender=i.tables.hhea.ascender,i.descender=i.tables.hhea.descender,i.numberOfHMetrics=i.tables.hhea.numberOfHMetrics;break;case"hmtx":p=S;break;case"ltag":x=we(s,S),t=ll.parse(x.data,x.offset);break;case"maxp":x=we(s,S),i.tables.maxp=cl.parse(x.data,x.offset),i.numGlyphs=i.tables.maxp.numGlyphs;break;case"name":m=S;break;case"OS/2":x=we(s,S),i.tables.os2=qs.parse(x.data,x.offset);break;case"post":x=we(s,S),i.tables.post=Al.parse(x.data,x.offset),i.glyphNames=new Ws(i.tables.post);break;case"prep":x=we(s,S),E=new q.Parser(x.data,x.offset),i.tables.prep=E.parseByteList(S.length);break;case"glyf":u=S;break;case"loca":C=S;break;case"CFF ":a=S;break;case"kern":A=S;break;case"GPOS":h=S;break;case"GSUB":f=S;break;case"meta":y=S;break}}const I=we(s,m);if(i.tables.name=ml.parse(I.data,I.offset,t),i.names=i.tables.name,u&&C){const k=e===0,S=we(s,C),x=m0.parse(S.data,S.offset,i.numGlyphs,k),g=we(s,u);i.glyphs=Tl.parse(g.data,g.offset,x,i)}else if(a){const k=we(s,a);sl.parse(k.data,k.offset,i)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");const M=we(s,p);if(al.parse(M.data,M.offset,i.numberOfHMetrics,i.numGlyphs,i.glyphs),mm(i),A){const k=we(s,A);i.kerningPairs=p0.parse(k.data,k.offset)}else i.kerningPairs={};if(h){const k=we(s,h);i.tables.gpos=d0.parse(k.data,k.offset),i.position.init()}if(f){const k=we(s,f);i.tables.gsub=yl.parse(k.data,k.offset)}if(c){const k=we(s,c);i.tables.fvar=r0.parse(k.data,k.offset,i.names)}if(y){const k=we(s,y);i.tables.meta=Cl.parse(k.data,k.offset),i.metas=i.tables.meta}return i}function w0(n,e){(typeof window>"u"?A0:y0)(n,function(s,o){if(s)return e(s);let r;try{r=E0(o)}catch(l){return e(l,null)}return e(null,r)})}const oo=1e-12;function On(n){if(!Array.isArray(n)||n.length===0)return n||[];const e=n[0],t=n[n.length-1];if(!e||!t||e.length<2||t.length<2)return n;const i=e[0]??0,s=e[1]??0,o=t[0]??0,r=t[1]??0;return(Math.abs(i-o)>oo||Math.abs(s-r)>oo)&&n.push([i,s]),n}function Lt(n){let e=0;if(!n)return 0;for(let t=0;t<n.length-1;t++){const i=n[t],s=n[t+1];if(!i||!s)continue;const o=i[0]??0,r=i[1]??0,l=s[0]??0,a=s[1]??0;e+=o*a-l*r}return e/2}function ki(n,e=oo){const t=[];if(!n)return t;for(const i of n){if(!i||i.length<2)continue;const s=t[t.length-1],o=i[0]??0,r=i[1]??0;if(!s){t.push([o,r]);continue}const l=s[0]??0,a=s[1]??0;(Math.abs(o-l)>e||Math.abs(r-a)>e)&&t.push([o,r])}return t}function b0(n,e,t,i,s=16){const o=[],r=n?.[0]??0,l=n?.[1]??0,a=t?.[0]??0,c=t?.[1]??0,u=i?.[0]??0,h=i?.[1]??0,f=e?.[0]??0,p=e?.[1]??0;for(let A=0;A<=s;A++){const C=A/s,m=1-C,y=m*m*m*r+3*m*m*C*a+3*m*C*C*u+C*C*C*f,E=m*m*m*l+3*m*m*C*c+3*m*C*C*h+C*C*C*p;o.push([y,E])}return o}function Zl(n,e){if(!n||!e)return!1;const t=n[0]??0,i=n[1]??0;let s=!1;for(let o=0,r=e.length-1;o<e.length;r=o++){const l=e[o],a=e[r];if(!l||!a)continue;const c=l[0]??0,u=l[1]??0,h=a[0]??0,f=a[1]??0;u>i!=f>i&&t<(h-c)*(i-u)/(f-u+0)+c&&(s=!s)}return s}function ro(n){return n?(Lt(n)<0&&n.reverse(),On(n),n):[]}function v0(n){return n?(Lt(n)>0&&n.reverse(),On(n),n):[]}function ec(n,e=16){if(!n||!Array.isArray(n.commands))return[];const t=[];let i=[];for(const s of n.commands){let o=function(l){const a=l.x!==void 0?l.x:0,c=l.y!==void 0?-l.y:0;return[a,c]};const r=s.type;if(r==="M")i.length&&t.push(ki(i)),i=[o(s)];else if(r==="L")i.push(o(s));else if(r==="Q"){const a=i[i.length-1]||o(s),c=[],u=s.x??0,h=s.y??0,f=s.x1??0,p=s.y1??0,A=a[0]??0,C=a[1]??0;for(let m=1;m<=e;m++){const y=m/e,E=1-y,I=E*E*A+2*E*y*f+y*y*u,M=E*E*C+2*E*y*p+y*y*-h;c.push([I,M])}c.length?i.push(...c):i.push(o(s))}else if(r==="C"){const a=i[i.length-1]||o(s),c=[s.x1||0,-(s.y1||0)],u=[s.x2||0,-(s.y2||0)],h=[s.x||0,-(s.y||0)],f=b0(a,h,c,u,e);f.length>1?i.push(...f.slice(1)):i.push(h)}else r==="Z"||r==="z"?(i.length&&t.push(ki(i)),i=[]):s.x!==void 0&&s.y!==void 0&&i.push(o(s))}return i.length&&t.push(ki(i)),t.map(s=>On(s)).filter(s=>s&&s.length>=4)}function ao(n,e){if(!n)return null;const t=n.map(i=>On(i.slice()));return{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{...e.properties||{},rings:t.length,polygons:1}}}function I0(n,e,t={}){t=Object.assign({sampleSegments:16,simplifyTolerance:0,epsArea:1e-24,debug:!1,scale:1,widthScale:.6,fillWinding:"auto"},t||{scale:1});const i=!!t.debug;if(!n||!n.geometry||!Array.isArray(n.geometry.coordinates))return{type:"FeatureCollection",features:[]};const s=n.geometry.coordinates,o=n.properties||{},r=o.text||o.label||"",l=o.rotation??0,a=t.sampleSegments||16,c=t.epsArea||1e-24,h=o.height/.9||1,f=(t.scale||1)*h,p=-l*Math.PI/180,A=Math.cos(p),C=Math.sin(p),m=o.attachmentPoint||"bottom-left",y=[];if(!e||typeof e.getPaths!="function")return{type:"FeatureCollection",features:y};const E=e.getPaths(r,0,0,t.fontSize||1)||[];let I=[];for(const L of E){const G=ec(L,a);for(const N of G)if(N)for(const b of N)b&&I.push(b)}let M=1/0,k=1/0,S=-1/0,x=-1/0;for(const L of I){if(!L)continue;const G=L[0]??0,N=L[1]??0;M=Math.min(M,G),k=Math.min(k,N),S=Math.max(S,G),x=Math.max(x,N)}const g=S-M,F=x-k;let D=0,P=0;switch(m){case"top-left":D=0,P=-F;break;case"top-center":D=-g/2,P=F;break;case"top-right":D=-g,P=F;break;case"center-left":D=0,P=F/2;break;case"center":D=-g/2,P=F/2;break;case"center-right":D=-g,P=F/2;break;case"bottom-left":D=0,P=0;break;case"bottom-center":D=-g/2,P=0;break;case"bottom-right":D=-g,P=0;break;default:D=0,P=0}for(const L of E){const G=ec(L,a);if(!G||G.length===0)continue;const N=G.map(R=>{if(!R)return[];const U=R.map(O=>{if(!O)return[0,0];let T=(O[0]??0)+D,Q=(O[1]??0)+P;T=T*(t.widthScale||.6);const V=T*A-Q*C,$=T*C+Q*A;return[s[0]+V*f,s[1]+$*f]});return On(ki(U))}).filter(R=>R&&R.length>=4&&Math.abs(Lt(R))>c);if(N.length===0)continue;let b=1;if(t.fillWinding==="positive")b=1;else if(t.fillWinding==="negative")b=-1;else{let R=0,U=-1;for(let Q=0;Q<N.length;Q++){const V=N[Q];if(!V)continue;const $=Lt(V);Math.abs($)>U&&(U=Math.abs($),R=Q)}const O=N[R],T=O?Lt(O):0;b=T>=0?1:-1,i&&console.log("[simple] auto fillSign=",b,"largest signed area=",T)}const w=N.map((R,U)=>({idx:U,ring:R,signedArea:Lt(R),absArea:Math.abs(Lt(R))}));for(const R of w)R.isFilled=R.signedArea*b>0,i&&console.log("[simple] ring",R.idx,"signedArea=",R.signedArea.toExponential(),"isFilled=",R.isFilled);const v=w.filter(R=>R.isFilled).sort((R,U)=>R.absArea-U.absArea),B=w.filter(R=>!R.isFilled).sort((R,U)=>U.absArea-R.absArea);for(const R of v)R.holes=[];for(const R of B){const U=(function(T){let Q=0,V=0;if(!T||T.length===0)return[0,0];for(const $ of T)$&&(Q+=$[0]??0,V+=$[1]??0);return[Q/T.length,V/T.length]})(R.ring);let O=null;for(const T of v)Zl(U,T.ring)&&(O===null||T.absArea<O.absArea&&T.idx<R.idx||T.absArea>O.absArea&&T.idx<R.idx&&B.length==1)&&(O=T);if(O){if(O.absArea<R.absArea&&B.length>1)for(const T of v)Zl(U,T.ring)&&T.absArea>R.absArea&&T.holes.push(R.ring);else O.holes.push(R.ring);R.assigned=!0}else R.assigned=!1,i&&console.log("[simple] hole not assigned idx=",R.idx)}for(const R of v){const U=ro(R.ring.slice()),O=(R.holes||[]).map(T=>v0(T.slice()));y.push(ao([U,...O],n))}for(const R of B)R.assigned||y.push(ao([ro(R.ring.slice())],n));if(v.length===0)for(const R of w)y.push(ao([ro(R.ring.slice())],n))}return{type:"FeatureCollection",features:y}}class x0 extends et{constructor(e,t){super(e,t),this.type="label",this._centerCoord=null,this._plotInstance=this,this.fontUrl="https://leiting.chenxisoft.com/resource/font/HanaMinA.ttf",this.labelText="点击编辑文本",this.fontSize=10,this.color="#ff0000",this.polygonEntities=[],t&&(this.fontSize=t.fontSize||this.fontSize,this.color=t.color||this.color,this.labelText=t.text||this.labelText)}start(e){this.startCreate(e)}startCreate(e){try{this.state="creating",this.forbidDrawWorld(!0);const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,i=this;if(!t){console.error("无法获取Cesium对象");return}this.handler&&this.handler.destroy(),this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(s){if(!s||!s.position)return;let o=i.getCatesian3FromPX(s.position);o&&(i.positions=[o],i._centerCoord=o,i.createLabel(o,function(){i.endCreate(e)}))},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(s){if(!s||!s.position)return;i.getCatesian3FromPX(s.position)&&i.state},t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(s){!s||!s.position||i.endCreate()},t.ScreenSpaceEventType.RIGHT_CLICK)}catch(t){console.error("启动创建标签功能时出错:",t),e&&e(null)}}createLabel(e,t){const i=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,s=this;if(!e){console.error("创建标签时位置参数无效"),t&&t();return}if(!i){console.error("创建标签时无法获取Cesium对象"),t&&t();return}this.clearPolygonEntities(),w0(this.fontUrl,(o,r)=>{try{if(o){console.error("加载字体失败:",o),t&&t();return}const l=i.Cartographic.fromCartesian(e),a=i.Math.toDegrees(l.longitude),c=i.Math.toDegrees(l.latitude),u={type:"Feature",geometry:{type:"Point",coordinates:[a,c]},properties:{text:s.labelText||"",rotation:0}},h={sampleSegments:16,fontSize:s.fontSize,scale:10},f=I0(u,r,h);if(!f||!f.features||!Array.isArray(f.features)){console.error("文本转换为多边形失败"),t&&t();return}s.drawGeoJsonLocal(f,[a,c],1,r),s.entity={_centerCoord:s._centerCoord,_plotInstance:s._plotInstance,position:e,label:{text:s.labelText},updatePosition:function(p){s.updatePositions([p])},getPosition:function(){return s._centerCoord},type:s.type,objId:s.objId,isDraggable:!0,setPosition:function(p){s._centerCoord=p,s.positions[0]=p,s.createLabel(p)}},s.addClickEditHandler(),t&&t()}catch(l){console.error("创建文本标签时发生错误:",l);try{s.clearPolygonEntities()}catch(a){console.error("清理标签多边形实体时出错:",a)}t&&t()}})}drawGeoJsonLocal(e,t,i=1,s){try{const o=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!e||!t||!Array.isArray(t)||t.length!==2){console.error("drawGeoJsonLocal: 参数无效");return}const r=t[0],l=t[1],a=o.Cartesian3.fromDegrees(r,l,0),c=o.Transforms.eastNorthUpToFixedFrame(a),u=i*1;this.clearPolygonEntities();let h=[];for(const I of e.features||[]){if(!I||!I.geometry||I.geometry.type!=="Polygon")continue;const M=I.geometry.coordinates||[];for(const k of M)k&&Array.isArray(k)&&(h=h.concat(k))}let f=1/0,p=1/0,A=-1/0,C=-1/0;for(const I of h)Array.isArray(I)&&I.length>=2&&(f=Math.min(f,I[0]),p=Math.min(p,I[1]),A=Math.max(A,I[0]),C=Math.max(C,I[1]));const m=(f+A)/2,y=(p+C)/2,E=I=>{const M=(I[0]-m)*u,k=(I[1]-y)*u,S=new o.Cartesian3(M,k,0);return o.Matrix4.multiplyByPoint(c,S,new o.Cartesian3)};for(const I of e.features||[]){if(!I||!I.geometry||I.geometry.type!=="Polygon")continue;const M=I.geometry.coordinates||[];if(M.length>0)try{const k=M[0]||[];if(k.length===0)continue;const S=k.map(E);let x;if(M.length>1){const F=M.slice(1).map(D=>!D||!Array.isArray(D)||D.length===0?null:new o.PolygonHierarchy(D.map(E))).filter(Boolean);x=new o.PolygonHierarchy(S,F)}else x=new o.PolygonHierarchy(S);const g=this.viewer.entities.add({polygon:{hierarchy:x,material:o.Color.fromCssColorString(this.color||"#000000"),outline:!1},_labelOwner:this.objId});this.polygonEntities.push(g)}catch(k){console.warn("创建多边形实体时出错:",k);continue}}}catch(o){console.error("drawGeoJsonLocal: 发生错误:",o)}}clearPolygonEntities(){for(let e of this.polygonEntities)this.viewer.entities.remove(e);this.polygonEntities=[]}addClickEditHandler(){const e=this,t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("添加点击编辑事件时无法获取Cesium对象");return}this.editHandler&&(this.editHandler.destroy(),this.editHandler=null),this.editHandler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.editHandler.setInputAction(function(i){if(!i||!i.position)return;const s=e.viewer.scene.pick(i.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(i.preventDefault(),e.editText())},t.ScreenSpaceEventType.LEFT_CLICK),this.editHandler.setInputAction(function(i){if(!i||!i.position)return;const s=e.viewer.scene.pick(i.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(i.preventDefault(),e.openStyleEditor())},t.ScreenSpaceEventType.RIGHT_CLICK)}editText(){const e=this;(function(i,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="500px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const l=document.createElement("h3");l.textContent="编辑文本",l.style.marginTop="0";const a=document.createElement("textarea");a.value=i,a.style.width="100%",a.style.height="150px",a.style.marginBottom="10px",a.style.fontSize="14px",a.style.padding="8px",a.style.boxSizing="border-box";const c=document.createElement("div");c.style.display="flex",c.style.justifyContent="flex-end",c.style.gap="10px";const u=document.createElement("button");u.textContent="取消",u.addEventListener("click",function(){document.body.removeChild(o),s(null)});const h=document.createElement("button");h.textContent="确认",h.addEventListener("click",function(){document.body.removeChild(o),s(a.value)}),c.appendChild(u),c.appendChild(h),r.appendChild(l),r.appendChild(a),r.appendChild(c),o.appendChild(r),document.body.appendChild(o),a.focus();const f=function(p){p.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",f),s(null))};document.addEventListener("keydown",f)})(this.labelText,function(i){i!==null&&(e.labelText=i||"点击编辑文本",e._centerCoord&&e.createLabel(e._centerCoord))})}endCreate(e){try{this.state="endCreate",this.handler&&(this.handler.destroy(),this.handler=null),this.forbidDrawWorld(!1),this.entity&&!this.entity.objId&&(this.entity.objId=this.objId),e&&e(this.entity)}catch(t){console.error("结束创建标签时出错:",t),e&&e(null)}}updatePositions(e){try{if(!e||!e.length){console.warn("更新标签位置时参数无效");return}if(!(window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium)){console.error("更新标签位置时无法获取Cesium对象");return}this.positions=e,this._centerCoord=e[0],this.entity&&(this.entity.position=e[0]),this.createLabel(e[0])}catch(t){console.error("更新标签位置时出错:",t)}}moveEntity(e){try{const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("移动实体时无法获取Cesium对象");return}if(!e||!this._centerCoord)return;const i=t.Cartesian3.add(this._centerCoord,e,new t.Cartesian3);this.updatePositions([i])}catch(t){console.error("移动实体时出错:",t)}}setStyle(e){e&&(e.color&&(this.color=e.color),e.fontSize&&(this.fontSize=e.fontSize),e.text!==void 0&&(this.labelText=e.text),this._centerCoord&&this.createLabel(this._centerCoord))}openStyleEditor(){const e=this;(function(i,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="400px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const l=document.createElement("h3");l.textContent="编辑样式",l.style.marginTop="0";const a=document.createElement("div");a.style.marginBottom="15px";const c=document.createElement("label");c.textContent="文本颜色: ",c.style.display="block",c.style.marginBottom="5px";const u=document.createElement("input");u.type="color",u.value=i.color,u.style.width="50px",a.appendChild(c),a.appendChild(u);const h=document.createElement("div");h.style.marginBottom="15px";const f=document.createElement("label");f.textContent="字体大小: ",f.style.display="block",f.style.marginBottom="5px";const p=document.createElement("input");p.type="number",p.value=i.fontSize,p.min="8",p.max="200",p.step="1",p.style.width="100%",p.style.padding="5px",p.style.boxSizing="border-box",h.appendChild(f),h.appendChild(p);const A=document.createElement("div");A.style.display="flex",A.style.justifyContent="flex-end",A.style.gap="10px",A.style.marginTop="20px";const C=document.createElement("button");C.textContent="取消",C.addEventListener("click",function(){document.body.removeChild(o),s(null)});const m=document.createElement("button");m.textContent="确认",m.addEventListener("click",function(){document.body.removeChild(o),s({color:u.value,fontSize:parseInt(p.value)})}),A.appendChild(C),A.appendChild(m),r.appendChild(l),r.appendChild(a),r.appendChild(h),r.appendChild(A),o.appendChild(r),document.body.appendChild(o);const y=function(E){E.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",y),s(null))};document.addEventListener("keydown",y)})(this.getStyle(),function(i){i&&e.setStyle(i)})}getStyle(){return{color:this.color,fontSize:this.fontSize,text:this.labelText}}destroy(){try{try{this.clearPolygonEntities()}catch(e){console.warn("清理标签多边形实体时出错:",e)}if(this.handler){try{this.handler.destroy()}catch(e){console.warn("销毁事件处理器时出错:",e)}this.handler=null}if(this.editHandler){try{this.editHandler.destroy()}catch(e){console.warn("销毁编辑事件处理器时出错:",e)}this.editHandler=null}this._centerCoord=null,this._plotInstance=null,this.entity=null,this.positions=null,this.objId=null;try{super.destroy()}catch(e){console.warn("调用父类destroy方法时出错:",e)}}catch(e){console.error("销毁CreateLabel对象时发生错误:",e)}}syncFromEntity(){this.entity&&this.entity.position&&(this._centerCoord=this.entity.position,this._plotInstance=this)}getEntityPositions(){return this.positions}calculateCenter(){return this._centerCoord}}class B0 extends et{constructor(e,t){super(e,t),this.type="point",this.viewer=e;let i={color:Cesium.Color.AQUA,pixelSize:10,outlineWidth:1};this.style=Object.assign(i,t||{}),this.position=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer);s&&(t.entity=t.createPoint(s),t.position=s,t.handler&&(t.handler.destroy(),t.handler=null),t.prompt&&(t.prompt.destroy(),t.prompt=null),t.state="endCreate",e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){t.prompt.update(i.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=e instanceof Cesium.Cartesian3?e:Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]);this.position=i,i&&(this.entity=this.createPoint(i),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(e){if(e.color){let t=Cesium.Color.fromCssColorString(e.color||"#ffff00");t=t.withAlpha(e.colorAlpha),this.entity.point.color=t}if(this.entity.point.outlineWidth=Number(e.outlineWidth),e.outlineColor){let t=Cesium.Color.fromCssColorString(e.outlineColor||"#000000");t=t.withAlpha(e.outlineColorAlpha),this.entity.point.outlineColor=t}this.entity.point.heightReference=Number(e.heightReference),this.entity.point.pixelSize=Number(e.pixelSize),this.style=Object.assign(this.style,e)}}getStyle(){let e={},t=this.entity.point,i=t.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString(),e.outlineWidth=t.outlineWidth._value;let s=t.outlineColor.getValue();return e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString(),t.heightReference!=null&&(e.heightReference=t.heightReference.getValue()),e.pixelSize=Number(t.pixelSize),e}getPositions(e){return e?ce.cartesianToLnglat(this.position):this.position}getLnglats(){return this.getPositions(!0)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,i;this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(i=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!i)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o,t.state="editing"),e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){i&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null,t.state="editing"))},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createPoint(e){if(!e)return;let t=this.viewer.entities.add({position:e,point:{color:this.style.color instanceof Cesium.Color?this.style.color:this.style.color?Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE,outlineColor:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:this.style.outlineColor?Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1):Cesium.Color.BLACK,outlineWidth:this.style.outlineWidth||4,pixelSize:this.style.pixelSize||20,disableDepthTestDistance:Number.MAX_VALUE}});return t.objId=this.objId,t}}class S0 extends et{constructor(e,t){super(e,t),this.type="polygon",this.viewer=e,this.entity=null,this.polyline=null;let i={outlineColor:"#000000",outlineWidth:2};this.style=Object.assign(i,t||{}),this.outline=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer,[]);if(!s||(t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.some(l=>Math.abs(l.x-s.x)<1e-6&&Math.abs(l.y-s.y)<1e-6&&Math.abs(l.z-s.z)<1e-6)))return;t.positions.push(s);let r=t.createPoint(s);r.wz=t.positions.length-1,t.controlPoints.push(r)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(t.positions.length<1){t.prompt.update(i.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt&&t.prompt.update(i.endPosition,"双击结束,右键取消上一步");let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);t.positions.length>=1&&(t.state="creating",t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.polyline)||(t.polyline=t.createPolyline())),t.positions.length==3&&(Cesium.defined(t.entity)||(t.entity=t.createPolygon(t.style),!t.style.outline&&t.polyline&&(t.polyline.show=!1),t.entity.objId=t.objId)))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==2&&t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null,t.polyline&&(t.polyline.show=!0)),t.positions.length==1&&(t.polyline&&(t.viewer.entities.remove(t.polyline),t.polyline=null),t.prompt&&t.prompt.update(i.endPosition,"单击开始绘制"),t.positions=[],t.movePush=!1))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(i){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.movePush=!1,e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(i){this.entity=this.createPolygon(),this.polyline=this.createPolyline(),this.polyline.show=this.style.outline,this.positions=i;for(let s=0;s<i.length;s++){let o=i[s],r=Cesium.Cartographic.fromCartesian(i[s]),l=this.createPoint(o);l.point.heightReference=this.style.heightReference,l.ctgc=r,l.wz=this.controlPoints.length,this.controlPoints.push(l)}this.state="endCreate",this.entity.objId=this.objId,t&&t(this.entity)}}getStyle(){if(!this.entity)return;let e={},t=this.entity.polygon;if(t.material instanceof Cesium.ColorMaterialProperty){e.material="common";let s=t.material.color.getValue();e.colorAlpha=s.alpha,e.color=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}if(e.fill=t.fill?t.fill.getValue():!1,t.heightReference){let s=t.heightReference.getValue();e.heightReference=Number(s)}let i=this.polyline.polyline;if(i&&this.polyline.show){e.outlineWidth=i.width.getValue(),e.outline=!0;let s=i.material.color.getValue();e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}else e.outline=!1;return e}setStyle(e){if(!e)return;this.polyline.show=e.outline;let t=this.polyline.polyline;t.width=e.outlineWidth,this.polyline.clampToGround=!!e.heightReference;let s=(e.outlineColor instanceof Cesium.Color?e.outlineColor:Cesium.Color.fromCssColorString(e.outlineColor)).withAlpha(e.outlineColorAlpha||1);t.material=s,e.heightReference!=null&&(this.entity.polygon.heightReference=Number(e.heightReference));let r=(e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color)).withAlpha(e.colorAlpha||1);this.entity.polygon.material=r,e.fill!=null&&(this.entity.polygon.fill=e.fill),this.style=Object.assign(this.style,e)}createPolygon(){let e=this;this.style.color=this.style.color||Cesium.Color.WHITE,this.style.outlineColor=this.style.outlineColor||Cesium.Color.BLACK;let t={polygon:{hierarchy:new Cesium.CallbackProperty(function(){return new Cesium.PolygonHierarchy(e.positions)},!1),heightReference:Number(this.style.heightReference),show:!0,fill:this.style.fill==null?!0:this.style.fill,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1)}};return this.style.heightReference||(t.polygon.height=0,t.polygon.perPositionHeight=!0),this.viewer.entities.add(t)}createPolyline(){let e=this;return this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions.concat(e.positions[0])},!1),clampToGround:!!this.style.heightReference,material:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1),width:this.style.outlineWidth||1}})}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.polyline&&(this.viewer.entities.remove(this.polyline),this.polyline=null),this.positions=[],this.style=null,this.modifyPoint&&(this.viewer.entities.remove(this.modifyPoint),this.modifyPoint=null);for(let e=0;e<this.controlPoints.length;e++){let t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.state="no",this.prompt&&this.prompt.destroy(),this.polyline&&(this.polyline=null,this.viewer.entities.remove(this.polyline)),this.forbidDrawWorld(!1)}}class M0 extends et{constructor(e,t){super(e,t),this.type="rectangle",this.viewer=e,this.style=t||{},this.leftup=null,this.rightdown=null,this.leftdownPoint=null,this.rightupPoint=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(i){const s=t.getCatesian3FromPX(i.position,t.viewer,[]);if(s)if(t.entity)t.endCreate(),e&&e(t.entity);else{t.leftup=s.clone(),t.rightdown=s.clone(),t.entity=t._createPolyline();const o=t._calcCornerCartesian("leftdown"),r=t._calcCornerCartesian("rightup");t.leftdownPoint=t.createPoint(o),t.leftdownPoint.typeAttr="leftdown",t.leftdownPoint.show=!1,t.rightupPoint=t.createPoint(r),t.rightupPoint.typeAttr="rightup",t.rightupPoint.show=!1}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(!t.entity){t.prompt?.update(i.endPosition,"单击开始绘制");return}t.prompt?.update(i.endPosition,"单击结束");const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[]);s&&(t.rightdown=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.leftdownPoint&&(this.leftdownPoint.show=!0),this.rightupPoint&&(this.rightupPoint.show=!0),this.modifyHandler.setInputAction(function(i){const s=t.viewer.scene.pick(i.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(i.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(i){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="leftdown"?t._dragCorner(s,"leftdown"):t.modifyPoint.typeAttr==="rightup"&&t._dragCorner(s,"rightup"),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildRectPositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildRectPositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildRectPositions(){if(!this.leftup||!this.rightdown)return[];const e=this._calcCornerCartesian("leftdown"),t=this.leftup,i=this._calcCornerCartesian("rightup"),s=this.rightdown;return[e,s,i,t,e]}_calcCornerCartesian(e){const t=Cesium.Ellipsoid.WGS84,i=t.cartesianToCartographic(this.leftup),s=t.cartesianToCartographic(this.rightdown),o=Math.min(i.longitude,s.longitude),r=Math.max(i.longitude,s.longitude),l=Math.min(i.latitude,s.latitude),a=Math.max(i.latitude,s.latitude);if(e==="leftdown")return Cesium.Cartesian3.fromRadians(o,l);if(e==="rightup")return Cesium.Cartesian3.fromRadians(r,a)}_updateAuxPoints(){if(!this.leftup||!this.rightdown)return;const e=this._calcCornerCartesian("leftdown"),t=this._calcCornerCartesian("rightup");this.leftdownPoint&&(this.leftdownPoint.position=e),this.rightupPoint&&(this.rightupPoint.position=t)}_dragCorner(e,t){const i=Cesium.Ellipsoid.WGS84,s=i.cartesianToCartographic(this.leftup),o=i.cartesianToCartographic(this.rightdown);let r=Math.min(s.longitude,o.longitude),l=Math.max(s.longitude,o.longitude),a=Math.min(s.latitude,o.latitude),c=Math.max(s.latitude,o.latitude);const u=i.cartesianToCartographic(e);t==="leftdown"?(r=u.longitude,a=u.latitude):(l=u.longitude,c=u.latitude),this.leftup=Cesium.Cartesian3.fromRadians(r,c),this.rightdown=Cesium.Cartesian3.fromRadians(l,a)}syncFromEntity(){if(!this.entity||!this.leftup||!this.rightdown)return;const e=Cesium.Cartesian3.midpoint(this.leftup,this.rightdown,new Cesium.Cartesian3),t=this.entity._centerCoord;if(!t)return;const i=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.leftup=new Cesium.Cartesian3(this.leftup.x+i,this.leftup.y+s,this.leftup.z+o),this.rightdown=new Cesium.Cartesian3(this.rightdown.x+i,this.rightdown.y+s,this.rightdown.z+o);const r=this.entity.objId,l=this.entity._plotInstance;this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=l,this.entity.objId=r;const a=this._calcCornerCartesian("leftdown"),c=this._calcCornerCartesian("rightup");this.leftdownPoint=this.createPoint(a),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=this.state==="editing",this.rightupPoint=this.createPoint(c),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.leftup||!this.rightdown)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.leftup=Cesium.Cartesian3.add(this.leftup,t,new Cesium.Cartesian3),this.rightdown=Cesium.Cartesian3.add(this.rightdown,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update rectangle positions:",t),!1}}getPositions(e){return e?ce.cartesiansToLnglats([this.leftup,this.rightdown],this.viewer):[this.leftup,this.rightdown]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let i=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(i=i.withAlpha(t.colorAlpha)),this.entity.polyline.material=i,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.prompt?.destroy(),this.prompt=null}catch{}}createByPositions(e,t){if(!e||e.length<2)return!1;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length<2)return!1;if(i.length===2)this.leftup=Cesium.Cartesian3.clone(i[0]),this.rightdown=Cesium.Cartesian3.clone(i[1]);else if(i.length>=4){let s=1/0,o=1/0,r=-1/0,l=-1/0;i.forEach(a=>{const c=Cesium.Ellipsoid.WGS84.cartesianToCartographic(a);c&&(s=Math.min(s,c.longitude),o=Math.min(o,c.latitude),r=Math.max(r,c.longitude),l=Math.max(l,c.latitude))}),this.leftup=Cesium.Cartesian3.fromRadians(s,l),this.rightdown=Cesium.Cartesian3.fromRadians(r,o)}if(this.entity?this._updatePolyline():this.entity=this._createPolyline(),!this.leftdownPoint){const s=this._calcCornerCartesian("leftdown");this.leftdownPoint=this.createPoint(s),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=!1}if(!this.rightupPoint){const s=this._calcCornerCartesian("rightup");this.rightupPoint=this.createPoint(s),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=!1}this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),!0}}class T0 extends et{constructor(e,t){super(e,t),t=t||{},this.movePush=!1,this.type="polyline",this.maxPointNum=t.maxPointNum||Number.MAX_VALUE}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],i=this.createPoint(t);this.style.clampToGround&&(i.point.heightReference=1),i.wz=this.controlPoints.length,this.controlPoints.push(i)}}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new At(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(i){let s=t.getCatesian3FromPX(i.position,t.viewer,[t.entity]);if(!s)return;t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.push(s);let o=t.createPoint(s);o.wz=t.positions.length-1,t.controlPoints.push(o),t.positions.length==t.maxPointNum&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(i){if(t.state="creating",t.positions.length<1){t.prompt.update(i.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt.update(i.endPosition,"右键取消上一步,双击结束");let s=t.getCatesian3FromPX(i.endPosition,t.viewer,[t.entity]);s&&(t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.entity)||(t.entity=t.createPolyline())))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==1&&(t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null),t.prompt.update(i.endPosition,"单击开始绘制"),t.movePush=!1,t.positions=[]))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(i){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.positions.pop(),e.viewer.entities.remove(e.controlPoints.pop()),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e||e.length<1)return;this.state="startCreate";let i=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);if(i){this.entity=this.createPolyline(this.style),this.positions=i,t&&t(this.entity);for(let s=0;s<i.length;s++){let o=i[s],r=this.createPoint(o);this.style.clampToGround&&(r.point.heightReference=1),r.wz=this.controlPoints.length,this.controlPoints.push(r)}this.state="endCreate"}}setStyle(e){if(!e)return;let t=this.getMaterial(e.material,e);this.entity.polyline.material=t,this.entity.polyline.clampToGround=!!e.clampToGround,e.width&&(this.entity.polyline.width=e.width||3),this.style=Object.assign(this.style,e)}getStyle(){if(!this.entity)return;let e={},t=this.entity.polyline;this.style.animateType!=null&&(e.animateType=this.style.animateType,e.image=this.style.image,e.duration=this.style.duration),t.material instanceof Cesium.ColorMaterialProperty?e.material="common":(e.material="flowline",t.material instanceof animate.FlowLineMaterial,e.duration=t.material._duration,e.image=t.material.url);let i=t.material.color.getValue();e.colorAlpha=i.alpha,e.color=new Cesium.Color(i.red,i.green,i.blue,1).toCssHexString(),e.width=t.width._value;let s=t.clampToGround?t.clampToGround.getValue():!1;return e.clampToGround=!!s,e}createPolyline(){let e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions},!1),show:!0,material:this.getMaterial(this.style.animateType,this.style),width:this.style.width||3,clampToGround:this.style.clampToGround}});return t.objId=this.objId,t}getMaterial(e,t){t=t||{};let i=null,s=t.color||Cesium.Color.WHITE;return s=s instanceof Cesium.Color?s:Cesium.Color.fromCssColorString(t.color),s=s.withAlpha(t.colorAlpha||1),e=="flowline"||e=="flyline"||(i=s),i}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],i=this.createPoint(t);this.style.clampToGround&&(i.point.heightReference=1),i.wz=this.controlPoints.length,this.controlPoints.push(i)}}getPositions(e){return e?util.cartesiansToLnglats(this.positions,this.viewer):this.positions}}class D0 extends et{constructor(e,t={}){super(e,t),this.type="freehandLine",this.maxPositions=t.maxPositions||1e4,this.minDistance=t.minDistance||2,this.renderInterval=t.renderInterval||30,this.style=Object.assign({smoothness:2,angleThreshold:3,curveResolution:3},t||{}),this.positions=[],this._stagingBuffer=[],this._flushScheduled=!1,this._flushRAF=null,this._lastFlushTime=0,this.isDrawing=!1,this.handler=null,this.startPointEntity=null,this.entity=null,this.lastAddPosition=null}start(e){if(this.state==="creating"||this.state==="startCreate")return;if(this.state="startCreate",this.positions=[],this._stagingBuffer.length=0,this._lastFlushTime=0,this.isDrawing=!1,this.lastAddPosition=null,this._cancelFlush(),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>Oa).then(({default:i})=>{this.prompt=new i(this.viewer,this.promptStyle)}),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.entity=this.createFreehandLine();const t=this;this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(i){t.state="creating",t.isDrawing=!0,t.forbidDrawWorld(!0),t.positions=[],t._stagingBuffer.length=0,t.lastAddPosition=null;let s=t._fastPick(i.position);if(!s){t.isDrawing=!1;return}const o=Cesium.Cartesian3.clone(s);if(t._pushToStaging(o),t.lastAddPosition=o,t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t.startPointEntity=t.viewer.entities.add({position:o,point:{pixelSize:6,color:Cesium.Color.RED,outlineColor:Cesium.Color.WHITE,outlineWidth:1}}),t._scheduleFlush(!0)},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(i){if(!t.isDrawing){t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"单击开始绘制");return}if(t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"松键结束"),!i||!i.endPosition||t.positions.length+t._stagingBuffer.length>=t.maxPositions)return;let s=t._fastPick(i.endPosition);if(!s||t.lastAddPosition&&Cesium.Cartesian3.distance(t.lastAddPosition,s)<=t.minDistance)return;const o=Cesium.Cartesian3.clone(s);t._pushToStaging(o),t.lastAddPosition=o,t._scheduleFlush()},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(i){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction(function(i){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.RIGHT_DOWN)}_pushToStaging(e){this._stagingBuffer.push(e)}_scheduleFlush(e=!1){if(this._flushRAF){e&&(this._forceImmediate=!0);return}this._forceImmediate=e||!1;const t=this,i=function(){t._flushRAF=null;const s=performance.now();(t._forceImmediate||s-t._lastFlushTime>=t.renderInterval)&&(t._flushToPositions(),t._lastFlushTime=s),t._forceImmediate=!1};this._flushRAF=requestAnimationFrame(i)}_cancelFlush(){if(this._flushRAF){try{cancelAnimationFrame(this._flushRAF)}catch{}this._flushRAF=null}this._forceImmediate=!1}_fastPick(e){if(this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){const i=this.viewer.camera.getPickRay(e);let s=null;return i&&(s=this.viewer.scene.globe.pick(i,this.viewer.scene)),s||(s=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),s}let t=null;try{t=this.viewer.scene.pickPosition(e)}catch{}if(!t){const i=this.viewer.camera.getPickRay(e);i&&(t=this.viewer.scene.globe.pick(i,this.viewer.scene))}return t}_flushToPositions(){if(!this._stagingBuffer||this._stagingBuffer.length===0)return;const e=this._stagingBuffer;this._stagingBuffer=[];const t=Math.max(0,Math.min(2,Number(this.style.smoothness||1)));let i=e;if(t>0){const l=(u,h)=>{if(!u||u.length<2)return u;h=Math.max(1,h|0);const f=[u[0]],p=u.length;for(let A=0;A<p-1;A++){const C=A>0?u[A-1]:u[A],m=u[A],y=u[A+1],E=A+2<p?u[A+2]:u[A+1];for(let I=1;I<h;I++){const M=I/h,k=M*M,S=k*M,x=-.5*C.x+1.5*m.x-1.5*y.x+.5*E.x,g=-.5*C.y+1.5*m.y-1.5*y.y+.5*E.y,F=-.5*C.z+1.5*m.z-1.5*y.z+.5*E.z,D=C.x-2.5*m.x+2*y.x-.5*E.x,P=C.y-2.5*m.y+2*y.y-.5*E.y,L=C.z-2.5*m.z+2*y.z-.5*E.z,G=-.5*C.x+.5*y.x,N=-.5*C.y+.5*y.y,b=-.5*C.z+.5*y.z,w=m.x,v=m.y,B=m.z,R=x*S+D*k+G*M+w,U=g*S+P*k+N*M+v,O=F*S+L*k+b*M+B;f.push(new Cesium.Cartesian3(R,U,O))}f.push(y)}return f},a=Math.max(1,Number(this.style.curveResolution)||1);i.length<200&&a>1&&(i=l(i,a));const c=u=>{if(!u||u.length<2)return u;const h=[];h.push(u[0]);for(let f=0;f<u.length-1;f++){const p=u[f],A=u[f+1],C=new Cesium.Cartesian3(p.x*.75+A.x*.25,p.y*.75+A.y*.25,p.z*.75+A.z*.25),m=new Cesium.Cartesian3(p.x*.25+A.x*.75,p.y*.25+A.y*.75,p.z*.25+A.z*.75);h.push(C),h.push(m)}return h.push(u[u.length-1]),h};i=i.slice(),i.length<300&&(i=c(i),t===2&&i.length<300&&(i=c(i)))}const s=(Number(this.style.angleThreshold)||6)*(Math.PI/180),o=this.positions,r=(l,a,c,u)=>{if(!l||!a||!c)return!1;const h=a.x-l.x,f=a.y-l.y,p=a.z-l.z,A=c.x-a.x,C=c.y-a.y,m=c.z-a.z,y=Math.hypot(h,f,p),E=Math.hypot(A,C,m);if(y===0||E===0)return!1;const I=(h*A+f*C+p*m)/(y*E),M=Math.max(-1,Math.min(1,I)),k=Math.acos(M);return Math.abs(k)<=u};for(let l=0;l<i.length;l++){const a=i[l];if(o.length===0){o.push(Cesium.Cartesian3.clone(a));continue}const c=o[o.length-1];if(!(Cesium.Cartesian3.distance(c,a)<=this.minDistance*.5)){if(o.length>=2){const h=o[o.length-2],f=o[o.length-1],p=a;if(r(h,f,p,s)){o.pop(),o.push(Cesium.Cartesian3.clone(p));continue}}if(o.push(Cesium.Cartesian3.clone(a)),o.length>this.maxPositions){const h=o.length-this.maxPositions;h>0&&o.splice(0,h)}}}try{this.viewer.scene.requestRender()}catch{}}endCreate(e){if(this.state==="endCreate")return;if(this.state="endCreate",this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._flushToPositions(),this._cancelFlush(),!this.positions||this.positions.length<2){if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}e&&e(null);return}const t=this.positions.map(i=>Cesium.Cartesian3.clone(i));this.positions=t;try{this.viewer.scene.requestRender()}catch{}e&&e(this.entity)}done(e){this.isDrawing&&(this.isDrawing=!1,this.forbidDrawWorld(!1),this.endCreate(e))}createFreehandLine(){const e=this,t=this.getMaterial(this.style.animateType,this.style),i=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions||[]},!1),show:!0,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1}});return i.objId=this.objId||null,this.entity=i,i}getMaterial(e,t){t=t||{};try{let i=t.color||Cesium.Color.RED;typeof i=="string"&&(i=Cesium.Color.fromCssColorString(i));const s=t.colorAlpha!==void 0?t.colorAlpha:1;return i=i.withAlpha(s),i}catch{return Cesium.Color.RED}}updatePositions(e){if(!e||e.length<1)return!1;try{let t=[];if(e[0]instanceof Cesium.Cartesian3?t=e.map(i=>Cesium.Cartesian3.clone(i)):t=ce&&ce.lnglatsToCartesians?ce.lnglatsToCartesians(e):e,!t||t.length===0)return!1;this.positions=t.map(i=>Cesium.Cartesian3.clone(i)),this._stagingBuffer.length=0;try{this.viewer.scene.requestRender()}catch{}return!0}catch{return!1}}setStyle(e){if(!e||(this.style=Object.assign(this.style||{},e),!this.entity||!this.entity.polyline))return;const t=this.getMaterial(this.style.animateType,this.style);try{this.entity.polyline.material=t}catch{}if(e.width!==void 0)try{this.entity.polyline.width=e.width}catch{}if(e.clampToGround!==void 0)try{this.entity.polyline.clampToGround=!!e.clampToGround}catch{}}createByPositions(e,t){if(!e||e.length<1)return!1;const i=e[0]instanceof Cesium.Cartesian3?e:ce.lnglatsToCartesians(e);if(!i||i.length<1)return!1;this.positions=i.map(s=>Cesium.Cartesian3.clone(s)),this.entity||this.createFreehandLine(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch{}return t&&t(this.entity),!0}destroy(){if(this._cancelFlush(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.positions=[],this._stagingBuffer=[],this.isDrawing=!1;try{this.endCreate()}catch{}}}class k0 extends et{constructor(e,t={}){if(!e)throw new Error("CreateArrow requires viewer");if(super(e,t),this.type="arrow",this.style=t||{},this.arrowAngle=t.arrowAngle||Math.PI/6,this.positions=[],this.lineEntity=null,this.arrowEntity=null,this.controlPoints=[],this.handler=null,this._finalized=!1,this._editRenderHandler=null,this.Cesium=this._getCesium(),!this.Cesium)throw new Error("Cesium not found")}_getCesium(){return typeof window<"u"&&window.Cesium?window.Cesium:typeof Cesium<"u"?Cesium:this.viewer&&this.viewer.constructor&&this.viewer.constructor.Cesium?this.viewer.constructor.Cesium:null}start(e){if(!this.viewer||!this.Cesium)return e&&e(null),this;if(this.state==="creating"||this.state==="startCreate")return this;this.state="startCreate",this._cleanup(!1),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>Oa).then(({default:i})=>{this.prompt=new i(this.viewer,this.promptStyle)}).catch(()=>{});try{this.forbidDrawWorld(!0)}catch{}const t=this;return this.handler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(i){if(t.state==="startCreate"){t.state="creating",t._finalized=!1;let s=t.getCatesian3FromPX(i.position);if(!s)return;t.positions=[t.Cesium.Cartesian3.clone(s),t.Cesium.Cartesian3.clone(s)],t._createLineEntity(),t._createArrowEntity(),t._createControlPoints(),t.prompt&&i&&i.position&&t.prompt.update(i.position,"再次单击完成绘制")}else if(t.state==="creating"){if(t.state="endCreate",t._finalized=!0,t._finalizeEntities(),t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(t.entity||t.lineEntity)}try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(i){if(t.state==="startCreate"){t.prompt&&i&&i.endPosition&&t.prompt.update(i.endPosition,"单击开始绘制");return}if(t.state==="creating"){let s=t.getCatesian3FromPX(i.endPosition);if(!s)return;if(t.positions[1]=s,t.controlPoints[1])try{t.controlPoints[1].position.setValue(s)}catch{}try{t.viewer.scene.requestRender()}catch{}}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(){if(t.state==="creating"){if(t.state="endCreate",t._finalized=!1,t.lineEntity){try{t.viewer.entities.remove(t.lineEntity)}catch{}t.lineEntity=null}if(t.arrowEntity){try{t.viewer.entities.remove(t.arrowEntity)}catch{}t.arrowEntity=null}t.controlPoints.length&&(t.controlPoints.forEach(i=>{try{t.viewer.entities.remove(i)}catch{}}),t.controlPoints=[])}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(null)},this.Cesium.ScreenSpaceEventType.RIGHT_DOWN),this}_computeArrowPositions(e,t){if(!e||!t)return[];const i=this.Cesium.Cartesian3.distance(e,t);if(i<=1e-6)return[];const s=this.style.arrowLengthFactor!==void 0?this.style.arrowLengthFactor:.15,o=this.style.arrowMinSize!==void 0?this.style.arrowMinSize:1.5,r=this.style.arrowMaxSize!==void 0?this.style.arrowMaxSize:Number.MAX_VALUE;let l=this.style.arrowFixedSize!==void 0?this.style.arrowFixedSize:i*s;l<o&&(l=o),l>r&&(l=r);const a=this.Cesium.Cartesian3.subtract(t,e,new this.Cesium.Cartesian3);this.Cesium.Cartesian3.normalize(a,a);const c=this.Cesium.Transforms.eastNorthUpToFixedFrame(t),u=this.Cesium.Matrix4.getColumn(c,2,new this.Cesium.Cartesian3),h=new this.Cesium.Cartesian3(a.x-u.x*this.Cesium.Cartesian3.dot(a,u),a.y-u.y*this.Cesium.Cartesian3.dot(a,u),a.z-u.z*this.Cesium.Cartesian3.dot(a,u));let f;this.Cesium.Cartesian3.magnitudeSquared(h)<1e-6?f=this.Cesium.Matrix4.getColumn(c,0,new this.Cesium.Cartesian3):(this.Cesium.Cartesian3.normalize(h,h),f=this.Cesium.Cartesian3.cross(u,h,new this.Cesium.Cartesian3),this.Cesium.Cartesian3.normalize(f,f));const p=this.Cesium.Cartesian3.multiplyByScalar(a,-l,new this.Cesium.Cartesian3),A=this.Cesium.Cartesian3.add(t,p,new this.Cesium.Cartesian3),C=this.style.arrowWidthScale!==void 0?this.style.arrowWidthScale:1,m=Math.sin(this.arrowAngle)*l*C,y=this.Cesium.Cartesian3.multiplyByScalar(f,m,new this.Cesium.Cartesian3),E=this.Cesium.Cartesian3.multiplyByScalar(f,-m,new this.Cesium.Cartesian3),I=this.Cesium.Cartesian3.add(A,y,new this.Cesium.Cartesian3),M=this.Cesium.Cartesian3.add(A,E,new this.Cesium.Cartesian3);return[t,I,M,t]}_createLineEntity(){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}const e=this,t=this._getMaterial(),i=new this.Cesium.CallbackProperty(function(){return!e.positions||e.positions.length<2?[]:[e.positions[0],e.positions[1]]},!1);this.lineEntity=this.viewer.entities.add({polyline:{positions:i,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),this.entity=this.lineEntity}_createArrowEntity(){if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}const e=this,t=this._getMaterial(),i=new this.Cesium.CallbackProperty(function(){if(!e.positions||e.positions.length<2)return[];const s=e.positions[0],o=e.positions[1];return e._computeArrowPositions(s,o)},!1);this.arrowEntity=this.viewer.entities.add({polyline:{positions:i,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),console.log("this.arrowEntity",this.arrowEntity)}_createControlPoints(){if(this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(e=>{try{this.viewer.entities.remove(e)}catch{}}),this.controlPoints=[]),!(!this.positions||this.positions.length<2))for(let e=0;e<2;e++)try{const t=this.createPoint(this.positions[e]);t.wz=e,this.controlPoints.push(t)}catch{}}_finalizeEntities(){if(this.lineEntity&&this.lineEntity.polyline)try{const e=this.Cesium.Cartesian3.clone(this.positions[0]),t=this.Cesium.Cartesian3.clone(this.positions[1]);this.lineEntity.polyline.positions=[e,t]}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const e=this.positions[0],t=this.positions[1];this.arrowEntity.polyline.positions=this._computeArrowPositions(e,t)}catch{}this.entity=this.lineEntity,this.entity&&(this.entity.arrowEntity=this.arrowEntity,this.entity.positions=[this.positions[0],this.positions[1]],this.positions=[this.positions[0],this.positions[1]]);try{this.viewer.scene.requestRender()}catch{}}startEdit(e){super.startEdit(e),(!this.controlPoints||this.controlPoints.length<2)&&this._createControlPoints();for(let t=0;t<this.controlPoints.length;t++)try{this.controlPoints[t].show=!0}catch{}if(this.lineEntity&&this.lineEntity.polyline)try{const t=this;this.lineEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){return!t.positions||t.positions.length<2?[]:[t.positions[0],t.positions[1]]},!1)}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const t=this;this.arrowEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){if(!t.positions||t.positions.length<2)return[];const i=t.positions[0],s=t.positions[1];return t._computeArrowPositions(i,s)},!1)}catch{}if(!this._editRenderHandler){this._editRenderHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);const t=this;this._editRenderHandler.setInputAction(function(i){if(t.modifyPoint)try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE)}}endEdit(e){if(super.endEdit(e),this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}this._finalized=!0,this._finalizeEntities()}createByPositions(e,t){if(!e||e.length<2)return!1;let i=e[0],s=e[1];if(!(i instanceof this.Cesium.Cartesian3))if(Array.isArray(i)&&i.length>=2)i=this.Cesium.Cartesian3.fromDegrees(i[0],i[1]),s=this.Cesium.Cartesian3.fromDegrees(s[0],s[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(i),this.Cesium.Cartesian3.clone(s)],this._createLineEntity(),this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),this.state="endCreate",t&&t(this.entity||this.lineEntity),!0}updatePositions(e){if(!e||e.length<2)return!1;let t=e[0],i=e[1];if(!(t instanceof this.Cesium.Cartesian3))if(Array.isArray(t)&&t.length>=2)t=this.Cesium.Cartesian3.fromDegrees(t[0],t[1]),i=this.Cesium.Cartesian3.fromDegrees(i[0],i[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(t),this.Cesium.Cartesian3.clone(i)],this.lineEntity||this._createLineEntity(),this.arrowEntity||this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),!0}setStyle(e){if(!e)return;this.style=Object.assign(this.style||{},e),e.arrowAngle!==void 0&&(this.arrowAngle=e.arrowAngle);const t=this._getMaterial();if(this.lineEntity&&this.lineEntity.polyline){try{this.lineEntity.polyline.material=t}catch{}if(e.width!==void 0)try{this.lineEntity.polyline.width=e.width}catch{}}if(this.arrowEntity&&this.arrowEntity.polyline)try{this.arrowEntity.polyline.material=t}catch{}}endCreate(e){if(this.state!=="endCreate"){if(this.state="endCreate",this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._finalized=!0,this._finalizeEntities(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}try{this.forbidDrawWorld(!1)}catch{}e&&e(this.entity||this.lineEntity)}}done(e){this.isDrawing&&(this.isDrawing=!1,this.endCreate(e))}getEntity(){return this.entity||this.lineEntity}destroy(){this._cleanup(!0),this.state=null}_cleanup(e=!0){if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}if(e){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(t=>{try{this.viewer.entities.remove(t)}catch{}}),this.controlPoints=[]),this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.positions=[],this.isDrawing=!1,this._finalized=!1;try{this.forbidDrawWorld(!1)}catch{}}_getMaterial(){try{let e=this.style.color||this.Cesium.Color.RED;typeof e=="string"&&(e=this.Cesium.Color.fromCssColorString(e));const t=this.style.colorAlpha!==void 0?this.style.colorAlpha:1;return e.withAlpha(t)}catch{return this.Cesium.Color.RED}}}class P0{constructor(e,t){if(!e){console.warn("缺少必要参数!--viewer");return}if(t=t||{},this.viewer=e,this.Cesium=window.Cesium||window.cesium,this.entityObjArr=[],this.handler=null,!this.Cesium){console.error("Cesium实例未找到!");return}this.removeHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.startEditFun=null,this.endEditFun=null,this.removeFun=null,this.editingFun=void 0,this.deleteEntityObj=null,this.bindEdit(),this.bindRemove(),this.canEdit=t.canEdit==null?!0:t.canEdit,this.fireEdit=t.fireEdit==null?!0:t.fireEdit,this.nowDrawEntityObj=null,this.nowEditEntityObj=null}on(e,t){e=="startEdit"&&(this.startEditFun=t),e=="endEdit"&&(this.endEditFun=t),e=="remove"&&(this.removeFun=t),e=="endCreate"&&(this.endCreateFun=t),e=="editing"&&(this.editingFun=t)}openEdit(){this.canEdit=!0}closeEdit(){this.endEdit(),this.canEdit=!1}start(e){if(!e||!e.type)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this;this.endEdit(),this.nowDrawEntityObj&&(this.nowDrawEntityObj.state=="startCreate"||this.nowDrawEntityObj.state=="creating")&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);let i=this.createByType(e);if(i)return i.attr=e||{},i.start(function(s){t.nowDrawEntityObj=void 0,t.entityObjArr.push(i),e.success&&e.success(i,s),t.endCreateFun&&t.endCreateFun(i,s),e.show==!1&&i.setVisible(!1),t.canEdit&&t.fireEdit&&(i.startEdit(function(){t.editingFun&&t.editingFun(i,i.entity)}),t.nowEditEntityObj=i,t.startEditFun&&t.startEditFun(i,s))}),this.nowDrawEntityObj=i,i}end(){this.nowDrawEntityObj}startEditOne(e){if(!this.canEdit)return;this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);let t=this;e&&(e.startEdit(function(){t.editingFun&&t.editingFun(e,e.entity)}),this.startEditFun&&this.startEditFun(e,e.getEntity()),this.nowEditEntityObj=e)}updateOneStyle(e,t){e&&e.setStyle(t)}createByPositions(e){if(e=e||{},e||(e={}),!e.positions)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this,i=this.createByType(e);if(i)return i.attr=e,i.createByPositions(e.positions,function(s){t.entityObjArr.push(i),i.setStyle(e.style),e.success&&e.success(i,s),t.endCreateFun&&t.endCreateFun(i,s),e.show==!1&&i.setVisible(!1),t.canEdit&&t.fireEdit&&(i.startEdit(function(){t.editingFun&&t.editingFun(i,i.entity)}),t.startEditFun&&t.startEditFun(i,s),t.nowEditEntityObj=i)}),i}createByGeojson(e){let{features:t}=e,i=[];for(let s=0;s<t.length;s++){let o=t[s];const{properties:r,geometry:l}=o;let a=r.plotType;const c=l.type,u=l.coordinates;let h=[],f="";switch(c){case"LineString":h=ce.lnglatsToCartesians(u),f="polyline";break;case"Polygon":h=ce.lnglatsToCartesians(u[0]),f="polygon";break;case"Point":h=ce.lnglatsToCartesians([u])[0],f=a;break}this.fireEdit=!1;let p=this.createByPositions({type:f,styleType:a,positions:h,style:r.style});p&&i.push(p)}return i}toGeojson(){let e={type:"FeatureCollection",features:[]};if(this.entityObjArr.length==0)return null;for(let t=0;t<this.entityObjArr.length;t++){let i=this.entityObjArr[t],s=i.getPositions(!0),o=[];for(let c=0;c<s.length;c++)o.push([s[c][0],s[c][1]]);let r=i.getStyle(),l=this.transType(i.type),a={type:"Feature",properties:{plotType:i.type,style:r},geometry:{type:l,coordinates:[]}};switch(l){case"Polygon":a.geometry.coordinates=[o];break;case"Point":a.geometry.coordinates=o;break;case"LineString":a.geometry.coordinates=o;break}a.properties=Object.assign(a.properties,i.properties),e.features.push(a)}return e}transType(e){let t="";switch(e){case"polyline":t="LineString";break;case"polygon":t="Polygon";break;case"point":case"gltfModel":case"label":case"billboard":t="Point";break;default:t=e}return t}destroy(){this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null),this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null,this.handler&&(this.handler.destroy(),this.handler=null),this.removeHandler&&(this.removeHandler.destroy(),this.removeHandler=null)}removeOne(e){e&&e&&(e.state!="endCreate"||e.state!="endEdit"?e.destroy():this.removeByObjId(e.objId))}removeAll(){this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null),this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null}hasEntityObj(e){return e?this.getEntityObjByObjId(e.objId)!={}:!1}removeByObjId(e){let t=this.getEntityObjByObjId(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}removeById(e){let t=this.getEntityObjById(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}zoomToByObjId(e){let t=this.getEntityObjByObjId(e);t.entityObj&&t.entityObj.zoomTo()}getEntityObjByField(e,t){let i={};if(t)for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr[e]==t){i.entityObj=o,i.index=s;break}}else for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr.id==e){i.entityObj=o,i.index=s;break}}return i}setVisible(e,t){let i=this.getEntityObjByField("id",e);i.entityObj&&i.entityObj.setVisible(t)}getEntityObjByObjId(e){if(!e)return;let t={};for(let i=0;i<this.entityObjArr.length;i++){let s=this.entityObjArr[i];if(s.objId==e){t.entityObj=s,t.index=i;break}}return t}getEntityObjById(e){if(!e)return;let t={};for(let i=0;i<this.entityObjArr.length;i++){let s=this.entityObjArr[i];if(s.attr.id==e){t.entityObj=s,t.index=i;break}}return t}bindEdit(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const i=e.viewer.scene.drillPick(t.position)||[];let s=-1,o;for(let r=0;r<i.length&&s===-1;r++){const l=i[r].id;if(l){for(let a=0;a<e.entityObjArr.length;a++)if(l.objId==e.entityObjArr[a].objId&&e.entityObjArr[a].state!="startCreate"&&e.entityObjArr[a].state!="creating"){s=a,o=l;break}}}s!==-1?(e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=null),e.entityObjArr[s].startEdit(function(){e.editingFun&&e.editingFun(e.nowEditEntityObj,e.nowEditEntityObj.entity)}),e.startEditFun&&e.startEditFun(e.entityObjArr[s],o),e.nowEditEntityObj=e.entityObjArr[s]):e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=void 0)},Cesium.ScreenSpaceEventType.LEFT_CLICK)}bindRemove(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const i=e.viewer.scene.drillPick(t.position)||[];let s;for(let o=0;o<i.length;o++){const r=i[o].id;if(r){for(let l=0;l<e.entityObjArr.length;l++)if(r.objId==e.entityObjArr[l].objId){s=r.objId;break}if(s)break}}s&&e.createDelteDom(t.position,s)},Cesium.ScreenSpaceEventType.RIGHT_CLICK)}createDelteDom(e,t){if(!t)return;let i=window.document.createElement("span");i.style.background="rgba(0,0,0,0.5)",i.style.position="absolute",i.style.color="white",i.style.left=e.x+10+"px",i.style.top=e.y+10+"px",i.style.padding="4px",i.style.cursor="pointer",i.id="easy3d-plot-delete",i.setAttribute("objId",t),i.innerHTML="删除",window.document.getElementById(this.viewer.container.id).appendChild(i);const o=window.document.getElementById("easy3d-plot-delete");if(!o)return;let r=this;o.addEventListener("click",l=>{let a=i.getAttribute("objId");r.removeByObjId(a)}),document.addEventListener("click",function(){o.remove()})}endEdit(){this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].endEdit()}done(){this.nowEditEntityObj&&(this.nowEditEntityObj.done(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=void 0),this.nowDrawEntityObj&&(this.nowDrawEntityObj.done(),this.entityObjArr.push(this.nowDrawEntityObj),this.endCreateFun&&this.endCreateFun(this.nowDrawEntityObj,this.nowDrawEntityObj.getEntity()),this.nowDrawEntityObj=void 0)}getEntityObjArr(){return this.entityObjArr}createByType(e){let t,i="";return e=e||{},e.type=="polyline"&&(t=new T0(this.viewer,e.style),i="折线_"),e.type=="freehandLine"&&(t=new D0(this.viewer,e.style),i="手绘线_"),e.type=="polygon"&&(t=new S0(this.viewer,e.style),i="面_"),e.type=="billboard"&&(t=new zg(this.viewer,e.style),i="图标_"),(e.type=="circle"||e.type=="ellipse")&&(t=new jg(this.viewer,e.style),i="圆_"),e.type=="rectangle"&&(t=new M0(this.viewer,e.style),i="矩形_"),e.type=="gltfModel"&&(t=new $g(this.viewer,e.style),i="模型_"),e.type=="point"&&(t=new B0(this.viewer,e.style),i="点_"),e.type=="label"&&(t=new x0(this.viewer,e.style),i="文字_"),e.type=="arrow"&&(t=new k0(this.viewer,e.style)),t&&(t.name=i+new Date().getTime()),t}}class lo{viewer;Cesium;drawTool;flatTool;tileset;tilesets;flatTools;selectedEntityObj;selectionOutline;centerHandle;_dragHandler;_listeners;currentColor;currentWidth;originalDoubleClickAction=null;constructor({viewer:e,cesium:t}){window.Cesium=t,this.viewer=e,this.Cesium=t,this.drawTool=null,this.flatTool=null,this.tileset=null,this.tilesets=null,this.flatTools=null,this.selectedEntityObj=null,this.selectionOutline=null,this.centerHandle=null,this._dragHandler=null,this._listeners=[],this.currentColor=this.Cesium.Color.fromCssColorString("#ff0000"),this.currentWidth=1,this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.initDrawTool()}setCurrentColor(e){typeof e=="string"?this.currentColor=this.Cesium.Color.fromCssColorString(e):this.currentColor=e}setCurrentWidth(e){this.currentWidth=e}initDrawTool(){this.drawTool||(this.drawTool=new P0(this.viewer,{canEdit:!0,fireEdit:!0}),this.drawTool.on("startEdit",(e,t)=>{this.selectedEntityObj=e,this.showEntityOutline(e)}),this.drawTool.on("endEdit",(e,t)=>{this.selectedEntityObj=null,this.hideEntityOutline()}),this.drawTool.on("remove",(e,t)=>{this.selectedEntityObj===e&&(this.selectedEntityObj=null,this.hideEntityOutline())}))}showEntityOutline(e){this.hideEntityOutline(),!(!e||!e.getEntity())&&this.createCenterHandle(e)}hideEntityOutline(){if(this.selectionOutline){try{this.viewer.entities.remove(this.selectionOutline)}catch{}this.selectionOutline=null}if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}if(this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}}createCenterHandle(e){if(!e||!e.getEntity())return;if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}const t=e.getEntity();let i=null;if(t._plotInstance&&typeof t._plotInstance.syncFromEntity=="function")try{t._plotInstance.syncFromEntity();const s=t._plotInstance;s.leftup&&s.rightdown&&(i=this.Cesium.Cartesian3.midpoint(s.leftup,s.rightdown,new this.Cesium.Cartesian3))}catch(s){console.warn("plotInstance.syncFromEntity failed",s)}if(!i){if(e.positions&&e.positions.length)i=this.calculateCenter(e.positions);else if(t.position&&t.position.getValue)i=t.position.getValue();else if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const s=t.polyline.positions.getValue();i=this.calculateCenter(s)}else if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const s=t.polygon.hierarchy.getValue().positions;i=this.calculateCenter(s)}else if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue)try{const s=t.rectangle.coordinates.getValue(),o=(s.west+s.east)/2,r=(s.south+s.north)/2;i=this.Cesium.Cartesian3.fromRadians(o,r,0)}catch{}}i&&(this.centerHandle=this.viewer.entities.add({position:i,point:{pixelSize:10,color:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLUE,outlineWidth:2}}),this.addDragHandler(e,i))}calculateCenter(e){if(!e||e.length===0)return null;const t=e.map(r=>r);let i=0,s=0,o=0;for(let r=0;r<t.length;r++)i+=t[r].x,s+=t[r].y,o+=t[r].z;return new this.Cesium.Cartesian3(i/t.length,s/t.length,o/t.length)}getEntityPositions(e){const t=e.getEntity();if(e.positions&&Array.isArray(e.positions))return e.positions.slice();if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const i=t.polyline.positions.getValue();return Array.isArray(i)?i.slice():[]}if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const i=t.polygon.hierarchy.getValue();return i&&i.positions?i.positions.slice():[]}if(t.position&&t.position.getValue)return[t.position.getValue()];if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue){const i=t.rectangle.coordinates.getValue();return[this.Cesium.Cartesian3.fromDegrees(i.west,i.south),this.Cesium.Cartesian3.fromDegrees(i.east,i.south),this.Cesium.Cartesian3.fromDegrees(i.east,i.north),this.Cesium.Cartesian3.fromDegrees(i.west,i.north)]}return[]}addDragHandler(e,t){if(console.log("移动线段"),this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}let i=!1,s,o=0;const r=16,l=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);this._dragHandler=l;const a=c=>{let u;try{u=this.viewer.scene.pickPosition(c)}catch{}if(!this.Cesium.defined(u)){const h=this.viewer.camera.getPickRay(c);h&&(u=this.viewer.scene.globe.pick(h,this.viewer.scene))}return this.Cesium.defined(u)||(u=this.viewer.scene.camera.pickEllipsoid(c,this.viewer.scene.globe.ellipsoid)),u};l.setInputAction(c=>{let u=!1;const h=this.viewer.scene.drillPick(c.position)||[];for(let f=0;f<h.length;f++){const p=h[f].id;if(p&&p===this.centerHandle){u=!0;break}}if(u){i=!0;const f=a(c.position);this.Cesium.defined(f)&&(s=f.clone()),o=performance.now(),this.viewer.scene.screenSpaceCameraController.enableRotate=!1,this.viewer.scene.screenSpaceCameraController.enableTranslate=!1,this.viewer.scene.screenSpaceCameraController.enableZoom=!1,this.viewer.scene.screenSpaceCameraController.enableTilt=!1,this.viewer.scene.screenSpaceCameraController.enableLook=!1}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),l.setInputAction(c=>{if(!i||!this.Cesium.defined(s))return;const u=performance.now();if(u-o<r)return;o=u;const h=a(c.endPosition);if(!this.Cesium.defined(h))return;const f=this.Cesium.Cartesian3.subtract(h,s,new this.Cesium.Cartesian3);if(this.centerHandle&&this.centerHandle.position&&this.centerHandle.position.setValue){const p=this.centerHandle.position.getValue(this.Cesium.JulianDate.now());if(p){const A=this.Cesium.Cartesian3.add(p,f,new this.Cesium.Cartesian3);this.centerHandle.position.setValue(A)}}this.moveEntity(e,f);try{this.viewer.scene.requestRender()}catch{}s=h.clone()},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),l.setInputAction(()=>{if(i){i=!1,this.viewer.scene.screenSpaceCameraController.enableRotate=!0,this.viewer.scene.screenSpaceCameraController.enableTranslate=!0,this.viewer.scene.screenSpaceCameraController.enableZoom=!0,this.viewer.scene.screenSpaceCameraController.enableTilt=!0,this.viewer.scene.screenSpaceCameraController.enableLook=!0;const c=e.getEntity();if(c.state="done",c&&c.rectangle&&c.rectangle.coordinates)try{const u=c.rectangle.coordinates.getValue?c.rectangle.coordinates.getValue():c.rectangle.coordinates;u&&c.rectangle.coordinates.setValue(u)}catch(u){console.warn("Failed to refresh rectangle coordinates",u)}e&&this.selectedEntityObj!==e&&this.showEntityOutline(e)}},this.Cesium.ScreenSpaceEventType.LEFT_UP)}moveEntity(e,t){const i=e.getEntity();if(!i)return;const s=o=>this.Cesium.Cartesian3.add(o,t,new this.Cesium.Cartesian3);if(i.position){const o=i.position.getValue?i.position.getValue():i.position,r=s(o);i.position.setValue?i.position.setValue(r):i.position=r,i.state="moving",e.positions&&e.positions.length===1&&(e.positions[0]=r);return}if(i.polyline){if(i._plotInstance&&i._plotInstance.type==="rectangle"&&typeof i._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(i._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update rectangle positions:",l)}if(i._plotInstance&&i._plotInstance.type==="circle"&&typeof i._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(i._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update circle positions:",l)}const r=(e.positions&&Array.isArray(e.positions)?e.positions:i.polyline.positions.getValue?i.polyline.positions.getValue():[]).map(l=>s(l));if(e.updatePositions&&typeof e.updatePositions=="function")e.updatePositions(r);else if(e.positions&&Array.isArray(e.positions)&&(e.positions=r),i.polyline&&i.polyline.positions)try{i.polyline.positions instanceof this.Cesium.CallbackProperty||(i.polyline.positions=r)}catch{i.polyline.positions=r}}}startFreehandLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"freehandLine",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t,smoothness:2,minDistance:.01,angleThreshold:.8,renderInterval:16,curveResolution:3},e)})}startArrow(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"arrow",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startStraightLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"polyline",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startEllipse(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"circle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,outline:!0,fill:!1,clampToGround:!t},e)})}startImage(e,t){this.initDrawTool();const i=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"billboard",style:Object.assign({image:e,width:t&&t.width?t.width:50,height:t&&t.height?t.height:50,clampToGround:!i},t)})}startRectangle(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"rectangle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,clampToGround:!t},e)})}clearAll(){this.drawTool&&this.drawTool.removeAll(),this.hideEntityOutline()}destroy(){this.clearAll(),this.originalDoubleClickAction&&(this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null)}getAllEntities(){return this.drawTool&&typeof this.drawTool.getEntityObjArr=="function"?this.drawTool.getEntityObjArr():[]}saveAnnotations(){try{const e=this.getAllEntities(),t={freehand:[],arrow:[],text:[],image:[],polyline:[],rectangle:[],ellipse:[],other:[]};e.forEach(o=>{if(o&&typeof o=="object"){const r=o.type||o.constructor&&o.constructor.name,l={type:r,style:{}};switch(!0){case["freehandLine","CreateFreehandLine","polyline","CreatePolyline","arrow","CreateArrow"].includes(r):l.id=o.objId||o.id||Date.now().toString(),o.style&&(l.style={color:o.style.color,width:o.style.width,opacity:o.style.opacity,...o.style}),o.positions&&Array.isArray(o.positions)&&(l.positions=o.positions.map(a=>a&&typeof a=="object"&&a.x!==void 0&&a.y!==void 0&&a.z!==void 0?{x:a.x,y:a.y,z:a.z}:a)),["freehandLine","CreateFreehandLine"].includes(r)&&(l.isEdit=o.isEdit!==void 0?o.isEdit:!0,l.isFreehand=!0);break;case["rectangle","CreateRectangle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(c=>({x:c.x,y:c.y,z:c.z}));else{const c=o.getEntity?o.getEntity():o;if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const u=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(u)&&(a=u.map(h=>({x:h.x,y:h.y,z:h.z})))}else if(c.rectangle&&c.rectangle.coordinates&&c.rectangle.coordinates.getValue){const u=c.rectangle.coordinates.getValue(this.viewer.clock.currentTime);a=[{west:u.west,south:u.south,east:u.east,north:u.north}]}}catch{}}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];const c=o.getEntity?o.getEntity():o;if(c&&c._plotInstance&&c._plotInstance.type==="circle"&&c._plotInstance.center&&c._plotInstance.radiusPoint){const u=c._plotInstance;a=[{x:u.center.x,y:u.center.y,z:u.center.z},{x:u.radiusPoint.x,y:u.radiusPoint.y,z:u.radiusPoint.z}]}else if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(u=>({x:u.x,y:u.y,z:u.z}));else if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const u=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(u)&&(a=u.map(h=>({x:h.x,y:h.y,z:h.z})))}else if(c.ellipse&&c.ellipse.center&&c.ellipse.center.getValue&&c.ellipse.semiMajorAxis&&c.ellipse.semiMajorAxis.getValue){const u=c.ellipse.center.getValue(this.viewer.clock.currentTime),h=c.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime);if(u&&h){const f={x:u.x,y:u.y,z:u.z||0},p={x:f.x+h,y:f.y,z:f.z};a=[f,p]}}}catch{}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["label","CreateLabel"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label){const c={};try{const u=a.label.fillColor&&a.label.fillColor.getValue?a.label.fillColor.getValue(this.viewer.clock.currentTime):a.label.fillColor;u&&(c.color=u)}catch{}a.label.font&&(c.font=a.label.font),l.style=c}}catch{}if(o.text)l.text=o.text;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label&&a.label.text){const c=a.label.text.getValue?a.label.text.getValue(this.viewer.clock.currentTime):a.label.text;c&&(l.text=c)}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const c=a.position.getValue(this.viewer.clock.currentTime);c&&(l.position={x:c.x,y:c.y,z:c.z})}}catch{}break;case["billboard","CreateBillboard"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.billboard){const c={};try{const u=a.billboard.image&&a.billboard.image.getValue?a.billboard.image.getValue(this.viewer.clock.currentTime):a.billboard.image;if(u){if(typeof u=="string")c.image=u;else if(u&&u.src)try{const h=u;if(typeof document<"u"&&h instanceof HTMLImageElement){const f=document.createElement("canvas");f.width=h.naturalWidth||h.width||1,f.height=h.naturalHeight||h.height||1;const p=f.getContext("2d");p?(p.drawImage(h,0,0),c.image=f.toDataURL()):c.image=h.src}else c.image=u.src}catch{c.image=u.src}}}catch{}a.billboard.width&&(c.width=a.billboard.width),a.billboard.height&&(c.height=a.billboard.height),l.style=c}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const c=a.position.getValue(this.viewer.clock.currentTime);c&&(l.position={x:c.x,y:c.y,z:c.z})}}catch{}break;default:o.style&&(l.style=o.style),o.position&&(l.position=o.position);break}switch(!0){case["freehandLine","CreateFreehandLine"].includes(r):t.freehand.push(l);break;case["arrow","CreateArrow"].includes(r):t.arrow.push(l);break;case["label","CreateLabel"].includes(r):t.text.push(l);break;case["billboard","CreateBillboard"].includes(r):t.image.push(l);break;case["polyline","CreatePolyline"].includes(r):t.polyline.push(l);break;case["rectangle","CreateRectangle"].includes(r):t.rectangle.push(l);break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):t.ellipse.push(l);break;default:t.other.push(l)}}});const i={version:"1.0",exportTime:new Date().toISOString(),totalEntities:e.length,annotations:t},s=JSON.stringify(i);return console.log("标注数据已按类型分类保存,只包含重绘所需信息:",s),s}catch(e){return console.error("保存标注失败:",e),!1}}loadAnnotations(e){try{const t=typeof e=="string"?JSON.parse(e):e;if(!t.annotations)return console.error("标注数据格式错误,缺少annotations字段"),!1;const i=t.annotations;let s=0;const o=(r,l)=>{Array.isArray(r)&&r.forEach(a=>{if(a.style){if(a.style.color&&typeof a.style.color=="object"){const c=a.style.color;a.style.color=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}if(a.style.outlineColor&&typeof a.style.outlineColor=="object"){const c=a.style.outlineColor;a.style.outlineColor=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}}switch(l){case"freehand":case"polyline":case"arrow":if(a.positions&&a.positions.length>0){const c=a.positions.map(f=>f&&typeof f=="object"?new this.Cesium.Cartesian3(f.x,f.y,f.z):f),u={type:l==="freehand"?"freehandLine":l,style:a.style||{},positions:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))},h=this.drawTool.createByPositions(u);if(h&&h.getEntity()){s++,h.isEdit=!0;const f=h.getEntity();f&&!f._plotInstance&&(f._plotInstance=h),f&&!f.objId&&(f.objId=h.objId),console.log(`Loaded ${l} entity with objId: ${h.objId}`)}}break;case"rectangle":{try{if(a.positions&&a.positions.length){let c=[];if(a.positions[0]&&a.positions[0].x!==void 0)c=a.positions.map(u=>new this.Cesium.Cartesian3(u.x,u.y,u.z!==void 0?u.z:0));else if(a.positions[0]&&a.positions[0].west!==void 0){const u=a.positions[0];c=[this.Cesium.Cartesian3.fromRadians(u.west,u.south),this.Cesium.Cartesian3.fromRadians(u.east,u.south),this.Cesium.Cartesian3.fromRadians(u.east,u.north),this.Cesium.Cartesian3.fromRadians(u.west,u.north),this.Cesium.Cartesian3.fromRadians(u.west,u.south)]}if(c.length){const u=JSON.parse(JSON.stringify(a.style||{}));if(u.color&&typeof u.color=="string"&&!u.color.startsWith("rgba"))try{const p=JSON.parse(u.color);p.red!==void 0&&(u.color=`rgba(${Math.round(p.red*255)}, ${Math.round(p.green*255)}, ${Math.round(p.blue*255)}, ${p.alpha||1})`)}catch{}const h={type:"rectangle",positions:c,style:u,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let f=null;try{f=this.drawTool.createByPositions(h)}catch(p){console.warn("drawTool.createByPositions(rectangle) failed",p)}if(f){s++,f.isEdit=!0;const p=f.getEntity?f.getEntity():f.entity||f;p&&(p._plotInstance=f,p.objId=f.objId||a.id,p.pickable=!0,p.polyline&&(p.polyline.pickWidth=10),console.log(`Loaded rectangle entity with objId: ${p.objId}, color: ${u.color}`))}}}}catch(c){console.warn("load rectangle failed",c)}break}case"text":if(a.position){const c=a.text||"文字标注",u={type:"label",style:a.style||{},text:c,position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};u.style.fontSize||(u.style.fontSize=14),u.style.fontFamily||(u.style.fontFamily="Arial");let h;try{!u.positions&&u.position&&(u.positions=u.position),h=this.drawTool.createByPositions(u),!h&&this.drawTool.startText&&(console.log("使用startText创建文字"),this.drawTool.startText(u.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.text=c,this.drawTool.currentEntity.position=u.position,h=this.drawTool.currentEntity))}catch(f){console.log("创建文字失败",f)}if(!h)try{const f=this.viewer.entities.add({position:u.position,label:Object.assign({text:c,font:u.style&&u.style.font||"14pt Source Han Sans CN",fillColor:u.style&&u.style.fillColor||this.Cesium.Color.WHITE,outlineColor:u.style&&u.style.outlineColor||this.Cesium.Color.BLACK,outlineWidth:u.style&&u.style.outlineWidth||2,verticalOrigin:u.style&&u.style.verticalOrigin||this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:u.style&&u.style.pixelOffset||new this.Cesium.Cartesian2(0,-10)},u.style&&u.style.label?u.style.label:{})}),p={getEntity:()=>f,entity:f,style:u.style||{},type:"label",objId:a.id||`label_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(f)};try{f.objId=p.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(p)),h=p}catch(f){console.warn("回退创建文字实体失败",f)}h&&(s++,h.isEdit=!0)}break;case"image":if(a.position){const c={type:"billboard",style:a.style||{},position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};c.style.image||(console.log("使用默认图片占位符"),c.style.image="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4="),c.style.width||(c.style.width=50),c.style.height||(c.style.height=50);let u;try{!c.positions&&c.position&&(c.positions=c.position),u=this.drawTool.createByPositions(c),!u&&this.drawTool.startImage&&(console.log("使用startImage创建图片"),this.drawTool.startImage(c.style.image,c.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.position=c.position,u=this.drawTool.currentEntity))}catch(h){console.log("创建图片失败",h)}if(!u)try{const h=c.style&&c.style.image?c.style.image:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4=",f=this.viewer.entities.add({position:c.position,billboard:{image:h,width:c.style&&c.style.width?c.style.width:50,height:c.style&&c.style.height?c.style.height:50,verticalOrigin:c.style&&c.style.verticalOrigin||this.Cesium.VerticalOrigin.CENTER,scale:c.style&&c.style.scale||1}}),p={getEntity:()=>f,entity:f,style:c.style||{},type:"billboard",objId:a.id||`billboard_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(f)};try{f.objId=p.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(p)),u=p}catch(h){console.warn("回退创建图片实体失败",h)}u&&(s++,u.isEdit=!0)}break;case"ellipse":case"circle":{try{const c=JSON.parse(JSON.stringify(a.style||{}));if(c.color&&typeof c.color=="string"&&!c.color.startsWith("rgba"))try{const f=JSON.parse(c.color);f.red!==void 0&&(c.color=`rgba(${Math.round(f.red*255)}, ${Math.round(f.green*255)}, ${Math.round(f.blue*255)}, ${f.alpha||1})`)}catch{}let u=[],h=!1;if(a.positions&&a.positions.length&&(a.positions[0]&&a.positions[0].x!==void 0&&(u=a.positions.map(f=>new this.Cesium.Cartesian3(f.x,f.y,f.z!==void 0?f.z:0))),u.length)){const f={type:l,positions:u,style:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let p=null;try{if(p=this.drawTool.createByPositions(f),p){s++,p.isEdit=!0;const A=p.getEntity?p.getEntity():p.entity||p;A&&(A._plotInstance=p,A.objId=p.objId||a.id,A.pickable=!0,A.polyline&&(A.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${A.objId} using positions`)),h=!0}}catch(A){console.warn(`drawTool.createByPositions(${l}) failed`,A)}}if(!h&&a.center&&a.radius)try{const f=new this.Cesium.Cartesian3(a.center.x,a.center.y,a.center.z||0),p=this.Cesium.Cartesian3.add(f,new this.Cesium.Cartesian3(a.radius,0,0),new this.Cesium.Cartesian3),C={type:l,positions:[f,p],style:c,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let m=null;try{if(m=this.drawTool.createByPositions(C),m){s++,m.isEdit=!0;const y=m.getEntity?m.getEntity():m.entity||m;y&&(y._plotInstance=m,y.objId=m.objId||a.id,y.pickable=!0,y.polyline&&(y.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${y.objId} using center and radius`))}}catch(y){console.warn(`drawTool.createByPositions(${l}) with center/radius failed`,y)}}catch(f){console.warn(`Fallback creation for ${l} failed`,f)}}catch(c){console.warn(`load ${l} failed`,c)}break}default:console.log(`尝试加载未知类型实体: ${l}`);break}})};return Object.keys(i).forEach(r=>{o(i[r],r)}),console.log(`成功加载 ${s} 个标注实体`),this.drawTool&&typeof this.drawTool.bindEdit=="function"&&this.drawTool.bindEdit(),!0}catch(t){return console.error("加载标注失败:",t),!1}}changeEntityColor(e){try{if(!this.selectedEntityObj)return!1;if(this.selectedEntityObj.setStyle&&typeof this.selectedEntityObj.setStyle=="function")try{return this.selectedEntityObj.setStyle({color:e}),console.log("通过实体对象的setStyle方法修改颜色成功"),!0}catch(s){console.warn("通过setStyle修改颜色失败,尝试直接修改实体:",s)}const t=this.selectedEntityObj.getEntity();if(!t)return!1;let i;try{i=this.Cesium.Color.fromCssColorString(e)}catch(s){console.warn("Invalid color format:",e,s),i=e}if(t.polyline)try{t.polyline.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.polyline.material=i}else if(t.polygon)try{t.polygon.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.polygon.material=i}else if(t.rectangle){const s=t.rectangle.outline,o=t.rectangle.outlineWidth;try{t.rectangle.material=new this.Cesium.ColorMaterialProperty(i)}catch{t.rectangle.material=i}t.rectangle.outlineColor=i,s!==void 0&&(t.rectangle.outline=s),o!==void 0&&(t.rectangle.outlineWidth=o)}else if(t.ellipse||t.circle){const s=t.ellipse||t.circle,o=s.outline,r=s.outlineColor,l=s.outlineWidth;s.material=i,o!==void 0&&(s.outline=o),r!==void 0&&(s.outlineColor=r),l!==void 0&&(s.outlineWidth=l)}return!0}catch(t){return console.error("changeEntityColor failed",t),!1}}changeColor(e){return this.changeEntityColor(e)}setLineWidth(e){if(!this.selectedEntityObj)return!1;const t=this.selectedEntityObj.getEntity();let i=2;if(typeof e=="number")i=e;else switch(e){case"thin":i=2;break;case"medium":i=4;break;case"thick":i=8;break}if(t.polyline)t.polyline.width=i;else if(t.polygon&&t.polygon.outline)t.polygon.outlineWidth=i;else if(t.rectangle&&t.rectangle.outline)t.rectangle.outlineWidth=i;else if((t.ellipse||t.circle)&&(t.ellipse?.outline||t.circle?.outline)){const s=t.ellipse||t.circle;s.outlineWidth=i}return!0}changeWidth(e){return this.setLineWidth(e)}deleteSelectedEntity(){if(!this.selectedEntityObj)return!1;if(typeof this.drawTool.removeOne=="function")this.drawTool.removeOne(this.selectedEntityObj);else if(typeof this.drawTool.remove=="function")this.drawTool.remove(this.selectedEntityObj);else return console.error("No remove method found on drawTool"),!1;return this.selectedEntityObj=null,this.hideEntityOutline(),!0}}class tc{viewer;cesium;handler=null;measureEntities=[];originalDoubleClickAction=null;onMeasure=()=>{};activePoints=[];floatingPoint=null;activeShape=null;type=null;unit="m";cursorPosition=null;isSnapping=!1;snapIndicator=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t;const i=this.cesium;this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(i.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(i.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}setUnit(e){this.unit=e}setSnapping(e){this.isSnapping=e,!e&&this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null)}start(e){const t=this.cesium;this.clearActive(),this.type=e,this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(i=>{const s=this.getPickPosition(i.position);s&&this.addPoint(s)},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(i=>{const s=this.getPickPosition(i.endPosition);s&&(this.cursorPosition=s,this.updateFloatingPoint(s))},t.ScreenSpaceEventType.MOUSE_MOVE),this.type==="area"&&this.handler.setInputAction(()=>{this.finish()},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}addPoint(e){const t=this.cesium;this.activePoints.push(e);const i=this.viewer.entities.add({position:e,point:{pixelSize:8,color:t.Color.YELLOW,outlineColor:t.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.measureEntities.push(i),this.type==="distance"){if(this.activePoints.length===1)this.onMeasure(null),this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===2){const s=this.activePoints[0],o=this.activePoints[1];this.activeShape&&(this.viewer.entities.remove(this.activeShape),this.activeShape=null);const r=this.viewer.entities.add({polyline:{positions:[s,o],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(r);const l=t.Cartesian3.distance(s,o),a=t.Cartesian3.midpoint(s,o,new t.Cartesian3);this.addLabel(a,this.formatDistance(l));const c=t.Transforms.eastNorthUpToFixedFrame(s),u=t.Matrix4.inverse(c,new t.Matrix4),h=t.Matrix4.multiplyByPoint(u,o,new t.Cartesian3),f=h.x,p=h.y,A=h.z,C=t.Matrix4.getColumn(c,0,new t.Cartesian3),m=t.Matrix4.getColumn(c,1,new t.Cartesian3),y=t.Cartesian3.multiplyByScalar(C,f,new t.Cartesian3),E=t.Cartesian3.add(s,y,new t.Cartesian3),I=t.Cartesian3.multiplyByScalar(m,p,new t.Cartesian3),M=t.Cartesian3.add(E,I,new t.Cartesian3);if(this.viewer.scene.mode!==t.SceneMode.SCENE2D){const k=this.viewer.entities.add({polyline:{positions:[s,E],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.RED}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(1,0,0,.5)})}}),S=this.viewer.entities.add({polyline:{positions:[E,M],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.GREEN}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,1,0,.5)})}}),x=this.viewer.entities.add({polyline:{positions:[M,o],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.BLUE}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,0,1,.5)})}});this.measureEntities.push(k,S,x)}this.onMeasure({type:"distance",dx:f,dy:p,dz:A,dist:l}),this.activePoints=[]}}else if(this.type==="angle"){if(this.activePoints.length===1)this.onMeasure(null);else if(this.activePoints.length===2)this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length<2)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===3){const s=this.activePoints[0],o=this.activePoints[1],r=this.activePoints[2];if(this.activeShape){this.viewer.entities.remove(this.activeShape);const a=this.viewer.entities.add({polyline:{positions:[s,o,r],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(a)}const l=this.calculateAngle(s,o,r);this.addLabel(o,`${l.toFixed(1)}°`),this.onMeasure({type:"angle",angle:l}),this.finish()}}else this.type==="area"&&this.activePoints.length===1&&(this.onMeasure(null),this.activeShape=this.viewer.entities.add({polygon:{hierarchy:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return new t.PolygonHierarchy([]);const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),new t.PolygonHierarchy(s)},!1),material:t.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:t.Color.YELLOW,outlineWidth:2},polyline:{positions:new t.CallbackProperty(()=>{const s=[...this.activePoints];return this.cursorPosition&&(s.push(this.cursorPosition),s.push(s[0])),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW,clampToGround:!1}}),this.measureEntities.push(this.activeShape))}updateFloatingPoint(e){const t=this.cesium;this.floatingPoint||(this.floatingPoint=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:5,color:t.Color.RED,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))}finish(){const e=this.cesium;if(this.type==="distance"&&this.activePoints.length>1){let t=0;for(let s=0;s<this.activePoints.length-1;s++)t+=e.Cartesian3.distance(this.activePoints[s],this.activePoints[s+1]);const i=this.activePoints[this.activePoints.length-1];this.addLabel(i,`Total: ${this.formatDistance(t)}`)}else if(this.type==="area"&&this.activePoints.length>=3){const t=this.calculateArea(this.activePoints),i=this.calculateCenter(this.activePoints);this.addLabel(i,`面积: ${this.formatArea(t)}`),this.onMeasure({type:"area",area:t})}this.clearActive()}clearAll(){this.clear(),this.onMeasure(null)}clear(){this.clearActive(),this.measureEntities.forEach(e=>this.viewer.entities.remove(e)),this.measureEntities=[]}stop(){this.clearActive(),this.onMeasure(null)}destroy(){if(this.clear(),this.originalDoubleClickAction){const e=this.cesium;this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null}}clearActive(){const e=this.cesium;if(this.handler&&(this.handler.destroy(),this.handler=null),this.floatingPoint&&(this.viewer.entities.remove(this.floatingPoint),this.floatingPoint=null),this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null),this.activeShape){if(this.type==="distance"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const i=this.viewer.entities.add({polyline:{positions:t,width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(i)}else if(this.type==="area"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const i=this.viewer.entities.add({polygon:{hierarchy:new e.PolygonHierarchy(t),material:e.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:e.Color.YELLOW,outlineWidth:2},polyline:{positions:[...t,t[0]],width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(i)}this.activeShape=null}this.activePoints=[],this.type=null,this.cursorPosition=null}getPickPosition(e){const t=this.cesium;let i;try{i=this.viewer.scene.pickPosition(e)}catch{}if(!i||!t.defined(i)){const s=this.viewer.camera.getPickRay(e);s&&(i=this.viewer.scene.globe.pick(s,this.viewer.scene))}if((!i||!t.defined(i))&&(i=this.viewer.scene.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),!i||!t.defined(i))return null;if(this.isSnapping){const s=this.snapToVertex(e);if(s)i=s;else{const o=this.snapTo3DTileFeature(e);o&&(i=o)}}return this.isSnapping&&(this.snapIndicator||(this.snapIndicator=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:10,color:t.Color.GREEN.withAlpha(.5),outlineColor:t.Color.GREEN,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))),i}snapTo3DTileFeature(e){const t=this.cesium,i=10,s=[{x:0,y:0},{x:-i,y:0},{x:i,y:0},{x:0,y:-i},{x:0,y:i},{x:-i,y:-i},{x:i,y:-i},{x:-i,y:i},{x:i,y:i}];for(let o=0;o<s.length;o++){const r=s[o];if(!r)continue;const l=new t.Cartesian2(e.x+r.x,e.y+r.y);let a=null;try{a=this.viewer.scene.pick(l)}catch{}if(t.defined(a)&&(a instanceof t.Cesium3DTileFeature||a.primitive&&a.primitive instanceof t.PointPrimitive))try{const c=this.viewer.scene.pickPosition(l);if(c)return c}catch{}}return null}snapToVertex(e){const t=this.cesium,i=this.viewer.entities.values;let s=20,o=null;for(let r=0;r<i.length;r++){const l=i[r];if(!l.show)continue;let a=[];if(l.polyline&&l.polyline.positions){const c=l.polyline.positions.getValue(t.JulianDate.now());c&&(a=c)}else if(l.polygon&&l.polygon.hierarchy){const c=l.polygon.hierarchy.getValue(t.JulianDate.now());c&&c.positions&&(a=c.positions)}else if(l.position){const c=l.position.getValue(t.JulianDate.now());c&&(a=[c])}else if(l.rectangle&&l.rectangle.coordinates){const c=l.rectangle.coordinates.getValue(t.JulianDate.now());c&&(a=[t.Cartesian3.fromRadians(c.west,c.south),t.Cartesian3.fromRadians(c.east,c.south),t.Cartesian3.fromRadians(c.east,c.north),t.Cartesian3.fromRadians(c.west,c.north)])}for(let c=0;c<a.length;c++){const u=a[c];try{const h=this.viewer.scene.cartesianToCanvasCoordinates(u);if(h){const f=t.Cartesian2.distance(h,e);f<s&&(s=f,o=u)}}catch{}}}return o}addLabel(e,t){const i=this.cesium,s=this.viewer.entities.add({position:e,label:{text:t,font:"14px sans-serif",fillColor:i.Color.WHITE,style:i.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:i.VerticalOrigin.BOTTOM,pixelOffset:new i.Cartesian2(0,-10),disableDepthTestDistance:Number.POSITIVE_INFINITY,showBackground:!0,backgroundColor:new i.Color(0,0,0,.5)}});this.measureEntities.push(s)}formatDistance(e){return this.unit==="mm"?`${(e*1e3).toFixed(0)}mm`:this.unit==="cm"?`${(e*100).toFixed(1)}cm`:`${e.toFixed(2)}m`}calculateAngle(e,t,i){const s=this.cesium,o=s.Cartesian3.subtract(e,t,new s.Cartesian3),r=s.Cartesian3.subtract(i,t,new s.Cartesian3);s.Cartesian3.normalize(o,o),s.Cartesian3.normalize(r,r);const l=s.Cartesian3.dot(o,r),a=Math.max(-1,Math.min(1,l)),c=Math.acos(a);return s.Math.toDegrees(c)}calculateArea(e){const t=this.cesium;if(e.length<3)return 0;const i=e[0],s=new t.Cartesian3(0,0,0);for(let o=1;o<e.length-1;o++){const r=e[o],l=e[o+1],a=t.Cartesian3.subtract(r,i,new t.Cartesian3),c=t.Cartesian3.subtract(l,i,new t.Cartesian3),u=t.Cartesian3.cross(a,c,new t.Cartesian3);t.Cartesian3.add(s,u,s)}return t.Cartesian3.magnitude(s)*.5}calculateCenter(e){const t=this.cesium;if(!e||e.length===0)return null;let i=0,s=0,o=0;for(let r=0;r<e.length;r++)i+=e[r].x,s+=e[r].y,o+=e[r].z;return new t.Cartesian3(i/e.length,s/e.length,o/e.length)}formatArea(e){return e>1e6?`${(e/1e6).toFixed(2)} km²`:`${e.toFixed(2)} m²`}}class F0{cesium;viewer;events=new gi;lastBaseMapRequestId=0;currentMode="3d";defaultMapBound={minLon:-180,maxLon:180,minLat:-90,maxLat:90};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}get is2d(){return this.currentMode==="2d"}setGlobeEnvironmentVisible(e){if(this.is2d){this.viewer.scene.globe.show=e,this.viewer.scene.globe.showGroundAtmosphere=!1,this.viewer.scene.skyAtmosphere.show=!1,this.viewer.scene.sun.show=!1,this.viewer.scene.moon.show=!1,this.viewer.scene.skyBox.show=!1;return}const{scene:t}=this.viewer;t.globe&&(t.globe.show=e,t.globe.showGroundAtmosphere=e),t.skyAtmosphere&&(t.skyAtmosphere.show=e),t.sun&&(t.sun.show=e),t.moon&&(t.moon.show=e),t.skyBox&&(t.skyBox.show=e)}setGlobeColor(e){this.viewer.scene.globe.baseColor=this.cesium.Color.fromCssColorString(e)}setBackgroundColor(e){const t=this.viewer.container;t&&(t.style.background=e);try{const i=this.cesium.Color.fromCssColorString(e);i?(this.viewer.scene.backgroundColor=i,this.viewer.scene.globe.baseColor=i):(this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT)}catch{this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT}}async setTerrainEnable(e){if(!(this.is2d&&e))if(e)try{const t=this.cesium.ArcGISTiledElevationTerrainProvider.fromUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"),i=new Promise((s,o)=>setTimeout(()=>o(new Error("ArcGIS Terrain request timed out")),5e3));this.viewer.terrainProvider=await Promise.race([t,i])}catch(t){console.warn("Failed to load ArcGIS terrain (or timed out), trying Cesium World Terrain...",t);try{this.cesium.Terrain&&this.cesium.Terrain.fromWorldTerrain?this.viewer.terrainProvider=await this.cesium.Terrain.fromWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0}):this.viewer.terrainProvider=this.cesium.createWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0})}catch(i){console.error("Failed to enable terrain (both ArcGIS and Ion failed):",i),this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}}else this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}setDepthTestEnable(e){this.viewer.scene.globe.depthTestAgainstTerrain=e}setCadMode(e){this.currentMode!==e&&(this.currentMode=e,this.is2d?this._enable2DMode():this._enable3DMode())}_enable2DMode(){const e=this.cesium,t=this.viewer.scene,i=t.screenSpaceCameraController;t.morphTo2D(0),t.postProcessStages.fxaa.enabled=!1,this.setBackgroundColor("#000000"),this.setGlobeColor("#000000"),this.viewer.imageryLayers.removeAll(),this.setGlobeEnvironmentVisible(!0),i.zoomFactor=4,i.enableZoomInertia=!1,i.minimumZoomDistance=0,i.maximumZoomDistance=1e6,this.viewer.camera.setView({orientation:{heading:0,pitch:e.Math.toRadians(-90),roll:0}})}_enable3DMode(){this.viewer.scene.morphTo3D(0),this.setMouseHabit(0),this.setCollisionDetection(!0),this.viewer.scene.screenSpaceCameraController.minimumZoomDistance=1}async changeBaseMap(e,t){if(this.is2d){this.viewer.imageryLayers.removeAll();return}const i=Date.now();this.lastBaseMapRequestId=i;const s=this.viewer.imageryLayers,o=[];if(e==="tianditu"){const r=t?.token||"c25f14fb6bd4397cf8fe45144ff768d6",l=t?.layerType||"img_w",a=l.split("_"),c=a[0]||"img",u=a[1]||"w";let h="";c==="img"?h="cia":c==="vec"?h="cva":c==="ter"&&(h="cta");const f=h?`${h}_${u}`:"";o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${l}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${c}&STYLE=default&TILEMATRIXSET=${u}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:c,style:"default",format:"tiles",tileMatrixSetID:u,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]})),t.showAnnotation!==!1&&f&&o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${f}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${h}&STYLE=default&TILEMATRIXSET=${u}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:h,style:"default",format:"tiles",tileMatrixSetID:u,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]}))}else if(e==="arcgis"){console.log("Switching to ArcGIS...");const r=t?.url||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";try{if(this.cesium.ArcGisMapServerImageryProvider.fromUrl){const l=this.cesium.ArcGisMapServerImageryProvider.fromUrl(r,{enablePickFeatures:!1}),a=new Promise((u,h)=>setTimeout(()=>h(new Error("ArcGIS metadata request timed out")),3e3)),c=await Promise.race([l,a]);o.push(c)}else o.push(new this.cesium.ArcGisMapServerImageryProvider({url:r,enablePickFeatures:!1}))}catch(l){console.warn("ArcGIS provider failed (or timed out), fallback to XYZ template",l),o.push(new this.cesium.UrlTemplateImageryProvider({url:`${r}/tile/{z}/{y}/{x}`,maximumLevel:19,credit:"ArcGIS Layer"}))}}else if(e==="tianditu_img")return this.changeBaseMap("tianditu",{...t,layerType:"img_w"});if(this.lastBaseMapRequestId!==i){console.log("BaseMap switch cancelled due to new request.");return}s.removeAll(),o.forEach(r=>s.addImageryProvider(r))}async searchLocation(e,t){if(!e)return null;if(!t)throw new Error("缺少天地图 Token");const s=JSON.stringify({keyWord:e,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}),o=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(s)}&type=query&tk=${encodeURIComponent(t)}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}setShadowsEnable(e){this.is2d||(this.viewer.shadows=e,this.viewer.terrainShadows=e?this.cesium.ShadowMode.ENABLED:this.cesium.ShadowMode.DISABLED,this.viewer.shadowMap&&(this._shadowDarkness===void 0?this.viewer.shadowMap.darkness=e?.7:.3:this.viewer.shadowMap.darkness=this._shadowDarkness))}_shadowDarkness;setShadowDarkness(e){this.is2d||(this._shadowDarkness=e,this.viewer.shadowMap&&(this.viewer.shadowMap.darkness=e))}setTime(e){if(this.is2d)return;let t;if(e instanceof Date)t=e;else{const s=this.cesium.JulianDate.now();t=this.cesium.JulianDate.toDate(s),t.setHours(e),t.setMinutes(0),t.setSeconds(0)}const i=this.cesium.JulianDate.fromDate(t);this.viewer.clock.currentTime=i}setModelColorAdjustment(e){if(this.is2d)return;const t=this.viewer,i=this.cesium;if(!t||!t.scene)return;const s=e.brightness!==void 0?e.brightness:1,o=e.contrast!==void 0?e.contrast:1,r=e.saturation!==void 0?e.saturation:1,l=t.scene.primitives,a=l.length,c=!!i.CustomShader;for(let u=0;u<a;++u){const h=l.get(u);if(h instanceof i.Cesium3DTileset)if(c)if(h.customShader&&h.customShader.isModelAdjustment)e.brightness!==void 0&&h.customShader.setUniform("u_brightness",s),e.contrast!==void 0&&h.customShader.setUniform("u_contrast",o),e.saturation!==void 0&&h.customShader.setUniform("u_saturation",r);else{const f=new i.CustomShader({uniforms:{u_brightness:{type:i.UniformType.FLOAT,value:s},u_contrast:{type:i.UniformType.FLOAT,value:o},u_saturation:{type:i.UniformType.FLOAT,value:r}},fragmentShaderText:`
98
98
  void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
99
99
  // 1. 亮度 (Brightness) - RGB 乘法
100
100
  material.diffuse *= u_brightness;
@@ -114,11 +114,11 @@
114
114
  // 通常不需要 clamp,除非开启 HDR 后期望超亮,但负值需要避免
115
115
  material.diffuse = max(material.diffuse, vec3(0.0));
116
116
  }
117
- `});f.isModelAdjustment=!0,h.customShader=f}else e.brightness!==void 0&&e.brightness!==1&&!h.style&&(h.style=new i.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=null;_updateLightDirection=e=>{e.light instanceof this.cesium.DirectionalLight&&(e.light.direction=e.camera.directionWC)};setEnvironmentMapEnable(e){this.is2d||(e?(this.viewer.scene.light=new this.cesium.DirectionalLight({direction:this.viewer.scene.camera.directionWC}),this.viewer.scene.preRender.addEventListener(this._updateLightDirection)):(this._defaultSkyBox&&(this.viewer.scene.skyBox=this._defaultSkyBox),this.viewer.scene.preRender.removeEventListener(this._updateLightDirection),this.viewer.scene.light=new this.cesium.SunLight),this.viewer.scene.imageBasedLighting&&(this.viewer.scene.imageBasedLighting.imageBasedLightingFactor=e?new this.cesium.Cartesian2(2,2):new this.cesium.Cartesian2(1,1)))}setAmbientOcclusion(e){if(this.is2d)return;const t=this.viewer.scene;if(!t||!t.postProcessStages||!t.postProcessStages.ambientOcclusion)return;const i=t.postProcessStages.ambientOcclusion;i.enabled=e,e&&(i.uniforms.ambientOcclusionOnly=!1,i.uniforms.intensity=3,i.uniforms.bias=.1,i.uniforms.lengthCap=.03,i.uniforms.stepSize=1,i.uniforms.blurStepSize=.86)}setCollisionDetection(e){if(this.is2d){this.viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1;return}const t=this.viewer.scene.screenSpaceCameraController;t.enableCollisionDetection=e,e||t.minimumZoomDistance<1&&(t.minimumZoomDistance=1)}setMouseHabit(e){if(this.is2d)return;const t=this.viewer.scene.screenSpaceCameraController;t.enableTranslate=!0,t.enableRotate=!0,t.enableZoom=!0,t.enableTilt=!0,t.enableLook=!1,t.lookEventTypes=[],e===1?(t.rotateEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.MIDDLE_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.LEFT_DRAG]):(t.rotateEventTypes=[this.cesium.CameraEventType.LEFT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.MIDDLE_DRAG])}}class k0{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}getCameraView(){const e=this.viewer.camera;return{position:{x:e.position.x,y:e.position.y,z:e.position.z},orientation:{heading:e.heading,pitch:e.pitch,roll:e.roll},duration:1}}flyToCameraView(e){const{position:t,orientation:i,duration:s}=e,o=new this.cesium.Cartesian3(t.x,t.y,t.z),r=new this.cesium.HeadingPitchRoll(i.heading,i.pitch,i.roll);!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}getCurrentCameraPositionAndTarget(){const e=this.getCameraView();return{position:e.position,target:{heading:e.orientation.heading,pitch:e.orientation.pitch,roll:e.orientation.roll},duration:e.duration}}setCameraView(e){const t=e.target||e.orientation||{};this.flyToCameraView({position:{x:Number(e.position.x),y:Number(e.position.y),z:Number(e.position.z)},orientation:{heading:Number(t.heading||0),pitch:Number(t.pitch||0),roll:Number(t.roll||0)},duration:e.duration})}}function P0(n){const{container:e,appContext:t,methods:i,viewerOptions:s,options:o,callbacks:r}=n,l=new gi,a=window.Cesium;if(!a)throw new Error("Cesium is not loaded");e.id=`cesium-container-${Sg()}`;const c={animation:!1,timeline:!1,infoBox:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,navigationHelpButton:!1,geocoder:!1,baseLayerPicker:!1,selectionIndicator:!1,creditContainer:document.createElement("div"),contextOptions:{webgl:{alpha:!0}}},u=t?.config?.globalProperties?.$leitingBimOptions,h={...c,...u?.viewerOptions??{},...s??{}},f=new a.Viewer(e,h);f.camera.setView({destination:a.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:a.Math.toRadians(0),pitch:a.Math.toRadians(-90),roll:0}});let p=i;if(!p&&u&&(u.methods||(u.methods={}),p=u.methods),p){const A=new Qg({cesium:a,viewer:f,options:o,callbacks:r}),C=new ka({cesium:a,viewer:f}),m=new D0({cesium:a,viewer:f}),y=new Hg({cesium:a,viewer:f}),E=new k0({cesium:a,viewer:f});let x;const M=new tc({cesium:a,viewer:f});o&&(o.globe!==void 0&&m.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&m.setTerrainEnable(o.terrain),o.depthTest!==void 0&&m.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&m.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&m.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&m.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&m.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&m.setTime(o.time),o.brightness!==void 0&&m.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&m.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&m.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&m.setMouseHabit(o.mouseHabit)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),m.setCadMode("2d"),x=new lo({cesium:a,viewer:f})),C.events.on("tilesetLoaded",g=>{A.baseCompt.attachTileset(g,A.baseCompt.selectedColor),A.baseSection.attachTileset(g,g.leiting?.model?.modelId),p&&p.tilesLoad3dTiles&&p.tilesLoad3dTiles(g),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(g.leiting)}),C.events.on("loadingStatus",g=>{p&&p.onLoadingStatus&&p.onLoadingStatus(g)}),C.events.on("mountAll3Dtiles",({modelList:g,mapTileset:k})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(g),p?.mountAll3Dtiles&&p.mountAll3Dtiles(k)}),y.events.on("mountAllCad",g=>{o?.mountAllCad&&o.mountAllCad(g),p?.mountAllCad&&p.mountAllCad(g)}),A.baseCompt.loadNodeDetailsForModel=g=>C.loadNodeDetailsForModel(g),A.baseCompt.selectionChange(g=>{g.length!==0&&(o?.selectionChange&&o.selectionChange(g),p?.selectionChange&&p.selectionChange(g))}),p.onSearchComponent=g=>{o?.searchComponent&&o.searchComponent(g),p?.searchComponent&&p.searchComponent(g)};const T=p.saveRegion;p.saveRegion=g=>{o?.saveRegion&&o.saveRegion(g),T&&T!==o?.saveRegion&&T(g)};const S=p.saveCadCalibration;p.saveCadCalibration=g=>{o?.saveCadCalibration&&o.saveCadCalibration(g),S&&S!==o?.saveCadCalibration&&S(g)};const I=p.saveCadRegion;p.saveCadRegion=g=>{o?.saveCadRegion&&o.saveCadRegion(g),I&&I!==o?.saveCadRegion&&I(g)},p.getCesium=()=>a,p.getViewer=()=>f,p.getAnnotationInstance=()=>x,p.getMeasureInstance=()=>M,p.flyTo=g=>{E.setCameraView(g)},p.addPoint=(g,k,P=0)=>{f.entities.add({position:a.Cartesian3.fromDegrees(g,k,P),point:{pixelSize:10,color:a.Color.RED}})},p.enableTestLabel=()=>A.enableTestLabel(),p.setBackgroundColor=g=>m.setBackgroundColor(g),p.enableCesiumFXAA=g=>A.enableCesiumFXAA(g),p.setSceneOptions=g=>A.setSceneOptions(g),p.getCameraInfo=()=>E.getCameraView(),p.flyToCameraView=g=>E.flyToCameraView(g),p.getCurrentCameraPositionAndTarget=()=>E.getCurrentCameraPositionAndTarget(),p.setCameraView=g=>E.setCameraView(g),p.getImageBase64=()=>{const g=f.scene.canvas;return f.render(),g.toDataURL("image/png")},p.getSnapDomSImageBase64=(g,k)=>A.getSnapDomSImageBase64(g,k),p.addModels=g=>C.addModels(g),p.add3DtilesModel=g=>C.addModels(g),p.addOSGB=g=>C.addOSGB(g),p.updateOSGBMatrix=g=>C.updateOSGBMatrix(g),p.showModels=g=>C.showModels(g),p.showTileset=g=>C.showModels(g),p.deleteModels=g=>C.deleteModels(g),p.deleteAllModelList=()=>{C.deleteAllModels(),l.emit("deleteAllModels")},p.deleteAllModels=()=>{C.deleteAllModels(),l.emit("deleteAllModels")},p.flyToTileset=g=>C.flyToTileset(g),p.flyToByModelId=g=>C.flyToTileset(g),p.updateModelEffect=g=>A.updateModelEffect(g),p.getMapTileset=()=>C.getMapTileset(),p.getBIMmodelId=()=>C.getBIMmodelId(),p.getModelList=()=>C.getModelList(),p.loadTreeForModel=g=>C.loadTreeForModel(g),p.loadNodeDetailsForModel=g=>C.loadNodeDetailsForModel(g),p.setMapTileset=g=>C.setMapTileset(g),p.setBIMmodelId=g=>C.setBIMmodelId(g),p.setModelList=g=>C.setModelList(g),p.setSelectColorUserModelCpt=(g,k={})=>A.baseCompt.setSelectColorUserModelCpt(g,k),A.baseCompt.setLoadNodeDetailsCallback(g=>C.loadNodeDetailsForModel(g)),p.setAllSelectColorUserModelCpt=g=>A.baseCompt.setAllSelectColorUserModelCpt(g),p.setSelectColorUserModelCptByClear=()=>A.baseCompt.clearAllHaveSelected(),p.clearSelectColorUserModelCpt=()=>A.baseCompt.clearAllHaveSelected(),p.setSelecteds=(g,k)=>A.baseCompt.setSelectColorUserModelCpt(g,k??{rank:0}),p.setSelectedColor=(g,k,P,F)=>A.baseCompt.setSelectedColorRgba(g,k,P,F),p.clearAllHaveSelected=()=>A.baseCompt.clearAllHaveSelected(),p.getSelected=g=>A.baseCompt.getSelected(g),p.selectionChange=g=>{A.baseCompt.selectionChange(g)},p.flyToObjects=g=>A.baseCompt.flyToObjects(g),p.setAllConstructionProgressTracking=g=>A.baseCompt.setAllConstructionProgressTracking(g),p.enableAllConstructionProgressTracking=()=>A.baseCompt.enableConstructionProgressTracking(),p.disableConstructionProgressTracking=()=>A.baseCompt.disableConstructionProgressTracking(),p.disableAllConstructionProgressTracking=()=>A.baseCompt.disableConstructionProgressTracking(),p.freshConstructionProgressTracking=()=>A.baseCompt.freshConstructionProgressTracking(),p.reStartAnimation=()=>A.baseCompt.reStartAnimation(),p.resumeFlyTo=()=>A.baseCompt.resumeFlyTo(),p.pauseFlyTo=()=>A.baseCompt.pauseFlyTo(),p.pauseAnimation=()=>A.baseCompt.pauseFlyTo(),p.resumeAnimation=()=>A.baseCompt.resumeFlyTo(),p.setElementsListVisible=g=>A.baseCompt.setComponentVisibility(g),p.setAllElementsVisible=g=>A.baseCompt.setAllComponentsVisibility(g),p.getElementsVisible=g=>A.baseCompt.getComponentsByVisibility(g),p.setComponentVisibility=g=>A.baseCompt.setComponentVisibility(g),p.setAllComponentsVisibility=g=>A.baseCompt.setAllComponentsVisibility(g),p.getComponentsByVisibility=g=>A.baseCompt.getComponentsByVisibility(g),p.openSection=(g,k)=>A.baseSection.open(g,k),p.closeSection=g=>A.baseSection.close(g),p.updateSectionRange=g=>A.baseSection.updateRange(g),p.getSectionRange=()=>A.baseSection.getRange(),p.fitToModels=()=>A.baseSection.fitToModels(),p.setSectionBoxVisibility=g=>A.baseSection.setBoxVisibility(g),p.openPlayer=()=>{A.baseCompt.disableSelection(),A.basePlayer.openPlayer()},p.closePlayer=()=>{A.basePlayer.closePlayer(),A.baseCompt.enableSelection()},p.setPersonPosition=g=>A.basePlayer.setPersonPosition(g),p.setPlayerSpeed=g=>A.basePlayer.setSpeed({speed:g}),p.setPlayerParams=g=>A.basePlayer.setParams(g),p.setPlayerMoveState=(g,k)=>A.basePlayer.setMoveState(g,k),p.bindPlayerUiKeys=g=>A.basePlayer.bindUiKeys(g),p.setGlobeEnvironmentVisible=g=>m.setGlobeEnvironmentVisible(g),p.setGlobeColor=g=>m.setGlobeColor(g),p.setCadMode=g=>m.setCadMode(g),p.setTerrainEnable=g=>m.setTerrainEnable(g),p.setDepthTestEnable=g=>m.setDepthTestEnable(g),p.changeBaseMap=(g,k)=>m.changeBaseMap(g,k),p.searchLocation=(g,k)=>m.searchLocation(g,k),p.setShadowsEnable=g=>m.setShadowsEnable(g),p.setShadowDarkness=g=>{m.setShadowDarkness?m.setShadowDarkness(g):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},p.setTime=g=>m.setTime(g),p.setModelBrightness=g=>m.setModelBrightness(g),p.setModelColorAdjustment=g=>m.setModelColorAdjustment(g),p.setEnvironmentMapEnable=g=>m.setEnvironmentMapEnable(g),p.setAmbientOcclusion=g=>m.setAmbientOcclusion(g),p.setCollisionDetection=g=>m.setCollisionDetection(g),p.setMouseHabit=g=>m.setMouseHabit(g),p.is2dMode=()=>m.is2d,p.setSceneMode=g=>{const k=g?"2d":"3d";m.setCadMode(k),g&&!x&&(x=new lo({cesium:a,viewer:f})),l.emit("setMode",k)},p.setGisOptions=g=>{g.globe!==void 0&&m.setGlobeEnvironmentVisible(g.globe),g.elevation!==void 0&&m.setTerrainEnable(g.elevation),g.depthTestAgainstTerrain!==void 0&&m.setDepthTestEnable(g.depthTestAgainstTerrain),g.rendering!==void 0&&m.setAmbientOcclusion(g.rendering)},p.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),p.setConfigure=g=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",g)},p.addDxfModel=g=>{const k={...g};return k.files&&!k.fileNames&&(k.fileNames=k.files),k.fileNames||(k.fileNames=[]),y.addDxfModel(k)},p.deleteCad=g=>y.deleteCad(g),p.deleteAllCad=()=>y.deleteAllCad(),p.showDxfModel=g=>y.showJson(g),p.showDxfLayer=g=>y.showJsonByLayer(g),p.flyToCadModel=(g={})=>y.flyToCadModel(g),p.getDxfModels=g=>y.getDxfModels(g),p.getDxfLayers=g=>y.getMapLayers(g),p.getCadModelId=()=>y.getModelId(),p.setDxfOpen=g=>y.setDxfOpen(g),p.getDxfOpen=()=>y.getDxfOpen(),p.adjustingModelByCad=g=>y.adjustingModelByCad(g),p.saveAnnotations=()=>{let g=null;return x&&(g=x.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(g),g},p.loadAnnotations=g=>x?x.loadAnnotations(g):!1,p.set2d=g=>{const k=g?"2d":"3d";m.setCadMode(k),g&&!x&&(x=new lo({cesium:a,viewer:f})),l.emit("setMode",k)},p.flyToTopView=()=>{y.flyToCadModel()},p.menuEvents=l,p.insertMenu=g=>{l.emit("insertMenu",g)},p.setMenuListFilter=g=>{l.emit("setMenuListFilter",g)},p.showMenu=g=>{l.emit("showMenu",g)},p.setMenuActive=(g,k)=>{l.emit("setMenuActive",g,k)},p.insertContextMenu=g=>{console.warn("insertContextMenu is not initialized yet. Please wait for LeitingBIM component to mount.",g)},p.deleteContextMenu=g=>{console.warn("deleteContextMenu is not initialized yet.",g)},p.hideContextMenu=()=>{console.warn("hideContextMenu is not initialized yet.")},p.baseCompt=A.baseCompt,p.getTree=()=>{const g=[],k=C.getMapTileset();return Object.keys(k).forEach(P=>{const F=k[P];if(F&&F.leiting&&F.leiting.tree){const L=F.leiting.tree;Array.isArray(L)?g.push(...L):g.push(L)}}),g},p.getAllComponents=()=>{const g=C.getMapTileset(),k={},P=[];try{Object.keys(g).forEach(F=>{const L=g[F];if(!L||!L.leiting)return;const G=L.leiting,O=G.node,v=G.model.formData,w=G.box;if(!O||!O.nodeExtras)return;const b=G.model.modelId;k[b]=O.nodeExtras;const B=O.nodeExtras.element;if(!B)return;const R=w?w.center:{x:0,y:0,z:0};Object.values(B).forEach(U=>{if(U.box3)try{const N=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(v.totalRotation||0)),D=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(N),new a.Cartesian3(0,0,0)),Q=a.Cartesian3.fromDegrees(v.longitude,v.latitude,v.height),V=a.Transforms.eastNorthUpToFixedFrame(Q);a.Matrix4.multiply(V,D,V);const $=new a.Cartesian3(R.x,R.y,0),J=new a.Cartesian3;a.Matrix4.multiplyByPoint(V,$,J);const ne=a.Cartographic.fromCartesian(J),re=U.box3?.Center?.x||0,Y=U.box3?.Center?.y||0,j=U.box3?.Center?.z||0,X=new a.Cartesian3(-R.x+re,-R.y+Y,0+j),se=a.Matrix4.fromTranslation(X),oe=a.Matrix4.clone(se);a.Matrix4.multiply(D,oe,oe);const ae=a.Cartesian3.fromDegrees(ne.longitude/Math.PI*180,ne.latitude/Math.PI*180,v.height),Ce=a.Transforms.eastNorthUpToFixedFrame(ae);a.Matrix4.multiply(Ce,oe,Ce);const le=a.Cartographic.fromCartesian(new a.Cartesian3(Ce[12],Ce[13],Ce[14]));U.box3.cartographic={longitude:le.longitude/Math.PI*180,latitude:le.latitude/Math.PI*180,height:le.height};const Pe={id:U.uniqueId,billboard:[{theme:"Tag9999",position:[U.box3.cartographic.longitude,U.box3.cartographic.latitude,U.box3.cartographic.height],options:{text:U.name}}]};P.push(Pe)}catch(N){console.warn("Error calculating component position:",N)}})})}catch(F){console.error("getAllComponents error:",F)}return k},p.getCptInfos=g=>{if(!Array.isArray(g))return[];const k=C.getMapTileset(),P=[],F={};g.forEach(L=>{!L.modelId||!L.elementId||(F[L.modelId]||(F[L.modelId]=[]),F[L.modelId]?.push(L.elementId))});try{Object.keys(F).forEach(L=>{const G=k[L];if(!G||!G.leiting)return;const O=G.leiting,v=O.node,w=O.model.formData,b=O.box;if(!v||!v.nodeExtras)return;const B=v.nodeExtras.element;if(!B)return;const R=b?b.center:{x:0,y:0,z:0};F[L]?.forEach(U=>{const N=B[U];if(N&&N.box3)try{const D=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(w.totalRotation||0)),Q=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(D),new a.Cartesian3(0,0,0)),V=a.Cartesian3.fromDegrees(w.longitude,w.latitude,w.height),$=a.Transforms.eastNorthUpToFixedFrame(V);a.Matrix4.multiply($,Q,$);const J=new a.Cartesian3(R.x,R.y,0),ne=new a.Cartesian3;a.Matrix4.multiplyByPoint($,J,ne);const re=a.Cartographic.fromCartesian(ne),Y=N.box3?.Center?.x||0,j=N.box3?.Center?.y||0,X=N.box3?.Center?.z||0,se=new a.Cartesian3(-R.x+Y,-R.y+j,0+X),oe=a.Matrix4.fromTranslation(se),ae=a.Matrix4.clone(oe);a.Matrix4.multiply(Q,ae,ae);const Ce=a.Cartesian3.fromDegrees(re.longitude/Math.PI*180,re.latitude/Math.PI*180,w.height),le=a.Transforms.eastNorthUpToFixedFrame(Ce);a.Matrix4.multiply(le,ae,le);const Pe=a.Cartographic.fromCartesian(new a.Cartesian3(le[12],le[13],le[14]));N.box3.cartographic={longitude:Pe.longitude/Math.PI*180,latitude:Pe.latitude/Math.PI*180,height:Pe.height},P.push(N)}catch(D){console.warn("Error calculating component position:",D)}})})}catch(L){console.error("getCptInfos error:",L)}return P},window.Methods=p}return console.log("methods",p),{Cesium:a,viewer:f,methods:p,menuEvents:l}}function co(n){return d.getCurrentScope()?(d.onScopeDispose(n),!0):!1}function uo(n){return typeof n=="function"?n():d.unref(n)}const F0=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const R0=Object.prototype.toString,O0=n=>R0.call(n)==="[object Object]",L0=()=>{};function N0(n){return d.getCurrentInstance()}function nc(n,e=!0,t){N0()?d.onMounted(n,t):e?n():d.nextTick(n)}function Nt(n){var e;const t=uo(n);return(e=t?.$el)!=null?e:t}const Ln=F0?window:void 0;function U0(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=Ln):[e,t,i,s]=n,!e)return L0;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const o=[],r=()=>{o.forEach(u=>u()),o.length=0},l=(u,h,f,p)=>(u.addEventListener(h,f,p),()=>u.removeEventListener(h,f,p)),a=d.watch(()=>[Nt(e),uo(s)],([u,h])=>{if(r(),!u)return;const f=O0(h)?{...h}:h;o.push(...t.flatMap(p=>i.map(A=>l(u,p,A,f))))},{immediate:!0,flush:"post"}),c=()=>{a(),r()};return co(c),c}function _0(){const n=d.ref(!1),e=d.getCurrentInstance();return e&&d.onMounted(()=>{n.value=!0},e),n}function ic(n){const e=_0();return d.computed(()=>(e.value,!!n()))}function Q0(n,e={}){const{window:t=Ln}=e,i=ic(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=d.ref(!1),r=c=>{o.value=c.matches},l=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},a=d.watchEffect(()=>{i.value&&(l(),s=t.matchMedia(uo(n)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return co(()=>{a(),l(),s=void 0}),o}function H0(n,e,t={}){const{window:i=Ln,...s}=t;let o;const r=ic(()=>i&&"ResizeObserver"in i),l=()=>{o&&(o.disconnect(),o=void 0)},a=d.computed(()=>Array.isArray(n)?n.map(h=>Nt(h)):[Nt(n)]),c=d.watch(a,h=>{if(l(),r.value&&i){o=new ResizeObserver(e);for(const f of h)f&&o.observe(f,s)}},{immediate:!0,flush:"post"}),u=()=>{l(),c()};return co(u),{isSupported:r,stop:u}}function G0(n,e={width:0,height:0},t={}){const{window:i=Ln,box:s="content-box"}=t,o=d.computed(()=>{var h,f;return(f=(h=Nt(n))==null?void 0:h.namespaceURI)==null?void 0:f.includes("svg")}),r=d.ref(e.width),l=d.ref(e.height),{stop:a}=H0(n,([h])=>{const f=s==="border-box"?h.borderBoxSize:s==="content-box"?h.contentBoxSize:h.devicePixelContentBoxSize;if(i&&o.value){const p=Nt(n);if(p){const A=p.getBoundingClientRect();r.value=A.width,l.value=A.height}}else if(f){const p=Array.isArray(f)?f:[f];r.value=p.reduce((A,{inlineSize:C})=>A+C,0),l.value=p.reduce((A,{blockSize:C})=>A+C,0)}else r.value=h.contentRect.width,l.value=h.contentRect.height},t);nc(()=>{const h=Nt(n);h&&(r.value="offsetWidth"in h?h.offsetWidth:e.width,l.value="offsetHeight"in h?h.offsetHeight:e.height)});const c=d.watch(()=>Nt(n),h=>{r.value=h?e.width:0,l.value=h?e.height:0});function u(){a(),c()}return{width:r,height:l,stop:u}}function Y0(n={}){const{window:e=Ln,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=n,r=d.ref(t),l=d.ref(i),a=()=>{e&&(o?(r.value=e.innerWidth,l.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight))};if(a(),nc(a),U0("resize",a,{passive:!0}),s){const c=Q0("(orientation: portrait)");d.watch(c,()=>a())}return{width:r,height:l}}const V0={class:"title"},W0={class:"actions"},z0={class:"card-body"},j0=d.defineComponent({__name:"LeitingDraggableCard",props:{visible:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},title:{type:String,default:"Title"},initialPosition:{type:Object,default:()=>({x:0,y:0})},width:{type:[Number,String],default:200},minWidth:{type:Number,default:200},fullHeight:{type:Boolean,default:!1},align:{type:String,default:""}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=d.inject("leiting-theme",d.ref("dark")),s=e,o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:M=>{s("update:visible",M),s("update:open",M)}}),r=d.ref(null),l=d.ref(t.initialPosition?.x||0),a=d.ref(t.initialPosition?.y||0),c=d.ref(t.width),u=d.ref(t.fullHeight?"100%":"600px");d.watch(()=>t.fullHeight,M=>{M?u.value="100%":u.value==="100%"&&(u.value="600px")});const{height:h}=Y0();d.watch(h,()=>{t.fullHeight&&(u.value="100%")});const f=d.ref(!1),p=M=>{f.value=!0,M.preventDefault(),M.stopPropagation();const T=M.clientX,S=M.clientY,I=typeof c.value=="number"?c.value:r.value?.offsetWidth||0,g=typeof u.value=="number"?u.value:r.value?.offsetHeight||0,k=F=>{if(!f.value)return;F.preventDefault();const L=F.clientX-T,G=F.clientY-S,O=I+L,v=g+G;O>100&&(c.value=O),v>100&&(u.value=v)},P=()=>{f.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",P)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",P)},A=d.computed(()=>({left:`${l.value}px`,top:`${a.value}px`,width:typeof c.value=="number"?`${c.value}px`:c.value,height:typeof u.value=="number"?`${u.value}px`:u.value,position:"absolute",zIndex:2e3})),C=()=>{d.nextTick(()=>{if(r.value){const M=r.value.offsetParent||document.body,T=M.clientWidth,S=M.clientHeight,I=typeof c.value=="number"?c.value:r.value.offsetWidth||350,g=typeof u.value=="number"?u.value:r.value.offsetHeight||600;l.value+I>T&&(l.value=Math.max(0,T-I-20)),a.value+g>S&&(a.value=Math.max(0,S-g-20)),l.value<0&&(l.value=0),a.value<0&&(a.value=0)}})},m=d.ref(!1),y=M=>{if(M.target.closest(".close-btn")||M.target.closest(".actions"))return;m.value=!0,M.preventDefault(),M.stopPropagation();const T=M.clientX,S=M.clientY,I=l.value,g=a.value,k=F=>{if(!m.value)return;F.preventDefault();const L=F.clientX-T,G=F.clientY-S;l.value=I+L,a.value=g+G},P=()=>{m.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",P),C()};document.addEventListener("mousemove",k),document.addEventListener("mouseup",P)},E=()=>{d.nextTick(()=>{if(t.align&&r.value){const M=r.value.offsetParent||document.body,T=typeof c.value=="number"?c.value:r.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,M.clientWidth-T-20):t.align==="center"&&(l.value=Math.max(0,(M.clientWidth-T)/2))}C()})};d.onMounted(()=>{t.align?E():C()}),d.watch(o,M=>{M&&(t.align?E():C())});const x=()=>{o.value=!1,s("close")};return(M,T)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{ref_key:"cardRef",ref:r,class:d.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+d.unref(i)]]),style:d.normalizeStyle(A.value)},[d.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:y},[d.createElementVNode("span",V0,d.toDisplayString(n.title),1),d.createElementVNode("div",W0,[d.renderSlot(M.$slots,"header-extra",{},void 0,!0),d.createElementVNode("span",{class:"close-btn",onClick:x},"×")])],544),d.createElementVNode("div",z0,[d.renderSlot(M.$slots,"default",{},void 0,!0)]),d.createElementVNode("div",{class:"resize-handle",onMousedown:p},[...T[0]||(T[0]=[d.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[d.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32)],6)),[[d.vShow,o.value]])}}),Ue=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},Re=Ue(j0,[["__scopeId","data-v-4db89eda"]]);function $0(n){const e=d.ref([]),t=d.ref([]),i=d.ref([]),s=d.ref(""),o=d.ref(!0);d.watch(()=>d.unref(n),h=>{if(!h||h.length===0)return;const f=[],p=(m,y)=>{m.forEach(E=>{const x=E.id||E.key||E.$id,M=E.modelId||y;M&&(E.modelId=M),x&&f.push(x),E.children&&E.children.length>0&&p(E.children,M)})};p(h);const A=new Set(i.value);let C=!1;f.forEach(m=>{A.has(m)||(A.add(m),C=!0)}),C&&(i.value=Array.from(A))},{immediate:!0,deep:!0});const r=d.computed(()=>{const h=d.unref(n);if(!h)return[];const f=[],p=(A,C)=>{A.forEach(m=>{const y=m.id||m.key||m.$id,E=m.name||m.title;f.push({key:y,title:E,parentKey:C}),m.children&&m.children.length>0&&p(m.children,y)})};return p(h),f}),l=h=>{e.value=h,o.value=!1},a=h=>{i.value=h},c=h=>{t.value=h},u=h=>r.value.find(p=>p.key===h)?.parentKey;return d.watch(s,h=>{if(!h)return;const p=r.value.filter(C=>C.title&&C.title.toLowerCase().includes(h.toLowerCase())).map(C=>C.parentKey),A=new Set;p.forEach(C=>{let m=C;for(;m;)A.add(m),m=u(m)}),e.value=[...A],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:i,searchValue:s,autoExpandParent:o,onExpand:l,onCheck:a,onSelect:c}}const K0={class:"search-box"},X0={key:0},q0={style:{color:"#f50"}},J0={key:1},Z0={key:1,class:"empty-tip"},Pi=Ue(d.defineComponent({__name:"LeitingTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"构件树"},width:{type:[Number,String],default:320},treeData:{type:Array,default:()=>[]},initialPosition:{type:Object,default:()=>({x:0,y:0})},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close","select","check"],setup(n,{emit:e}){const t=me.Input.Search,i=me.Tree,s=n,o=e,r=d.inject("leiting-theme",d.ref("dark")),l=d.inject("leitingMethods"),a=g=>{l?.value?.onSearchComponent&&l.value.onSearchComponent(g)},c=d.computed({get:()=>s.open!==void 0?s.open:s.visible,set:g=>{o("update:visible",g),o("update:open",g)}}),u=d.ref(null),{height:h}=G0(u),f=d.computed(()=>h.value||300),p=d.ref({children:"children",title:"name",key:"id"}),{expandedKeys:A,selectedKeys:C,checkedKeys:m,searchValue:y,autoExpandParent:E}=$0(d.toRef(s,"treeData")),x=g=>{A.value=g,E.value=!1},M=g=>{const k=[],P=F=>{if(!F.children||F.children.length===0){const G=F.element_Id;F.modelId&&G&&k.push({modelId:F.modelId,elementId:G})}else F.children.forEach(P)};return P(g),k},T=(g,k)=>{m.value=g,o("check",g,k);const P=M(k.node).map(F=>({...F,show:k.checked}));l?.value?.setComponentVisibility&&l.value.setComponentVisibility(P),l?.value?.onTreeCheck&&l.value.onTreeCheck(g,k)},S=(g,k)=>{if(C.value=g,o("select",g,k),k.selected){const P=M(k.node);P.length>0&&l?.value?.flyToObjects&&l.value.flyToObjects({selectCpts:P})}l?.value?.onTreeSelect&&l.value.onTreeSelect(g,k)},I=()=>{o("update:visible",!1),o("close")};return(g,k)=>(d.openBlock(),d.createBlock(Re,{visible:c.value,"onUpdate:visible":k[1]||(k[1]=P=>c.value=P),title:n.title,"initial-position":n.initialPosition,"full-height":n.fullHeight,onClose:I},{default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["leiting-tree-container",[`theme-${d.unref(r)}`]])},[d.createElementVNode("div",K0,[d.createVNode(d.unref(t),{value:d.unref(y),"onUpdate:value":k[0]||(k[0]=P=>d.isRef(y)?y.value=P:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:a},null,8,["value"])]),d.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:u},[n.treeData&&n.treeData.length?(d.openBlock(),d.createBlock(d.unref(i),{key:0,"tree-data":n.treeData,"field-names":p.value,height:f.value,"expanded-keys":d.unref(A),"auto-expand-parent":d.unref(E),"selected-keys":d.unref(C),"checked-keys":d.unref(m),checkable:"",virtual:"","block-node":"",onExpand:x,onSelect:S,onCheck:T},{title:d.withCtx(({name:P,title:F})=>[(P||F)&&d.unref(y)&&(P||F).toLowerCase().indexOf(d.unref(y).toLowerCase())>-1?(d.openBlock(),d.createElementBlock("span",X0,[d.createTextVNode(d.toDisplayString((P||F).substr(0,(P||F).toLowerCase().indexOf(d.unref(y).toLowerCase())))+" ",1),d.createElementVNode("span",q0,d.toDisplayString(d.unref(y)),1),d.createTextVNode(" "+d.toDisplayString((P||F).substr((P||F).toLowerCase().indexOf(d.unref(y).toLowerCase())+d.unref(y).length)),1)])):(d.openBlock(),d.createElementBlock("span",J0,d.toDisplayString(P||F),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(d.openBlock(),d.createElementBlock("div",Z0,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-09851d81"]]),eC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAERSURBVDhPvZTrEYIwEISTCrQD6EA7gA60AylBK1Aq0A7ECrQDoQPsADrACuLuTMJkIiHxjzezgyR7H3d5KJVSqRAigcaQUjYYX2JgZY/P/O4lEgYYFo7pgPcc2kSCBoIUzDeo0klPPEsNYlX7AKzA/M6ASrRzYoIGG5DAOCvzBvzMOxqQazSgLLI1QdAW5jWpUAPV0AVKIc7FRCuNy7RkWozJtj1BED7ANbpDXHhffFXUwUnZwRYp7qw7Rx8/lLkV9R4QD2w1A8pjW3sA4h5au+pXEBS76P8D6Ut9/nXXaiRQdnBXqBfEC+4GdzSxW5v6F7CTeHnbCVCBsWIE+RYVrdF4DSz6OwgiADDexbmT3X0A4fSDfDjUugcAAAAASUVORK5CYII=",tC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",nC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHDSURBVDhPlZOxL0NRFIe9ECubhehoIIjJ1HYwCkIiJpUQEkN1YZBobU0kFKNI3iTGYrDRv0BIhLXCYpCwiO35fs25zWva98JNvpz37j33d8+551yvLWIEQXDG0izMe55XjvJz816MUJG1LVuvYJcQrEb5xwkV2JSHGfAhgBJiu63E4oSUzpRtusa+wBooKkWnKOujQYh7SbCShQx0m9cpds4iOseOw7BFmUPwU341IQT2MaOQgi9QND+wiqNnBxT4X7SIbrAqhNI9wiUvJ+W8A99wDEWdwrw25iVkkenAEb5LkIQPuIMJWJGQoriFd+iBCkhc8zUhfJSm7mva5l3aadubDgtpMgGKpB/eoBfuQZFoPNhBj9gTaC3kKkEEGXPswF7Y5rLro1AW8UI6GmelmAzfkUWlNaWt6/iT0DOOA5bqoSuzHfIvofATqSJQb8KoiJbtPi6x2dA9FPjXE1F/uZKrv3IwCFcNqVmoPlal7QJ9q/wZCbk7Ioo9/tehE9q1r0nIxNQbG4YEXdkVjQ5J2OZXbB88gVrgQIJNj9aaT4LboPK7J6O0Ktb1KYtc/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",iC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",sC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",oC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1Ns+yrIe0EH7HPC8YnyGjAegkEB5cYyiwrdWXIEc1xnSREGcuiTQEWeg7gG4+CMcl9ALnLkvogwScv+wq6FMQJJCJDgBtBcSAI3QClwe2YZAHcY2Ho4kGAVLA6U5/CEvdp4KYhesFhBPpCZIAz6jStHhproJcHyAHbb5nF+6RZ8CsGslIQaHp/gSxRzlApU4GugPxNuDN/eNarAJxapUPgm8rQ9C1SAI9AOGiHhGApSdnRN8FshbEiLwiLI1rMUM6zSQ0tX9c2lp/Iw0iMIPU38iFIN1mTmOjKa98vyWB4QM5XQnvsbFsyAAAAABJRU5ErkJggg==",rC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",aC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",lC={class:"menu-container"},cC=["onClick","title"],dC={class:"menu-icon"},uC=["src","alt"],hC={key:3,style:{"font-size":"12px"}},fC={key:0,class:"sub-menu"},pC=["onClick"],Nn=d.defineComponent({__name:"LeitingMenu",props:{visible:{type:Boolean,default:!0},activeIds:{type:Array,default:()=>[]},is2d:{type:Boolean,default:!1},customItems:{type:Array,default:()=>[]}},emits:["action"],setup(n,{emit:e}){const t=n,i=d.inject("leiting-theme",d.ref("dark")),s=d.inject("leiting-menu-size",d.ref("medium")),o=d.inject("leitingMethods",d.ref({})),r=d.computed(()=>i.value||i),l=d.computed(()=>s.value||s),a=d.ref([{ID:"home",title:"主视角",src:eC,key:"homeView"},{ID:"tree",title:"目录树",src:sc,key:"componentTree"},{ID:"cadLayer",title:"图层",src:sc,key:"cadLayer"},{ID:"measure",title:"量算",src:tC,key:"measurement"},{ID:"section",title:"剖切",src:nC,key:"section"},{ID:"roam",title:"人物漫游",src:iC,key:"roam"},{ID:"info",title:"构件信息",src:sC,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:oC,key:"cadPosition"},{ID:"annotation",title:"标注",src:aC,key:"annotation"},{ID:"setting",title:"设置",src:rC,key:"setting"}]),c=d.ref([]),u=d.ref([...t.activeIds]);d.watch(()=>t.activeIds,T=>{u.value=[...T]},{deep:!0});const h=d.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",T=>{c.value=T}),o.value.menuEvents.on("setMenuActive",(T,S)=>{S?u.value.includes(T)||u.value.push(T):u.value=u.value.filter(I=>I!==T)}));const f=d.computed(()=>{let T=a.value;if(t.is2d){const S=["homeView","measurement","cadLayer","annotation"];T=T.filter(I=>I.key&&S.includes(I.key))}else{const S=["cadLayer","cadPosition","annotation"];T=T.filter(I=>!I.key||!S.includes(I.key))}if(c.value.length>0&&(T=T.filter(S=>!S.key||!c.value.includes(S.key))),t.customItems&&t.customItems.length>0){const S=t.customItems.map(I=>({...I,key:I.ID,src:I.src||I.icon}));return[...T,...S]}return T}),p=e,A=T=>{const S=["homeView"];if(T.key&&S.includes(T.key))u.value.includes(T.ID)||(u.value.push(T.ID),setTimeout(()=>{const g=u.value.indexOf(T.ID);g>-1&&u.value.splice(g,1)},1e3));else{const g=u.value.indexOf(T.ID);g>-1?u.value.splice(g,1):u.value.push(T.ID)}const I=u.value.includes(T.ID);T.func&&T.func(T),T.key&&p("action",T.key,I)},C=T=>{a.value=[...a.value,...T]},m=T=>{c.value=T},y=T=>{console.log("LeitingMenu received showMenu event:",T)},E=(T,S)=>{const I=a.value.find(g=>g.ID===T||g.key===T);if(I){const g=u.value.indexOf(I.ID);S&&g===-1?u.value.push(I.ID):!S&&g>-1&&u.value.splice(g,1)}};let x=null;const M=()=>{o.value?.menuEvents&&(x&&(x.off("insertMenu",C),x.off("setMenuListFilter",m),x.off("showMenu",y),x.off("setMenuActive",E)),x=o.value.menuEvents,x.on("insertMenu",C),x.on("setMenuListFilter",m),x.on("showMenu",y),x.on("setMenuActive",E))};return d.onMounted(()=>{M()}),d.onUnmounted(()=>{x&&(x.off("insertMenu",C),x.off("setMenuListFilter",m),x.off("showMenu",y),x.off("setMenuActive",E))}),d.watch(o,()=>{M()},{deep:!0}),(T,S)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+l.value]])},[d.createElementVNode("div",lC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.ID,class:d.normalizeClass(["menu-item",{active:u.value.includes(I.ID)}]),onClick:g=>A(I),title:I.title},[d.createElementVNode("div",dC,[I.src?(d.openBlock(),d.createElementBlock("img",{key:0,src:I.src,alt:I.title},null,8,uC)):typeof I.icon=="object"?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(I.icon),{key:1})):typeof I.icon=="string"?(d.openBlock(),d.createElementBlock("i",{key:2,class:d.normalizeClass(["iconfont",`icon-${I.icon}`])},null,2)):(d.openBlock(),d.createElementBlock("span",hC,d.toDisplayString(I.title.substring(0,2)),1))]),I.children&&I.children.length>0?(d.openBlock(),d.createElementBlock("div",fC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(I.children,g=>(d.openBlock(),d.createElementBlock("div",{key:g.ID,class:d.normalizeClass(["sub-menu-item",{active:u.value.includes(g.ID)}]),onClick:d.withModifiers(k=>A(g),["stop"])},d.toDisplayString(g.title),11,pC))),128))])):d.createCommentVNode("",!0)],10,cC))),128))])],2)),[[d.vShow,h.value]])}}),gC={class:"leiting-section-content"},mC={class:"section-form-item"},AC={class:"radio-group"},yC={class:"section-form-item"},CC={class:"switch-container"},EC={class:"switch"},wC={class:"status-text"},bC={class:"section-form-item slider-item"},vC={class:"slider-wrapper"},xC={class:"section-form-item slider-item"},IC={class:"slider-wrapper"},BC={class:"section-form-item slider-item"},SC={class:"slider-wrapper"},MC={class:"section-form-item table-item"},TC={class:"model-table-container"},DC={class:"model-table"},kC={width:"40"},PC=["checked"],FC=["onClick"],RC=["value"],OC={class:"model-name"},Un=Ue(d.defineComponent({__name:"LeitingSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"剖切控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:O=>{i("update:visible",O),i("update:open",O)}}),r=d.ref("Box"),l=d.ref(!1),a=d.ref([]),c=d.ref([]),u=d.computed(()=>c.value.length===0?!1:c.value.every(O=>a.value.includes(O.modelId))),h=O=>{O.target.checked?a.value=c.value.map(w=>w.modelId):a.value=[],k()},f=d.ref([-10,10]),p=d.ref([-10,10]),A=d.ref([-10,10]),C=d.ref([-100,100]),m=d.ref([-100,100]),y=d.ref([-100,100]);let E=!1;const x=O=>{E=!0;const{targetZPlus:v,targetZMinus:w,targetXPlus:b,targetXMinus:B,targetYPlus:R,targetYMinus:U}=O;A.value=[-w,v],f.value=[-B,b],p.value=[-U,R],setTimeout(()=>{E=!1},100)},M=()=>{E||a.value.length===0||!s?.value?.updateSectionRange||s.value.updateSectionRange({targetZPlus:A.value[1],targetZMinus:-A.value[0],targetXPlus:f.value[1],targetXMinus:-f.value[0],targetYPlus:p.value[1],targetYMinus:-p.value[0]})},T=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)},S=O=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const w=s.value.getMapTileset()[O];if(w&&w.leiting?.box){const{min:b,max:B}=w.leiting.box,R=(B.x-b.x)/2,U=(B.y-b.y)/2,N=(B.z-b.z)/2;a.value.length<=1&&(C.value=[-R*2,R*2],m.value=[-U*2,U*2],y.value=[-N*2,N*2],f.value=[-R,R],p.value=[-U,U],A.value=[-N,N],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:N,targetZMinus:N,targetXPlus:R,targetXMinus:R,targetYPlus:U,targetYMinus:U})),s.value.openSection(O,{moveCallBack:x}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)}},I=O=>{const v=a.value.indexOf(O);v>-1?a.value.splice(v,1):a.value.push(O),k()};let g=[];const k=()=>{const O=a.value.filter(w=>!g.includes(w)),v=g.filter(w=>!a.value.includes(w));O.forEach(w=>S(w)),v.forEach(w=>{s?.value?.closeSection&&s.value.closeSection(w)}),g=[...a.value]},P=()=>{},F=()=>{o.value=!1,i("close")},L=()=>{l.value=!1,a.value=[],g=[],f.value=[-10,10],p.value=[-10,10],A.value=[-10,10],C.value=[-100,100],m.value=[-100,100],y.value=[-100,100]};d.watch(()=>t.visible,O=>{O?G():(s?.value?.closeSection&&s.value.closeSection(),L())});const G=()=>{s?.value&&typeof s.value.getModelList=="function"&&(c.value=s.value.getModelList()||[],c.value.length>0&&a.value.length===0&&(a.value=[c.value[0].modelId],g=[...a.value]),t.visible&&a.value.length>0&&(l.value=!0,a.value.forEach(O=>S(O))))};return d.watch(()=>s?.value,()=>{G()},{immediate:!0,deep:!0}),d.onMounted(()=>{G()}),(O,v)=>(d.openBlock(),d.createBlock(Re,{visible:o.value,title:"剖切分析",width:300,"full-height":n.fullHeight,"onUpdate:visible":F},{default:d.withCtx(()=>[d.createElementVNode("div",gC,[d.createElementVNode("div",mC,[v[8]||(v[8]=d.createElementVNode("span",{class:"label"},"模式",-1)),d.createElementVNode("div",AC,[d.createElementVNode("label",{class:d.normalizeClass(["radio-item",{active:r.value==="Box"}])},[d.withDirectives(d.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":v[0]||(v[0]=w=>r.value=w),onChange:P},null,544),[[d.vModelRadio,r.value]]),v[7]||(v[7]=d.createTextVNode(" 剖切盒 ",-1))],2)])]),d.createElementVNode("div",yC,[v[10]||(v[10]=d.createElementVNode("span",{class:"label"},"显示",-1)),d.createElementVNode("div",CC,[d.createElementVNode("label",EC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":v[1]||(v[1]=w=>l.value=w),onChange:T},null,544),[[d.vModelCheckbox,l.value]]),v[9]||(v[9]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",wC,d.toDisplayString(l.value?"显示":"隐藏"),1)])]),d.createElementVNode("div",bC,[v[11]||(v[11]=d.createElementVNode("span",{class:"label"},"X 轴",-1)),d.createElementVNode("div",vC,[d.createVNode(d.unref(me.Slider),{value:f.value,"onUpdate:value":v[2]||(v[2]=w=>f.value=w),range:"",min:C.value[0],max:C.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",xC,[v[12]||(v[12]=d.createElementVNode("span",{class:"label"},"Y 轴",-1)),d.createElementVNode("div",IC,[d.createVNode(d.unref(me.Slider),{value:p.value,"onUpdate:value":v[3]||(v[3]=w=>p.value=w),range:"",min:m.value[0],max:m.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",BC,[v[13]||(v[13]=d.createElementVNode("span",{class:"label"},"Z 轴",-1)),d.createElementVNode("div",SC,[d.createVNode(d.unref(me.Slider),{value:A.value,"onUpdate:value":v[4]||(v[4]=w=>A.value=w),range:"",min:y.value[0],max:y.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",MC,[v[15]||(v[15]=d.createElementVNode("span",{class:"label"},"模型",-1)),d.createElementVNode("div",TC,[d.createElementVNode("table",DC,[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[d.createElementVNode("th",kC,[d.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:h},null,40,PC)]),v[14]||(v[14]=d.createElementVNode("th",null,"名称",-1))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,w=>(d.openBlock(),d.createElementBlock("tr",{key:w.modelId,class:d.normalizeClass({selected:a.value.includes(w.modelId)}),onClick:b=>I(w.modelId)},[d.createElementVNode("td",null,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:w.modelId,"onUpdate:modelValue":v[5]||(v[5]=b=>a.value=b),onClick:v[6]||(v[6]=d.withModifiers(()=>{},["stop"])),onChange:k},null,40,RC),[[d.vModelCheckbox,a.value]])]),d.createElementVNode("td",OC,d.toDisplayString(w.modelName),1)],10,FC))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-519b564b"]]),LC={class:"leiting-player-content"},NC={class:"player-form-item"},UC={class:"switch-container"},_C={class:"switch"},QC={class:"status-text"},HC={class:"player-form-item"},GC={class:"switch-container"},YC={class:"switch"},VC={class:"status-text"},WC={class:"player-form-item"},zC={class:"switch-container"},jC={class:"switch"},$C={class:"status-text"},KC={class:"player-form-item slider-item"},XC={class:"slider-wrapper"},qC={class:"value-text"},JC={class:"instructions"},ZC={class:"key-map"},eE={class:"key-row"},tE={class:"key-row"},nE={class:"key-row"},iE={class:"key-row"},sE={class:"key-row"},oE={class:"key-row"},_n=Ue(d.defineComponent({__name:"LeitingPlayer",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"漫游控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref(!1),r=d.ref(!1),l=d.ref(!0),a=d.ref(.5),c=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:S=>{i("update:visible",S),i("update:open",S)}}),u=d.ref(null),h=d.ref(null),f=d.ref(null),p=d.ref(null),A=d.ref(null),C=d.ref(null),m=()=>{o.value?E():x()},y=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:l.value})},E=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(a.value),y(),s.value.bindPlayerUiKeys&&(await d.nextTick(),s.value.bindPlayerUiKeys({moveFront:u.value,moveBack:h.value,moveLeft:f.value,moveRight:p.value,moveUp:A.value,moveDown:C.value})))},x=()=>{s?.value?.closePlayer&&s.value.closePlayer()},M=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(a.value)},T=()=>{c.value=!1,i("close")};return d.watch(()=>t.visible,S=>{S?(o.value=!0,s?.value?E():setTimeout(()=>{s?.value&&E()},100)):o.value&&(o.value=!1,x())},{immediate:!0}),(S,I)=>(d.openBlock(),d.createBlock(Re,{title:n.title,visible:c.value,width:200,"full-height":n.fullHeight,"onUpdate:visible":T},{default:d.withCtx(()=>[d.createElementVNode("div",LC,[d.createElementVNode("div",NC,[I[5]||(I[5]=d.createElementVNode("span",{class:"label"},"启用",-1)),d.createElementVNode("div",UC,[d.createElementVNode("label",_C,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[0]||(I[0]=g=>o.value=g),onChange:m},null,544),[[d.vModelCheckbox,o.value]]),I[4]||(I[4]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",QC,d.toDisplayString(o.value?"开启":"关闭"),1)])]),d.createElementVNode("div",HC,[I[7]||(I[7]=d.createElementVNode("span",{class:"label"},"重力",-1)),d.createElementVNode("div",GC,[d.createElementVNode("label",YC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[1]||(I[1]=g=>r.value=g),onChange:y},null,544),[[d.vModelCheckbox,r.value]]),I[6]||(I[6]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",VC,d.toDisplayString(r.value?"开启":"关闭"),1)])]),d.createElementVNode("div",WC,[I[9]||(I[9]=d.createElementVNode("span",{class:"label"},"碰撞",-1)),d.createElementVNode("div",zC,[d.createElementVNode("label",jC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[2]||(I[2]=g=>l.value=g),onChange:y},null,544),[[d.vModelCheckbox,l.value]]),I[8]||(I[8]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",$C,d.toDisplayString(l.value?"开启":"关闭"),1)])]),d.createElementVNode("div",KC,[I[10]||(I[10]=d.createElementVNode("span",{class:"label"},"速度",-1)),d.createElementVNode("div",XC,[d.createVNode(d.unref(me.Slider),{value:a.value,"onUpdate:value":I[3]||(I[3]=g=>a.value=g),min:.1,max:4,step:.1,onChange:M},null,8,["value"])]),d.createElementVNode("span",qC,d.toDisplayString(a.value),1)]),I[19]||(I[19]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",JC,[I[18]||(I[18]=d.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),d.createElementVNode("div",ZC,[d.createElementVNode("div",eE,[d.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:u},"W",512),I[11]||(I[11]=d.createTextVNode(" 前进 ",-1))]),d.createElementVNode("div",tE,[d.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:h},"S",512),I[12]||(I[12]=d.createTextVNode(" 后退 ",-1))]),d.createElementVNode("div",nE,[d.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:f},"A",512),I[13]||(I[13]=d.createTextVNode(" 左移 ",-1))]),d.createElementVNode("div",iE,[d.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:p},"D",512),I[14]||(I[14]=d.createTextVNode(" 右移 ",-1))]),d.createElementVNode("div",sE,[d.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:A},"Q",512),I[15]||(I[15]=d.createTextVNode(" 上升 ",-1))]),d.createElementVNode("div",oE,[d.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:C},"E",512),I[16]||(I[16]=d.createTextVNode(" 下降 ",-1))]),I[17]||(I[17]=d.createElementVNode("div",{class:"key-row"},[d.createElementVNode("span",{class:"mouse-icon"},"🖱️"),d.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-cb96e806"]]),rE={class:"info-content"},aE={key:0,class:"component-title"},Qn=Ue(d.defineComponent({__name:"LeitingInfo",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),l=d.ref([]),a=d.ref([]),c=d.ref(0),u=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:y=>{i("update:visible",y),i("update:open",y)}}),h=()=>{u.value=!1},f=y=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[y]||y,p=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],A=async y=>{const E=++c.value;if(a.value=y,!y||y.length===0){o.value=[];return}if(!u.value)return;let x=y;y.length>10&&(ge.warning(`选中构件数量过多(${y.length}个),仅显示前10个`),x=y.slice(0,10));const M=s?.value;let T=M?.getMapTileset?M.getMapTileset():{};const S=new Set;if(x.forEach(g=>{const k=T[g.modelId];k&&k.leiting&&!k.leiting?.node?.nodeExtras&&k.leiting.model?.nodeUrl&&S.add(g.modelId)}),S.size>0&&M?.loadNodeDetailsForModel){r.value=!0;try{const g=Array.from(S).map(k=>M.loadNodeDetailsForModel(k));await Promise.all(g)}catch(g){console.error("Failed to load node details",g)}}if(E!==c.value)return;T=M?.getMapTileset?M.getMapTileset():{};const I=[];x.forEach((g,k)=>{const F=T[g.modelId]?.leiting||{};let L={modelName:F.model?.modelId||g.modelId};L.elementID||(L.elementID=g.elementId);const G=F.node?.nodeExtras?.element||F.node?.nodeExtras;let O=null;if(G){const b=L.elementID;G[b]&&(O=G[b])}O&&O.box3&&(L.length=`${O.box3.length?.toFixed(2)||0}米`,L.width=`${O.box3.width?.toFixed(2)||0}米`,L.height=`${O.box3.height?.toFixed(2)||0}米`);const v=[];O&&(O.name&&(L.elementName=O.name),O.categoryName&&(L.categoryName=O.categoryName),O.familySymbolName&&(L.familySymbolName=O.familySymbolName),O.levelName&&(L.levelName=O.levelName));const w={};if(p.forEach(b=>{L[b]!==void 0&&(w[b]=L[b])}),v.push({name:"基础信息",params:w}),O){const b=Array.isArray(O)?O:Array.isArray(O?.parameters)?O.parameters:null;if(b){if(b.flat().forEach(R=>{if(R&&R.GroupName&&Array.isArray(R.Parameters)){const U={};R.Parameters.forEach(N=>{N.name&&(U[N.name]=N.value??"")}),Object.keys(U).length>0&&v.push({name:R.GroupName,params:U})}}),!Array.isArray(O)){const{parameters:R,...U}=O,N={};Object.keys(U).forEach(D=>{!p.includes(D)&&D!=="uniqueId"&&typeof U[D]!="object"&&(N[D]=U[D])}),Object.keys(N).length>0&&v.push({name:"其他属性",params:N})}}else{let B=!1;if(Object.keys(O).forEach(R=>{O[R]&&typeof O[R]=="object"&&!Array.isArray(O[R])&&(B=!0,v.push({name:R,params:O[R]}))}),!B){const R={};Object.keys(O).forEach(U=>{if(!p.includes(U)&&U!=="batchId"){const N=O[U];typeof N=="string"&&N.length>500?R[U]=N.substring(0,500)+"...":R[U]=N}}),Object.keys(R).length>0&&v.push({name:"属性",params:R})}}}I.push({id:k,title:`${L.modelName}${L.elementName?` - ${L.elementName}`:""}`,groups:v})}),o.value=I,E===c.value&&(r.value=!1),I.length>0?l.value=[`${I[0].id}-基础信息`]:l.value=[]};let C=!1;const m=()=>{if(C)return;const y=s?.value;y&&y.selectionChange&&(y.selectionChange(A),C=!0)};return d.watch(()=>s?.value,()=>{m()},{deep:!0,immediate:!0}),d.watch(u,y=>{y&&a.value.length>0&&A(a.value)}),d.onMounted(()=>{m()}),(y,E)=>(d.openBlock(),d.createBlock(Re,{visible:u.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":n.fullHeight,onClose:h,"onUpdate:visible":E[1]||(E[1]=x=>u.value=x),class:"base-info-card"},{default:d.withCtx(()=>[d.createElementVNode("div",rE,[d.createVNode(d.unref(me.Spin),{spinning:r.value},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",aE,d.toDisplayString(x.title),1)):d.createCommentVNode("",!0),d.createVNode(d.unref(me.Collapse),{activeKey:l.value,"onUpdate:activeKey":E[0]||(E[0]=M=>l.value=M),ghost:"","expand-icon-position":"end"},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.groups,M=>(d.openBlock(),d.createBlock(d.unref(me.CollapsePanel),{key:`${x.id}-${M.name}`,header:M.name},{default:d.withCtx(()=>[d.createVNode(d.unref(me.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(M.params,(T,S)=>(d.openBlock(),d.createBlock(d.unref(me.DescriptionsItem),{key:S,label:f(String(S))},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(T),1)]),_:2},1032,["label"]))),128))]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:2},1032,["activeKey"])]))),128))]),_:1},8,["spinning"])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-22d6fc85"]]);class oc{viewer;Cesium;pickHandler=null;bimEntityId="";mapEntityId="";constructor(e,t){this.viewer=e,this.Cesium=t}removeMarker(e){if(!this.viewer)return;const t=e==="BIM"?this.bimEntityId:this.mapEntityId;t&&(this.viewer.entities.removeById(t),e==="BIM"?this.bimEntityId="":this.mapEntityId="")}clearMarkers(){this.removeMarker("BIM"),this.removeMarker("MAP")}addMarker(e,t){if(!this.viewer||!this.Cesium)return;this.removeMarker(e);const i=`adjust-marker-${e}-${Date.now()}`;e==="BIM"?this.bimEntityId=i:this.mapEntityId=i,this.viewer.entities.add({id:i,position:this.Cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),point:{pixelSize:10,color:e==="BIM"?this.Cesium.Color.RED:this.Cesium.Color.ORANGE,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:`${e==="BIM"?"BIM":"地图"}标记点`,font:"14pt sans-serif",style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:new this.Cesium.Cartesian2(0,-10),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,backgroundColor:new this.Cesium.Color(.1,.1,.1,.8),showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}registerPickHandler(e){this.destroyPickHandler(),!(!this.Cesium||!this.viewer)&&(this.pickHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pickHandler.setInputAction(t=>{let i;try{i=this.viewer.scene.pickPosition(t.position)}catch(s){console.warn("pickPosition failed:",s)}if(!i){const s=this.viewer.camera.getPickRay(t.position);i=this.viewer.scene.globe.pick(s,this.viewer.scene)}if(i||(i=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid)),i){const s=this.Cesium.Cartographic.fromCartesian(i),o=this.Cesium.Math.toDegrees(s.longitude),r=this.Cesium.Math.toDegrees(s.latitude),l=s.height;e({longitude:o,latitude:r,height:l})}},this.Cesium.ScreenSpaceEventType.LEFT_CLICK,this.Cesium.KeyboardEventModifier.SHIFT))}destroyPickHandler(){this.pickHandler&&(this.pickHandler.destroy(),this.pickHandler=null)}calculateOffset(e,t){return{dLon:t.longitude-e.longitude,dLat:t.latitude-e.latitude,dHeight:t.height-e.height}}}const lE={class:"adjust-panel"},cE={class:"control-panel"},dE={class:"form-item"},uE={class:"radio-group"},hE={class:"form-item"},fE={class:"radio-group"},pE={class:"form-item"},gE={class:"value"},mE={class:"param-row"},AE={class:"param-row"},yE={class:"param-row"},CE={class:"param-row"},EE={class:"param-row"},wE={class:"param-row"},bE={class:"param-row"},vE={class:"button-grid"},xE={key:1,class:"pick-mode-ui"},IE={class:"form-item",style:{display:"block","margin-bottom":"15px"}},BE={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},SE=["checked"],ME={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},TE={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},DE={class:"form-item",style:{display:"block","margin-bottom":"15px"}},kE={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},PE=["checked"],FE={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},RE={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},OE={class:"list-panel"},LE={class:"list-header"},NE={class:"col-check"},UE=["checked"],_E={class:"list-body"},QE={class:"col-check"},HE=["onUpdate:modelValue"],GE={class:"col-index"},YE=["title"],VE={class:"col-main"},WE=["checked","onChange"],Hn=Ue(d.defineComponent({__name:"LeitingPosition",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close","save"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=d.computed({get:()=>i.open!==void 0?i.open:i.visible,set:N=>{s("update:visible",N),s("update:open",N)}}),r=d.inject("leitingMethods"),l=d.ref("BIM"),a=d.ref("param"),c=d.ref(""),u=d.ref([]),h=d.ref("BIM"),f=d.ref(null),p=d.ref(null),A=d.ref(null),C=()=>(!A.value&&r?.value?.getViewer&&r?.value?.getCesium&&(A.value=new oc(r.value.getViewer(),r.value.getCesium())),A.value),m=()=>{C()?.clearMarkers(),f.value=null,p.value=null},y=(N,D)=>{N==="BIM"?f.value=D:p.value=D,C()?.addMarker(N,D),ge.success(`${N==="BIM"?"BIM":"地图"}标记点已添加`)},E=()=>{C()?.registerPickHandler(N=>{y(h.value,N)})},x=()=>{C()?.destroyPickHandler()},M=()=>{if(!f.value||!p.value){ge.warning("请先选择BIM标记点和地图标记点");return}if(!c.value){ge.warning("请先选择主模型");return}const N=C();let D=0,Q=0,V=0;if(N){const{dLon:$,dLat:J,dHeight:ne}=N.calculateOffset(f.value,p.value);D=$,Q=J,V=ne}else D=p.value.longitude-f.value.longitude,Q=p.value.latitude-f.value.latitude,V=p.value.height-f.value.height;S.value.longitude+=D,S.value.latitude+=Q,S.value.height+=V,w(c.value,{longitude:S.value.longitude,latitude:S.value.latitude,height:S.value.height}),ge.success("位置已调整")};d.watch(()=>a.value,N=>{N==="pick"?E():x()}),e({addMarker:y,setModelType:N=>{(N==="BIM"||N==="OSGB")&&(l.value=N)}});const S=d.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),I=d.computed(()=>{const N=u.value.find(D=>D.modelId===c.value);return N?N.modelName:""}),g=d.computed(()=>P.value.length>0&&P.value.every(N=>N.selected)),k=()=>{o.value=!1,s("close")},P=d.computed(()=>u.value.filter(N=>N.type===l.value)),F=N=>{const D=N.target.checked;P.value.forEach(Q=>Q.selected=D)},L=()=>{if(!r?.value)return;const N=r.value,D=N.getMapTileset?N.getMapTileset():{},Q=[];if(Object.keys(D).forEach(V=>{const J=D[V].leiting||{};J.model&&Q.push({modelId:J.model.modelId,modelName:J.model.modelName,selected:!1,formData:J.model.formData||{},dbName:J.model.dbName,url:J.model.url,type:J.model.type||"BIM"})}),u.value=Q,Q.length>0){const V=N.getBIMmodelId?N.getBIMmodelId():"";V&&Q.find($=>$.modelId===V)?O(V):O(Q[0].modelId),Q.forEach($=>$.selected=!0)}},G=()=>{ge.info("拖动右下角标,可显示模型列表",void 0,2)},O=N=>{c.value=N;const D=u.value.find(Q=>Q.modelId===N);D&&D.formData&&Object.keys(S.value).forEach(Q=>{D.formData[Q]!==void 0&&(S.value[Q]=D.formData[Q])})},v=N=>r?.value?.getMapTileset?r.value.getMapTileset()[N]:null,w=(N,D)=>{const Q=v(N),V=r.value.getCesium();if(Q&&V){if(Q.leiting?.model){Q.leiting.model.formData={...Q.leiting.model.formData,...D};const $=u.value.find(J=>J.modelId===N);$&&($.formData=Q.leiting.model.formData)}dr({Cesium:V,tileset:Q})}},b=N=>{if(!c.value)return;const D=S.value[N];w(c.value,{[N]:D})},B=N=>{const D=P.value.filter(J=>J.selected);if(D.length===0){ge.warning("请先选择要调整的模型");return}const{lonlat:Q,heightDistance:V,rotation:$}=S.value;D.forEach(J=>{const ne={...J.formData};switch(N){case"north":ne.latitude+=Q;break;case"south":ne.latitude-=Q;break;case"east":ne.longitude+=Q;break;case"west":ne.longitude-=Q;break;case"up":ne.height+=V;break;case"down":ne.height-=V;break;case"rotateLeft":ne.totalRotation=(ne.totalRotation||0)-$;break;case"rotateRight":ne.totalRotation=(ne.totalRotation||0)+$;break}J.modelId===c.value&&Object.assign(S.value,ne),w(J.modelId,ne)})},R=()=>{if(!c.value){ge.warning("请先选择主模型");return}const N=v(c.value);if(!N||!r?.value?.getViewer)return;const D=r.value.getViewer(),Q=r.value.getCesium(),V=N.boundingSphere;D.camera.flyToBoundingSphere(V,{offset:new Q.HeadingPitchRange(0,Q.Math.toRadians(-90),V.radius*2),duration:1.5})},U=()=>{r?.value?.saveRegion?(r.value.saveRegion(u.value),s("save",d.unref(u))):(console.log("Save models:",u.value),ge.warning("未找到保存接口,数据已打印控制台"))};return d.watch(()=>i.visible,N=>{N?(L(),G(),a.value==="pick"&&E()):(x(),m())}),d.onMounted(()=>{i.visible&&(L(),G(),a.value==="pick"&&E())}),(N,D)=>(d.openBlock(),d.createBlock(Re,{visible:o.value,title:"调整位置(调整前可选择正北俯视)",width:282,"full-height":n.fullHeight,"onUpdate:visible":D[25]||(D[25]=Q=>o.value=Q),onClose:k,onSave:U},{default:d.withCtx(()=>[d.createElementVNode("div",lE,[d.createElementVNode("div",cE,[d.createElementVNode("div",dE,[D[26]||(D[26]=d.createElementVNode("label",null,"模型类型:",-1)),d.createElementVNode("div",uE,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="BIM"}),onClick:D[0]||(D[0]=Q=>l.value="BIM")},"BIM模型",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="OSGB"}),onClick:D[1]||(D[1]=Q=>l.value="OSGB")},"倾斜摄影",2)])]),d.createElementVNode("div",hE,[D[27]||(D[27]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",fE,[d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="param"}),onClick:D[2]||(D[2]=Q=>a.value="param")},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="pick"}),onClick:D[3]||(D[3]=Q=>a.value="pick")},"地图点选",2)])]),d.createElementVNode("div",pE,[D[28]||(D[28]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",gE,d.toDisplayString(I.value||"未选择"),1)]),D[42]||(D[42]=d.createElementVNode("div",{class:"separator"},null,-1)),a.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[D[36]||(D[36]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",mE,[D[29]||(D[29]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[4]||(D[4]=Q=>S.value.longitude=Q),onChange:D[5]||(D[5]=Q=>b("longitude")),step:"0.000001"},null,544),[[d.vModelText,S.value.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",AE,[D[30]||(D[30]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[6]||(D[6]=Q=>S.value.latitude=Q),onChange:D[7]||(D[7]=Q=>b("latitude")),step:"0.000001"},null,544),[[d.vModelText,S.value.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",yE,[D[31]||(D[31]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[8]||(D[8]=Q=>S.value.height=Q),onChange:D[9]||(D[9]=Q=>b("height")),step:"0.1"},null,544),[[d.vModelText,S.value.height,void 0,{number:!0}]])]),d.createElementVNode("div",CE,[D[32]||(D[32]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[10]||(D[10]=Q=>S.value.totalRotation=Q),onChange:D[11]||(D[11]=Q=>b("totalRotation")),step:"1"},null,544),[[d.vModelText,S.value.totalRotation,void 0,{number:!0}]])]),D[37]||(D[37]=d.createElementVNode("div",{class:"separator"},null,-1)),D[38]||(D[38]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",EE,[D[33]||(D[33]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[12]||(D[12]=Q=>S.value.lonlat=Q),step:"0.000001"},null,512),[[d.vModelText,S.value.lonlat,void 0,{number:!0}]])]),d.createElementVNode("div",wE,[D[34]||(D[34]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[13]||(D[13]=Q=>S.value.heightDistance=Q),step:"0.1"},null,512),[[d.vModelText,S.value.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",bE,[D[35]||(D[35]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":D[14]||(D[14]=Q=>S.value.rotation=Q),step:"1"},null,512),[[d.vModelText,S.value.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",vE,[d.createElementVNode("button",{onClick:D[15]||(D[15]=Q=>B("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:D[16]||(D[16]=Q=>B("north"))},"北移"),d.createElementVNode("button",{onClick:D[17]||(D[17]=Q=>B("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:D[18]||(D[18]=Q=>B("west"))},"西移"),d.createElementVNode("button",{onClick:D[19]||(D[19]=Q=>B("south"))},"南移"),d.createElementVNode("button",{onClick:D[20]||(D[20]=Q=>B("east"))},"东移"),d.createElementVNode("button",{onClick:D[21]||(D[21]=Q=>B("up"))},"上移"),d.createElementVNode("button",{onClick:D[22]||(D[22]=Q=>B("down"))},"下移"),d.createElementVNode("button",{onClick:R,class:"primary-btn"},"正北俯视"),d.createElementVNode("button",{onClick:U,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):a.value==="pick"?(d.openBlock(),d.createElementBlock("div",xE,[d.createElementVNode("div",IE,[d.createElementVNode("div",BE,[d.createElementVNode("div",{onClick:D[23]||(D[23]=Q=>h.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:h.value==="BIM",style:{"margin-right":"5px"}},null,8,SE),D[39]||(D[39]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),f.value?(d.openBlock(),d.createElementBlock("div",ME,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(f.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(f.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",TE,"未选择"))])]),d.createElementVNode("div",DE,[d.createElementVNode("div",kE,[d.createElementVNode("div",{onClick:D[24]||(D[24]=Q=>h.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:h.value==="MAP",style:{"margin-right":"5px"}},null,8,PE),D[40]||(D[40]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),p.value?(d.openBlock(),d.createElementBlock("div",FE,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(p.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(p.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",RE,"未选择"))])]),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:M},"调整位置"),d.createElementVNode("button",{onClick:U},"保存")]),D[41]||(D[41]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):d.createCommentVNode("",!0)]),d.createElementVNode("div",OE,[d.createElementVNode("div",LE,[d.createElementVNode("div",NE,[d.createElementVNode("input",{type:"checkbox",checked:g.value,onChange:F},null,40,UE)]),D[43]||(D[43]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),D[44]||(D[44]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),D[45]||(D[45]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",_E,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(P.value,(Q,V)=>(d.openBlock(),d.createElementBlock("div",{key:Q.modelId,class:d.normalizeClass(["list-item",{active:Q.modelId===c.value}])},[d.createElementVNode("div",QE,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":$=>Q.selected=$},null,8,HE),[[d.vModelCheckbox,Q.selected]])]),d.createElementVNode("div",GE,d.toDisplayString(V+1),1),d.createElementVNode("div",{class:"col-name",title:Q.modelName},d.toDisplayString(Q.modelName),9,YE),d.createElementVNode("div",VE,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:Q.modelId===c.value,onChange:$=>O(Q.modelId)},null,40,WE)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-6cbc261f"]]);function Fi(){return Fi=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Fi.apply(null,arguments)}const zE={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},jE={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},rc={lang:Fi({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},zE),timePickerLocale:Fi({},jE)};rc.lang.ok="确定";var Ri={exports:{}},$E=Ri.exports,ac;function lc(){return ac||(ac=1,(function(n,e){(function(t,i){n.exports=i()})($E,(function(){var t=1e3,i=6e4,s=36e5,o="millisecond",r="second",l="minute",a="hour",c="day",u="week",h="month",f="quarter",p="year",A="date",C="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var v=["th","st","nd","rd"],w=O%100;return"["+O+(v[(w-20)%10]||v[w]||v[0])+"]"}},x=function(O,v,w){var b=String(O);return!b||b.length>=v?O:""+Array(v+1-b.length).join(w)+O},M={s:x,z:function(O){var v=-O.utcOffset(),w=Math.abs(v),b=Math.floor(w/60),B=w%60;return(v<=0?"+":"-")+x(b,2,"0")+":"+x(B,2,"0")},m:function O(v,w){if(v.date()<w.date())return-O(w,v);var b=12*(w.year()-v.year())+(w.month()-v.month()),B=v.clone().add(b,h),R=w-B<0,U=v.clone().add(b+(R?-1:1),h);return+(-(b+(w-B)/(R?B-U:U-B))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:h,y:p,w:u,d:c,D:A,h:a,m:l,s:r,ms:o,Q:f}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},T="en",S={};S[T]=E;var I="$isDayjsObject",g=function(O){return O instanceof L||!(!O||!O[I])},k=function O(v,w,b){var B;if(!v)return T;if(typeof v=="string"){var R=v.toLowerCase();S[R]&&(B=R),w&&(S[R]=w,B=R);var U=v.split("-");if(!B&&U.length>1)return O(U[0])}else{var N=v.name;S[N]=v,B=N}return!b&&B&&(T=B),B||!b&&T},P=function(O,v){if(g(O))return O.clone();var w=typeof v=="object"?v:{};return w.date=O,w.args=arguments,new L(w)},F=M;F.l=k,F.i=g,F.w=function(O,v){return P(O,{locale:v.$L,utc:v.$u,x:v.$x,$offset:v.$offset})};var L=(function(){function O(w){this.$L=k(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[I]=!0}var v=O.prototype;return v.parse=function(w){this.$d=(function(b){var B=b.date,R=b.utc;if(B===null)return new Date(NaN);if(F.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var U=B.match(m);if(U){var N=U[2]-1||0,D=(U[7]||"0").substring(0,3);return R?new Date(Date.UTC(U[1],N,U[3]||1,U[4]||0,U[5]||0,U[6]||0,D)):new Date(U[1],N,U[3]||1,U[4]||0,U[5]||0,U[6]||0,D)}}return new Date(B)})(w),this.init()},v.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},v.$utils=function(){return F},v.isValid=function(){return this.$d.toString()!==C},v.isSame=function(w,b){var B=P(w);return this.startOf(b)<=B&&B<=this.endOf(b)},v.isAfter=function(w,b){return P(w)<this.startOf(b)},v.isBefore=function(w,b){return this.endOf(b)<P(w)},v.$g=function(w,b,B){return F.u(w)?this[b]:this.set(B,w)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(w,b){var B=this,R=!!F.u(b)||b,U=F.p(w),N=function(Y,j){var X=F.w(B.$u?Date.UTC(B.$y,j,Y):new Date(B.$y,j,Y),B);return R?X:X.endOf(c)},D=function(Y,j){return F.w(B.toDate()[Y].apply(B.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(j)),B)},Q=this.$W,V=this.$M,$=this.$D,J="set"+(this.$u?"UTC":"");switch(U){case p:return R?N(1,0):N(31,11);case h:return R?N(1,V):N(0,V+1);case u:var ne=this.$locale().weekStart||0,re=(Q<ne?Q+7:Q)-ne;return N(R?$-re:$+(6-re),V);case c:case A:return D(J+"Hours",0);case a:return D(J+"Minutes",1);case l:return D(J+"Seconds",2);case r:return D(J+"Milliseconds",3);default:return this.clone()}},v.endOf=function(w){return this.startOf(w,!1)},v.$set=function(w,b){var B,R=F.p(w),U="set"+(this.$u?"UTC":""),N=(B={},B[c]=U+"Date",B[A]=U+"Date",B[h]=U+"Month",B[p]=U+"FullYear",B[a]=U+"Hours",B[l]=U+"Minutes",B[r]=U+"Seconds",B[o]=U+"Milliseconds",B)[R],D=R===c?this.$D+(b-this.$W):b;if(R===h||R===p){var Q=this.clone().set(A,1);Q.$d[N](D),Q.init(),this.$d=Q.set(A,Math.min(this.$D,Q.daysInMonth())).$d}else N&&this.$d[N](D);return this.init(),this},v.set=function(w,b){return this.clone().$set(w,b)},v.get=function(w){return this[F.p(w)]()},v.add=function(w,b){var B,R=this;w=Number(w);var U=F.p(b),N=function(V){var $=P(R);return F.w($.date($.date()+Math.round(V*w)),R)};if(U===h)return this.set(h,this.$M+w);if(U===p)return this.set(p,this.$y+w);if(U===c)return N(1);if(U===u)return N(7);var D=(B={},B[l]=i,B[a]=s,B[r]=t,B)[U]||1,Q=this.$d.getTime()+w*D;return F.w(Q,this)},v.subtract=function(w,b){return this.add(-1*w,b)},v.format=function(w){var b=this,B=this.$locale();if(!this.isValid())return B.invalidDate||C;var R=w||"YYYY-MM-DDTHH:mm:ssZ",U=F.z(this),N=this.$H,D=this.$m,Q=this.$M,V=B.weekdays,$=B.months,J=B.meridiem,ne=function(j,X,se,oe){return j&&(j[X]||j(b,R))||se[X].slice(0,oe)},re=function(j){return F.s(N%12||12,j,"0")},Y=J||function(j,X,se){var oe=j<12?"AM":"PM";return se?oe.toLowerCase():oe};return R.replace(y,(function(j,X){return X||(function(se){switch(se){case"YY":return String(b.$y).slice(-2);case"YYYY":return F.s(b.$y,4,"0");case"M":return Q+1;case"MM":return F.s(Q+1,2,"0");case"MMM":return ne(B.monthsShort,Q,$,3);case"MMMM":return ne($,Q);case"D":return b.$D;case"DD":return F.s(b.$D,2,"0");case"d":return String(b.$W);case"dd":return ne(B.weekdaysMin,b.$W,V,2);case"ddd":return ne(B.weekdaysShort,b.$W,V,3);case"dddd":return V[b.$W];case"H":return String(N);case"HH":return F.s(N,2,"0");case"h":return re(1);case"hh":return re(2);case"a":return Y(N,D,!0);case"A":return Y(N,D,!1);case"m":return String(D);case"mm":return F.s(D,2,"0");case"s":return String(b.$s);case"ss":return F.s(b.$s,2,"0");case"SSS":return F.s(b.$ms,3,"0");case"Z":return U}return null})(j)||U.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(w,b,B){var R,U=this,N=F.p(b),D=P(w),Q=(D.utcOffset()-this.utcOffset())*i,V=this-D,$=function(){return F.m(U,D)};switch(N){case p:R=$()/12;break;case h:R=$();break;case f:R=$()/3;break;case u:R=(V-Q)/6048e5;break;case c:R=(V-Q)/864e5;break;case a:R=V/s;break;case l:R=V/i;break;case r:R=V/t;break;default:R=V}return B?R:F.a(R)},v.daysInMonth=function(){return this.endOf(h).$D},v.$locale=function(){return S[this.$L]},v.locale=function(w,b){if(!w)return this.$L;var B=this.clone(),R=k(w,b,!0);return R&&(B.$L=R),B},v.clone=function(){return F.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},O})(),G=L.prototype;return P.prototype=G,[["$ms",o],["$s",r],["$m",l],["$H",a],["$W",c],["$M",h],["$y",p],["$D",A]].forEach((function(O){G[O[1]]=function(v){return this.$g(v,O[0],O[1])}})),P.extend=function(O,v){return O.$i||(O(v,L,P),O.$i=!0),P},P.locale=k,P.isDayjs=g,P.unix=function(O){return P(1e3*O)},P.en=S[T],P.Ls=S,P.p={},P}))})(Ri)),Ri.exports}var KE=lc();const ze=tn(KE);var Oi={exports:{}},XE=Oi.exports,cc;function qE(){return cc||(cc=1,(function(n,e){(function(t,i){n.exports=i(lc())})(XE,(function(t){function i(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var s=i(t),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(r,l){return l==="W"?r+"周":r+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(r,l){var a=100*r+l;return a<600?"凌晨":a<900?"早上":a<1100?"上午":a<1300?"中午":a<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(Oi)),Oi.exports}qE();var Li={exports:{}},JE=Li.exports,dc;function ZE(){return dc||(dc=1,(function(n,e){(function(t,i){n.exports=i()})(JE,(function(){return function(t,i,s){var o=i.prototype,r=function(h){return h&&(h.indexOf?h:h.s)},l=function(h,f,p,A,C){var m=h.name?h:h.$locale(),y=r(m[f]),E=r(m[p]),x=y||E.map((function(T){return T.slice(0,A)}));if(!C)return x;var M=m.weekStart;return x.map((function(T,S){return x[(S+(M||0))%7]}))},a=function(){return s.Ls[s.locale()]},c=function(h,f){return h.formats[f]||(function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(A,C,m){return C||m.slice(1)}))})(h.formats[f.toUpperCase()])},u=function(){var h=this;return{months:function(f){return f?f.format("MMMM"):l(h,"months")},monthsShort:function(f){return f?f.format("MMM"):l(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):l(h,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):l(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):l(h,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return c(h.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=a();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(f){return c(h,f)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return l(a(),"months")},s.monthsShort=function(){return l(a(),"monthsShort","months",3)},s.weekdays=function(h){return l(a(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return l(a(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return l(a(),"weekdaysMin","weekdays",2,h)}}}))})(Li)),Li.exports}var ew=ZE();const tw=tn(ew);var Ni={exports:{}},nw=Ni.exports,uc;function iw(){return uc||(uc=1,(function(n,e){(function(t,i){n.exports=i()})(nw,(function(){return function(t,i){i.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,l=(r<o?r+7:r)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}}))})(Ni)),Ni.exports}var sw=iw();const ow=tn(sw);var Ui={exports:{}},rw=Ui.exports,hc;function aw(){return hc||(hc=1,(function(n,e){(function(t,i){n.exports=i()})(rw,(function(){var t="week",i="year";return function(s,o,r){var l=o.prototype;l.week=function(a){if(a===void 0&&(a=null),a!==null)return this.add(7*(a-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=r(this).startOf(i).add(1,i).date(c),h=r(this).endOf(t);if(u.isBefore(h))return 1}var f=r(this).startOf(i).date(c).startOf(t).subtract(1,"millisecond"),p=this.diff(f,t,!0);return p<0?r(this).startOf("week").week():Math.ceil(p)},l.weeks=function(a){return a===void 0&&(a=null),this.week(a)}}}))})(Ui)),Ui.exports}var lw=aw();const cw=tn(lw);var _i={exports:{}},dw=_i.exports,fc;function uw(){return fc||(fc=1,(function(n,e){(function(t,i){n.exports=i()})(dw,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,r=/\d\d?/,l=/\d*[^-_:/,()\s\d]+/,a={},c=function(m){return(m=+m)+(m>68?1900:2e3)},u=function(m){return function(y){this[m]=+y}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(y){if(!y||y==="Z")return 0;var E=y.match(/([+-]|\d\d)/g),x=60*E[1]+(+E[2]||0);return x===0?0:E[0]==="+"?-x:x})(m)}],f=function(m){var y=a[m];return y&&(y.indexOf?y:y.s.concat(y.f))},p=function(m,y){var E,x=a.meridiem;if(x){for(var M=1;M<=24;M+=1)if(m.indexOf(x(M,0,y))>-1){E=M>12;break}}else E=m===(y?"pm":"PM");return E},A={A:[l,function(m){this.afternoon=p(m,!1)}],a:[l,function(m){this.afternoon=p(m,!0)}],Q:[s,function(m){this.month=3*(m-1)+1}],S:[s,function(m){this.milliseconds=100*+m}],SS:[o,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[r,u("seconds")],ss:[r,u("seconds")],m:[r,u("minutes")],mm:[r,u("minutes")],H:[r,u("hours")],h:[r,u("hours")],HH:[r,u("hours")],hh:[r,u("hours")],D:[r,u("day")],DD:[o,u("day")],Do:[l,function(m){var y=a.ordinal,E=m.match(/\d+/);if(this.day=E[0],y)for(var x=1;x<=31;x+=1)y(x).replace(/\[|\]/g,"")===m&&(this.day=x)}],w:[r,u("week")],ww:[o,u("week")],M:[r,u("month")],MM:[o,u("month")],MMM:[l,function(m){var y=f("months"),E=(f("monthsShort")||y.map((function(x){return x.slice(0,3)}))).indexOf(m)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[l,function(m){var y=f("months").indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[o,function(m){this.year=c(m)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function C(m){var y,E;y=m,E=a&&a.formats;for(var x=(m=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(P,F,L){var G=L&&L.toUpperCase();return F||E[L]||t[L]||E[G].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(O,v,w){return v||w.slice(1)}))}))).match(i),M=x.length,T=0;T<M;T+=1){var S=x[T],I=A[S],g=I&&I[0],k=I&&I[1];x[T]=k?{regex:g,parser:k}:S.replace(/^\[|\]$/g,"")}return function(P){for(var F={},L=0,G=0;L<M;L+=1){var O=x[L];if(typeof O=="string")G+=O.length;else{var v=O.regex,w=O.parser,b=P.slice(G),B=v.exec(b)[0];w.call(F,B),P=P.replace(B,"")}}return(function(R){var U=R.afternoon;if(U!==void 0){var N=R.hours;U?N<12&&(R.hours+=12):N===12&&(R.hours=0),delete R.afternoon}})(F),F}}return function(m,y,E){E.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(c=m.parseTwoDigitYear);var x=y.prototype,M=x.parse;x.parse=function(T){var S=T.date,I=T.utc,g=T.args;this.$u=I;var k=g[1];if(typeof k=="string"){var P=g[2]===!0,F=g[3]===!0,L=P||F,G=g[2];F&&(G=g[2]),a=this.$locale(),!P&&G&&(a=E.Ls[G]),this.$d=(function(b,B,R,U){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*b);var N=C(B)(b),D=N.year,Q=N.month,V=N.day,$=N.hours,J=N.minutes,ne=N.seconds,re=N.milliseconds,Y=N.zone,j=N.week,X=new Date,se=V||(D||Q?1:X.getDate()),oe=D||X.getFullYear(),ae=0;D&&!Q||(ae=Q>0?Q-1:X.getMonth());var Ce,le=$||0,Pe=J||0,ct=ne||0,$e=re||0;return Y?new Date(Date.UTC(oe,ae,se,le,Pe,ct,$e+60*Y.offset*1e3)):R?new Date(Date.UTC(oe,ae,se,le,Pe,ct,$e)):(Ce=new Date(oe,ae,se,le,Pe,ct,$e),j&&(Ce=U(Ce).week(j).toDate()),Ce)}catch{return new Date("")}})(S,k,I,E),this.init(),G&&G!==!0&&(this.$L=this.locale(G).$L),L&&S!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var O=k.length,v=1;v<=O;v+=1){g[1]=k[v-1];var w=E.apply(this,g);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}v===O&&(this.$d=new Date(""))}else M.call(this,T)}}}))})(_i)),_i.exports}var hw=uw();const fw=tn(hw),pw={class:"setting-panel"},gw={class:"tabs-header"},mw={class:"tab-content"},Aw={key:0,class:"section"},yw={class:"setting-item"},Cw={class:"setting-item"},Ew={class:"setting-item"},ww={key:1,class:"section"},bw={class:"tabs-header",style:{"margin-bottom":"8px"}},vw={key:0},xw={class:"setting-item column"},Iw={class:"setting-item column"},Bw={class:"setting-item"},Sw={key:1},Mw={class:"setting-item column"},Tw={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},Dw={class:"search-box"},kw={key:2,class:"section"},Pw={class:"setting-item"},Fw={key:0,class:"setting-item column"},Rw={class:"sub-label"},Ow={class:"setting-item"},Lw={class:"setting-item"},Nw={class:"setting-item column"},Uw={class:"setting-item column"},_w={class:"sub-label"},Qw={class:"setting-item column"},Hw={class:"sub-label"},Gw={class:"setting-item column"},Yw={class:"sub-label"},Vw={class:"setting-item column"},Ww={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},zw=["onClick","title"],jw={style:{display:"flex",gap:"8px","align-items":"center"}},$w={key:3,class:"section"},Kw={class:"setting-item"},Xw={class:"setting-item column"},Gn=Ue(d.defineComponent({__name:"LeitingSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean,default:!1},tiandituToken:{type:String,default:""},initialConfig:{type:Object,default:()=>({})}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){ze.locale("zh-cn"),ze.extend(tw),ze.extend(ow),ze.extend(cw),ze.extend(fw);const t=me.Switch,i=me.Radio.Group,s=me.Radio,o=me.Input,r=me.Slider,l=me.Select,a=me.Select.Option,c=me.DatePicker,u=n,h=e,f=d.inject("leitingMethods"),p=d.computed({get:()=>u.open!==void 0?u.open:u.visible,set:v=>{h("update:visible",v),h("update:open",v)}}),A=d.ref("GIS"),C=d.reactive({globe:!1,terrain:!1,depthTest:!1}),m=d.reactive({provider:"tianditu",tianditu:{token:"c25f14fb6bd4397cf8fe45144ff768d6",layerType:"img_w",showLabel:!1},arcgis:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},baseMap:"tianditu"}),y=d.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:ze("2025-06-22 10:00"),brightness:1.5,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),E=d.reactive({collision:!1,habit:0}),x=v=>{v&&(v.globe!==void 0&&(C.globe=v.globe),v.terrain!==void 0&&(C.terrain=v.terrain),v.depthTest!==void 0&&(C.depthTest=v.depthTest),v.mapProvider!==void 0&&(m.provider=v.mapProvider),v.tiandituLayerType!==void 0&&(m.tianditu.layerType=v.tiandituLayerType),v.tiandituShowLabel!==void 0&&(m.tianditu.showLabel=v.tiandituShowLabel),v.arcgisUrl!==void 0&&(m.arcgis.url=v.arcgisUrl),v.shadows!==void 0&&(y.shadows=v.shadows),v.shadowDarkness!==void 0&&(y.shadowDarkness=v.shadowDarkness),v.environmentMap!==void 0&&(y.environmentMap=v.environmentMap),v.ambientOcclusion!==void 0&&(y.ambientOcclusion=v.ambientOcclusion),v.time!==void 0&&(typeof v.time=="number"?y.time=ze().startOf("day").add(v.time,"hour"):y.time=ze(v.time)),v.brightness!==void 0&&(y.brightness=v.brightness),v.contrast!==void 0&&(y.contrast=v.contrast),v.saturation!==void 0&&(y.saturation=v.saturation),v.backgroundColor!==void 0&&(y.backgroundColor=v.backgroundColor),v.collision!==void 0&&(E.collision=v.collision),v.mouseHabit!==void 0&&(E.habit=v.mouseHabit))};d.watch(()=>u.initialConfig,v=>{x(v)},{deep:!0,immediate:!0});const M=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],T=[{label:"全球影像地图服务(墨卡托)",value:"img_w"},{label:"全球影像地图服务(经纬度)",value:"img_c"},{label:"全球矢量地图服务(墨卡托)",value:"vec_w"},{label:"全球矢量地图服务(经纬度)",value:"vec_c"},{label:"全球地形晕渲服务(墨卡托)",value:"ter_w"},{label:"全球地形晕渲服务(经纬度)",value:"ter_c"}],S=()=>{const v=m.provider,w={};v==="tianditu"?(w.token=m.tianditu.token,w.layerType=m.tianditu.layerType,w.showAnnotation=m.tianditu.showLabel):v==="arcgis"&&(w.url=m.arcgis.url),f.value?.changeBaseMap?.(v,w)};d.watch(()=>m.provider,S),d.watch(()=>m.tianditu.layerType,S),d.watch(()=>m.tianditu.showLabel,S),d.watch(()=>m.tianditu.token,hs(S,1e3)),d.watch(()=>m.arcgis.url,hs(S,1e3)),d.onMounted(()=>{u.tiandituToken&&(m.tianditu.token=u.tiandituToken)}),d.watch(()=>C.globe,v=>f.value?.setGlobeEnvironmentVisible?.(v)),d.watch(()=>C.terrain,v=>f.value?.setTerrainEnable?.(v)),d.watch(()=>C.depthTest,v=>f.value?.setDepthTestEnable?.(v)),d.watch(()=>f?.value,v=>{if(v){if(v.getConfigure=()=>({globe:C.globe,terrain:C.terrain,depthTest:C.depthTest,mapProvider:m.provider,tiandituLayerType:m.tianditu.layerType,tiandituShowLabel:m.tianditu.showLabel,arcgisUrl:m.arcgis.url,shadows:y.shadows,shadowDarkness:y.shadowDarkness,environmentMap:y.environmentMap,ambientOcclusion:y.ambientOcclusion,time:ze.isDayjs(y.time)?y.time.format("YYYY-MM-DD HH:mm"):y.time,brightness:y.brightness,contrast:y.contrast,saturation:y.saturation,backgroundColor:y.backgroundColor,collision:E.collision,mouseHabit:E.habit}),v.setConfigure=w=>{x(w)},v.setBackgroundColor&&y.backgroundColor&&v.setBackgroundColor(y.backgroundColor),v.setGlobeEnvironmentVisible&&v.setGlobeEnvironmentVisible(C.globe),v.setShadowsEnable&&v.setShadowsEnable(y.shadows),v.setShadowDarkness&&v.setShadowDarkness(y.shadowDarkness),v.setEnvironmentMapEnable&&v.setEnvironmentMapEnable(y.environmentMap),v.setAmbientOcclusion&&v.setAmbientOcclusion(y.ambientOcclusion),v.setTime){const w=ze.isDayjs(y.time)?y.time.toDate():new Date;v.setTime(w)}v.setModelBrightness&&v.setModelBrightness(y.brightness),v.setCollisionDetection&&v.setCollisionDetection(E.collision),v.setMouseHabit&&v.setMouseHabit(E.habit),v.changeBaseMap&&m.baseMap&&v.changeBaseMap(m.baseMap,{token:m.tianditu.token,layerType:m.tianditu.layerType,showAnnotation:m.tianditu.showLabel,url:m.arcgis.url})}},{immediate:!0});const I=d.computed({get:()=>{const v=y.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(v)?v:"#ffffff"},set:v=>{y.backgroundColor=v}}),g=d.ref(""),k=d.ref(!1),P=d.ref([]);d.watch(()=>C.globe,v=>f.value?.setGlobeEnvironmentVisible?.(v)),d.watch(()=>C.terrain,v=>f.value?.setTerrainEnable?.(v)),d.watch(()=>m.baseMap,v=>{f.value?.changeBaseMap?.(v,{token:u.tiandituToken})}),d.watch(()=>y.shadows,v=>f.value?.setShadowsEnable?.(v)),d.watch(()=>y.shadowDarkness,v=>f.value?.setShadowDarkness?.(v)),d.watch(()=>y.environmentMap,v=>f.value?.setEnvironmentMapEnable?.(v)),d.watch(()=>y.ambientOcclusion,v=>f.value?.setAmbientOcclusion?.(v)),d.watch(()=>y.time,v=>{const w=ze.isDayjs(v)?v.toDate():new Date;f.value?.setTime?.(w)}),d.watch(()=>[y.brightness,y.contrast,y.saturation],([v,w,b])=>{const B=f.value;B?.setModelColorAdjustment?B.setModelColorAdjustment({brightness:v,contrast:w,saturation:b}):B?.setModelBrightness?.(v)}),d.watch(()=>y.backgroundColor,v=>{if(f.value?.setBackgroundColor)f.value.setBackgroundColor(v);else{const w=document.querySelector(".cesium-viewer");w&&(w.style.background=v)}}),d.watch(()=>E.collision,v=>f.value?.setCollisionDetection?.(v)),d.watch(()=>E.habit,v=>f.value?.setMouseHabit?.(v));const F=v=>{if(v?.pois&&Array.isArray(v.pois)&&v.pois.length>0){const w=v.pois[0],b=w.lonlat.split(/[, ]/).map(Number);if(b.length>=2&&!isNaN(b[0])&&!isNaN(b[1]))return{name:w.name,lon:b[0],lat:b[1],raw:w}}if(v?.area&&v.area.lonlat){const w=v.area,b=w.lonlat.split(/[, ]/).map(Number);if(b.length>=2&&!isNaN(b[0])&&!isNaN(b[1]))return{name:w.name,lon:b[0],lat:b[1],raw:w}}return null},G=hs(async()=>{const v=(g.value||"").trim();if(!v)return;const w=u.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";k.value=!0,P.value=[];try{if(f.value?.searchLocation){const b=await f.value.searchLocation(v,w),B=F(b);B&&(P.value=[B],ge.success(`找到:${B.name||""}`),f.value.flyTo(B.lon,B.lat,5e3))}else{const B=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:v,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(w)}`,R=await fetch(B);if(!R.ok)throw new Error(`HTTP ${R.status}`);const U=await R.json(),N=F(U);N&&(P.value=[N],ge.success(`找到:${N.name||""}`),f.value?.flyTo?.(N.lon,N.lat,5e3))}}catch(b){console.error("tianditu search error",b)}finally{k.value=!1}},800);d.watch(g,()=>{G()});const O=()=>{p.value=!1,h("close")};return d.onMounted(()=>{}),(v,w)=>(d.openBlock(),d.createBlock(Re,{visible:p.value,title:"设置",width:320,"full-height":n.fullHeight,onClose:O,"onUpdate:visible":w[26]||(w[26]=b=>p.value=b)},{default:d.withCtx(()=>[d.createElementVNode("div",pw,[d.createElementVNode("div",gw,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="GIS"}]),onClick:w[0]||(w[0]=b=>A.value="GIS")},"GIS",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="MAP"}]),onClick:w[1]||(w[1]=b=>A.value="MAP")},"地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="RENDER"}]),onClick:w[2]||(w[2]=b=>A.value="RENDER")},"渲染",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="MOUSE"}]),onClick:w[3]||(w[3]=b=>A.value="MOUSE")},"鼠标",2)]),d.createElementVNode("div",mw,[A.value==="GIS"?(d.openBlock(),d.createElementBlock("div",Aw,[d.createElementVNode("div",yw,[w[27]||(w[27]=d.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),d.createVNode(d.unref(t),{checked:C.globe,"onUpdate:checked":w[4]||(w[4]=b=>C.globe=b),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Cw,[w[28]||(w[28]=d.createElementVNode("span",null,"地形 (高程)",-1)),d.createVNode(d.unref(t),{checked:C.terrain,"onUpdate:checked":w[5]||(w[5]=b=>C.terrain=b),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ew,[w[29]||(w[29]=d.createElementVNode("span",null,"地形遮挡",-1)),d.createVNode(d.unref(t),{checked:C.depthTest,"onUpdate:checked":w[6]||(w[6]=b=>C.depthTest=b),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),A.value==="MAP"?(d.openBlock(),d.createElementBlock("div",ww,[d.createElementVNode("div",bw,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.provider==="tianditu"}]),onClick:w[7]||(w[7]=b=>m.provider="tianditu")},"天地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.provider==="arcgis"}]),onClick:w[8]||(w[8]=b=>m.provider="arcgis")},"ArcGIS",2)]),m.provider==="tianditu"?(d.openBlock(),d.createElementBlock("div",vw,[d.createElementVNode("div",xw,[w[30]||(w[30]=d.createElementVNode("div",{class:"sub-label"},"Token",-1)),d.createVNode(d.unref(o),{value:m.tianditu.token,"onUpdate:value":w[9]||(w[9]=b=>m.tianditu.token=b),size:"small",placeholder:"输入天地图Token"},null,8,["value"])]),d.createElementVNode("div",Iw,[w[31]||(w[31]=d.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),d.createVNode(d.unref(l),{value:m.tianditu.layerType,"onUpdate:value":w[10]||(w[10]=b=>m.tianditu.layerType=b),size:"small",style:{width:"100%"}},{default:d.withCtx(()=>[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(T,b=>d.createVNode(d.unref(a),{key:b.value,value:b.value},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(b.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),d.createElementVNode("div",Bw,[w[32]||(w[32]=d.createElementVNode("span",null,"叠加注记",-1)),d.createVNode(d.unref(t),{checked:m.tianditu.showLabel,"onUpdate:checked":w[11]||(w[11]=b=>m.tianditu.showLabel=b),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),m.provider==="arcgis"?(d.openBlock(),d.createElementBlock("div",Sw,[d.createElementVNode("div",Mw,[w[33]||(w[33]=d.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),d.createVNode(d.unref(o),{value:m.arcgis.url,"onUpdate:value":w[12]||(w[12]=b=>m.arcgis.url=b),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):d.createCommentVNode("",!0),d.createElementVNode("div",Tw,[w[34]||(w[34]=d.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),d.createElementVNode("div",Dw,[d.createVNode(d.unref(o),{value:g.value,"onUpdate:value":w[13]||(w[13]=b=>g.value=b),placeholder:"输入地名搜索",size:"small","allow-clear":""},null,8,["value"])])])])):d.createCommentVNode("",!0),A.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",kw,[d.createElementVNode("div",Pw,[w[35]||(w[35]=d.createElementVNode("span",null,"阴影",-1)),d.createVNode(d.unref(t),{checked:y.shadows,"onUpdate:checked":w[14]||(w[14]=b=>y.shadows=b),size:"small"},null,8,["checked"])]),y.shadows?(d.openBlock(),d.createElementBlock("div",Fw,[d.createElementVNode("div",Rw,"阴影暗度 ("+d.toDisplayString(y.shadowDarkness.toFixed(2))+")",1),d.createVNode(d.unref(r),{value:y.shadowDarkness,"onUpdate:value":w[15]||(w[15]=b=>y.shadowDarkness=b),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):d.createCommentVNode("",!0),d.createElementVNode("div",Ow,[w[36]||(w[36]=d.createElementVNode("span",null,"环境贴图 (HDR)",-1)),d.createVNode(d.unref(t),{checked:y.environmentMap,"onUpdate:checked":w[16]||(w[16]=b=>y.environmentMap=b),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Lw,[w[37]||(w[37]=d.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),d.createVNode(d.unref(t),{checked:y.ambientOcclusion,"onUpdate:checked":w[17]||(w[17]=b=>y.ambientOcclusion=b),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Nw,[w[38]||(w[38]=d.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),d.createVNode(d.unref(c),{value:y.time,"onUpdate:value":w[18]||(w[18]=b=>y.time=b),"show-time":"",locale:d.unref(rc),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),d.createElementVNode("div",Uw,[d.createElementVNode("div",_w,"模型亮度 ("+d.toDisplayString(y.brightness.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.brightness,"onUpdate:value":w[19]||(w[19]=b=>y.brightness=b),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Qw,[d.createElementVNode("div",Hw,"模型对比度 ("+d.toDisplayString(y.contrast.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.contrast,"onUpdate:value":w[20]||(w[20]=b=>y.contrast=b),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Gw,[d.createElementVNode("div",Yw,"模型饱和度 ("+d.toDisplayString(y.saturation.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.saturation,"onUpdate:value":w[21]||(w[21]=b=>y.saturation=b),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Vw,[w[39]||(w[39]=d.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),d.createElementVNode("div",Ww,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(M,(b,B)=>d.createElementVNode("div",{key:B,style:d.normalizeStyle({background:b,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:R=>y.backgroundColor=b,title:"预设 "+(B+1)},null,12,zw)),64))]),d.createElementVNode("div",jw,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":w[22]||(w[22]=b=>I.value=b),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[d.vModelText,I.value]]),d.createVNode(d.unref(o),{value:y.backgroundColor,"onUpdate:value":w[23]||(w[23]=b=>y.backgroundColor=b),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):d.createCommentVNode("",!0),A.value==="MOUSE"?(d.openBlock(),d.createElementBlock("div",$w,[d.createElementVNode("div",Kw,[w[40]||(w[40]=d.createElementVNode("span",null,"碰撞检测",-1)),d.createVNode(d.unref(t),{checked:E.collision,"onUpdate:checked":w[24]||(w[24]=b=>E.collision=b),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Xw,[w[43]||(w[43]=d.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),d.createVNode(d.unref(i),{value:E.habit,"onUpdate:value":w[25]||(w[25]=b=>E.habit=b),size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(s),{value:0},{default:d.withCtx(()=>[...w[41]||(w[41]=[d.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),d.createVNode(d.unref(s),{value:1},{default:d.withCtx(()=>[...w[42]||(w[42]=[d.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):d.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-a768b286"]]),qw={class:"cad-layer-panel"},Jw={class:"layer-list-container"},Zw={class:"list-header"},eb={class:"col-check"},tb=["checked"],nb={class:"list-body"},ib={class:"col-check"},sb=["checked","onChange"],ob={class:"col-index"},rb=["title"],ab={class:"col-color"},lb=["value"],cb={key:0,class:"empty-text"},db=Ue(d.defineComponent({__name:"LeitingCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(E=>({modelId:E.modelId,modelName:E.modelName}))||[])},a=d.computed(()=>r.value.map(E=>({value:E.modelId,label:E.modelName}))),c=d.ref([]),u=d.ref([]),h=d.computed(()=>c.value.length>0&&u.value.length===c.value.length),f=({modelId:E})=>{if(c.value=[],u.value=[],s.value&&s.value.getDxfLayers){const x=s.value.getDxfLayers({modelId:E});x&&Object.keys(x).forEach((M,T)=>{x[M].length&&(c.value.push({index:T+1,layerName:M,layerColor:x[M][0].color||"#ffffff",key:M}),u.value.push(M))})}},p=E=>{o.value=E,f({modelId:E})},A=E=>{E.target.checked?u.value=c.value.map(M=>M.key):u.value=[],m()},C=(E,x)=>{x.target.checked?u.value.includes(E)||u.value.push(E):u.value=u.value.filter(T=>T!==E),m()},m=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:u.value}),s.value.getDxfLayers)){const E=s.value.getDxfLayers({modelId:o.value});if(E){const x=Object.keys(E).filter(M=>!u.value.includes(M));s.value.showDxfLayer({modelId:o.value,show:!1,layers:x})}}},y=()=>{i("update:visible",!1),i("handleCloseCardByCadCard")};return d.watch(()=>t.visible,E=>{E&&(l(),t.currentModelId?(o.value=t.currentModelId,f({modelId:t.currentModelId})):a.value.length>0&&(o.value=a.value[0]?.value,f({modelId:o.value})))}),d.watch(()=>t.currentModelId,E=>{E&&t.visible&&(o.value=E,f({modelId:E}))}),(E,x)=>(d.openBlock(),d.createBlock(Re,{visible:n.visible,title:"CAD图层","onUpdate:visible":x[3]||(x[3]=M=>E.$emit("update:visible",M)),onClose:y,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":d.withCtx(()=>[d.createElementVNode("div",{class:"header-select-container",onMousedown:x[2]||(x[2]=d.withModifiers(()=>{},["stop"]))},[x[4]||(x[4]=d.createElementVNode("span",{class:"header-label"},"图纸:",-1)),d.createVNode(d.unref(me.Select),{value:o.value,"onUpdate:value":x[0]||(x[0]=M=>o.value=M),options:a.value,onChange:x[1]||(x[1]=M=>p(M)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:d.withCtx(()=>[d.createElementVNode("div",qw,[d.createElementVNode("div",Jw,[d.createElementVNode("div",Zw,[d.createElementVNode("div",eb,[d.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:A},null,40,tb)]),x[5]||(x[5]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),x[6]||(x[6]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),x[7]||(x[7]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",nb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,M=>(d.openBlock(),d.createElementBlock("div",{key:M.key,class:"list-item"},[d.createElementVNode("div",ib,[d.createElementVNode("input",{type:"checkbox",checked:u.value.includes(M.key),onChange:T=>C(M.key,T)},null,40,sb)]),d.createElementVNode("div",ob,d.toDisplayString(M.index),1),d.createElementVNode("div",{class:"col-name",title:M.layerName},d.toDisplayString(M.layerName),9,rb),d.createElementVNode("div",ab,[d.createElementVNode("input",{type:"color",value:M.layerColor,disabled:""},null,8,lb)])]))),128)),c.value.length===0?(d.openBlock(),d.createElementBlock("div",cb,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),ub={class:"adjust-panel"},hb={class:"control-panel"},fb={class:"form-item"},pb={class:"radio-group"},gb={class:"form-item"},mb=["title"],Ab={class:"param-row"},yb=["step"],Cb={class:"param-row"},Eb=["step"],wb={class:"param-row"},bb=["step"],vb={class:"param-row"},xb=["step"],Ib={class:"param-row"},Bb=["step"],Sb={class:"param-row"},Mb=["step"],Tb={class:"param-row"},Db=["step"],kb={class:"button-grid"},Pb={key:1,class:"pick-mode-ui"},Fb=["onClick"],Rb=["checked"],Ob={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},Lb={class:"param-row"},Nb={style:{width:"40px"}},Ub=["onUpdate:modelValue"],_b={class:"param-row"},Qb={style:{width:"40px"}},Hb=["onUpdate:modelValue"],Gb={class:"param-row"},Yb={style:{width:"40px"}},Vb=["onUpdate:modelValue"],Wb={class:"list-panel"},zb={class:"list-header"},jb={class:"col-check"},$b=["checked"],Kb={class:"list-body"},Xb={class:"col-check"},qb=["onUpdate:modelValue"],Jb={class:"col-index"},Zb=["title"],ev={class:"col-main"},tv=["checked","onChange"],nv={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},iv=Ue(d.defineComponent({__name:"LeitingCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","handleSavingByCadCard","clearBimPointList","save"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=d.inject("leitingMethods"),r=d.ref([]),l=d.ref(""),a=d.computed(()=>r.value.length>0&&r.value.every(w=>w.selected)),c=d.ref("param"),u=d.ref("bimPoint1"),h=d.ref(null),f=d.ref("bimPoint1"),p=d.reactive({bimPoint1:{longitude:void 0,latitude:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0},bimPoint2:{longitude:void 0,latitude:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0}}),A=d.ref(1e-6),C=d.reactive({modelId:"",longitude:0,latitude:0,distance:1e-6,rotation:1,totalRotation:0,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0}),m=d.computed(()=>{const w=r.value.find(b=>b.modelId===l.value);return w?w.modelName:""}),y=()=>{s("update:visible",!1)},E=()=>(!h.value&&o?.value?.getViewer&&o?.value?.getCesium&&(h.value=new oc(o.value.getViewer(),o.value.getCesium())),h.value),x=()=>{E()?.clearMarkers(),p.bimPoint1.longitude=void 0,p.bimPoint1.latitude=void 0,p.bimPoint1.height=void 0,p.bimPoint2.longitude=void 0,p.bimPoint2.latitude=void 0,p.bimPoint2.height=void 0},M=w=>{const b=u.value,B=p[b];if(B){B.longitude=w.longitude,B.latitude=w.latitude,B.height=w.height;const R=b==="bimPoint1"?"BIM":"MAP";E()?.addMarker(R,w),ge.success(`${B.type}已添加`)}},T=()=>{E()?.registerPickHandler(w=>{M(w)})},S=()=>{E()?.destroyPickHandler()},I=w=>{c.value=w,w!=="pick"&&s("clearBimPointList")};d.watch(()=>c.value,w=>{w==="pick"?T():S()}),d.onUnmounted(()=>{S()});const g=()=>{if(!o?.value?.getDxfModels)return;const w=o.value.getDxfModels();if(Array.isArray(w)?r.value=w.map(b=>({modelId:b.modelId,modelName:b.modelName,formData:b.formData||{},selected:!1,tileset:b})):r.value=[],r.value.length>0){const b=o.value.getCadModelId?o.value.getCadModelId():"";b&&r.value.find(B=>B.modelId===b)?k(b):k(r.value[0].modelId),r.value.forEach(B=>B.selected=!0)}},k=w=>{l.value=w;const b=r.value.find(B=>B.modelId===w);b&&b.formData&&Object.keys(C).forEach(B=>{b.formData[B]!==void 0&&(C[B]=b.formData[B])})},P=(w,b)=>{if(!o?.value?.adjustingModelByCad)return;const B=r.value.find(R=>R.modelId===w);B&&B.tileset&&(B.formData={...B.formData,...b},B.tileset.formData=B.formData,o.value.adjustingModelByCad({...B.formData,tileset:B.tileset}))},F=w=>{if(!l.value)return;const b=C[w];P(l.value,{[w]:b})},L=w=>{const b=r.value.filter(N=>N.selected);if(b.length===0){ge.warning("请先选择要调整的模型");return}const{distance:B,heightDistance:R,rotation:U}=C;b.forEach(N=>{const D={...N.formData};switch(w){case"north":D.latitude+=B;break;case"south":D.latitude-=B;break;case"east":D.longitude+=B;break;case"west":D.longitude-=B;break;case"up":D.height+=R;break;case"down":D.height-=R;break;case"rotateLeft":D.totalRotation=(D.totalRotation||0)-U;break;case"rotateRight":D.totalRotation=(D.totalRotation||0)+U;break}N.modelId===l.value&&Object.assign(C,D),P(N.modelId,D)})},G=w=>{const b=w.target.checked;r.value.forEach(B=>B.selected=b)},O=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},v=()=>{const w=p.bimPoint1,b=p.bimPoint2;if(w.longitude===void 0||b.longitude===void 0){ge.warning("请先完成点选操作");return}const B=r.value.filter(Q=>Q.selected);if(B.length===0){ge.warning("请先选择要调整的模型");return}let R=0,U=0,N=0;const D=E();if(D){const{dLon:Q,dLat:V,dHeight:$}=D.calculateOffset(w,b);R=Q,U=V,N=$}else R=b.longitude-w.longitude,U=b.latitude-w.latitude,N=b.height-w.height;B.forEach(Q=>{const V={...Q.formData};V.longitude+=R,V.latitude+=U,V.height+=N,Q.modelId===l.value&&Object.assign(C,V),P(Q.modelId,V)}),ge.success("位置已调整")};return d.watch(()=>i.visible,w=>{w?g():(S(),x())}),d.onMounted(()=>{i.visible&&g()}),e({setBIMPointsList:({longitude:w,latitude:b,height:B})=>{p[f.value].longitude=w,p[f.value].latitude=b,p[f.value].height=B},addGltfOr3dTilesModelList:w=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(w,b)=>(d.openBlock(),d.createBlock(Re,{visible:i.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":b[21]||(b[21]=B=>s("update:visible",B)),onClose:y},{default:d.withCtx(()=>[d.createElementVNode("div",ub,[d.createElementVNode("div",hb,[d.createElementVNode("div",fb,[b[22]||(b[22]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",pb,[d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="param"}),onClick:b[0]||(b[0]=B=>I("param"))},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="pick"}),onClick:b[1]||(b[1]=B=>I("pick"))},"地图点选",2)])]),d.createElementVNode("div",gb,[b[23]||(b[23]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:m.value},d.toDisplayString(m.value||"未选择"),9,mb)]),b[35]||(b[35]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[b[31]||(b[31]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",Ab,[b[24]||(b[24]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[2]||(b[2]=B=>C.longitude=B),onChange:b[3]||(b[3]=B=>F("longitude")),step:A.value},null,40,yb),[[d.vModelText,C.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",Cb,[b[25]||(b[25]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[4]||(b[4]=B=>C.latitude=B),onChange:b[5]||(b[5]=B=>F("latitude")),step:A.value},null,40,Eb),[[d.vModelText,C.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",wb,[b[26]||(b[26]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[6]||(b[6]=B=>C.height=B),onChange:b[7]||(b[7]=B=>F("height")),step:A.value},null,40,bb),[[d.vModelText,C.height,void 0,{number:!0}]])]),d.createElementVNode("div",vb,[b[27]||(b[27]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[8]||(b[8]=B=>C.totalRotation=B),onChange:b[9]||(b[9]=B=>F("totalRotation")),step:A.value},null,40,xb),[[d.vModelText,C.totalRotation,void 0,{number:!0}]])]),b[32]||(b[32]=d.createElementVNode("div",{class:"separator"},null,-1)),b[33]||(b[33]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",Ib,[b[28]||(b[28]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[10]||(b[10]=B=>C.distance=B),step:A.value},null,8,Bb),[[d.vModelText,C.distance,void 0,{number:!0}]])]),d.createElementVNode("div",Sb,[b[29]||(b[29]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[11]||(b[11]=B=>C.heightDistance=B),step:A.value},null,8,Mb),[[d.vModelText,C.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",Tb,[b[30]||(b[30]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":b[12]||(b[12]=B=>C.rotation=B),step:A.value},null,8,Db),[[d.vModelText,C.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",kb,[d.createElementVNode("button",{onClick:b[13]||(b[13]=B=>L("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:b[14]||(b[14]=B=>L("north"))},"北移"),d.createElementVNode("button",{onClick:b[15]||(b[15]=B=>L("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:b[16]||(b[16]=B=>L("west"))},"西移"),d.createElementVNode("button",{onClick:b[17]||(b[17]=B=>L("south"))},"南移"),d.createElementVNode("button",{onClick:b[18]||(b[18]=B=>L("east"))},"东移"),d.createElementVNode("button",{onClick:b[19]||(b[19]=B=>L("up"))},"上移"),d.createElementVNode("button",{onClick:b[20]||(b[20]=B=>L("down"))},"下移"),d.createElementVNode("button",{onClick:O,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(d.openBlock(),d.createElementBlock("div",Pb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p,(B,R)=>(d.openBlock(),d.createElementBlock("div",{key:R,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[d.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:U=>u.value=R},[d.createElementVNode("input",{type:"radio",checked:u.value===R,style:{"margin-right":"5px"}},null,8,Rb),d.createTextVNode(" "+d.toDisplayString(B.type)+": ",1)],8,Fb),d.createElementVNode("div",Ob,[d.createElementVNode("div",Lb,[d.createElementVNode("label",Nb,d.toDisplayString(B.longitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.longitude=U,readonly:"",style:{width:"100px"}},null,8,Ub),[[d.vModelText,B.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",_b,[d.createElementVNode("label",Qb,d.toDisplayString(B.latitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.latitude=U,readonly:"",style:{width:"100px"}},null,8,Hb),[[d.vModelText,B.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",Gb,[d.createElementVNode("label",Yb,d.toDisplayString(B.heightText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.height=U,readonly:"",style:{width:"100px"}},null,8,Vb),[[d.vModelText,B.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:v,class:"primary-btn"},"应用校准"),d.createElementVNode("button",{onClick:O},"保存")]),b[34]||(b[34]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),d.createElementVNode("div",Wb,[d.createElementVNode("div",zb,[d.createElementVNode("div",jb,[d.createElementVNode("input",{type:"checkbox",checked:a.value,onChange:G},null,40,$b)]),b[36]||(b[36]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),b[37]||(b[37]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),b[38]||(b[38]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",Kb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(B,R)=>(d.openBlock(),d.createElementBlock("div",{key:B.modelId,class:d.normalizeClass(["list-item",{active:B.modelId===l.value}])},[d.createElementVNode("div",Xb,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":U=>B.selected=U},null,8,qb),[[d.vModelCheckbox,B.selected]])]),d.createElementVNode("div",Jb,d.toDisplayString(R+1),1),d.createElementVNode("div",{class:"col-name",title:B.modelName},d.toDisplayString(B.modelName),9,Zb),d.createElementVNode("div",ev,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:B.modelId===l.value,onChange:U=>k(B.modelId)},null,40,tv)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",nv,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-e8abd49d"]]),sv={class:"annotation-content"},ov={class:"annotation-tools"},rv={class:"annotation-controls"},av={class:"control-group",title:"颜色"},lv={class:"tool-item color-tool"},cv={class:"control-group line-width-container",title:"线宽"},dv=["onClick"],uv={class:"option-label"},hv=Ue(d.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),l=d.ref(1),a=d.ref(!1),c=d.ref(null),u=d.ref(null),h=d.ref({top:"0px",left:"0px"}),f=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],p=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,A=()=>{i("update:visible",!1)},C=I=>{o.value=I;const g=p();if(g)switch(I){case"freehandLine":g.startFreehandLine();break;case"arrow":g.startArrow();break;case"straightLine":g.startStraightLine();break;case"rectangle":g.startRectangle();break;case"ellipse":g.startEllipse();break}},m=()=>{const I=p();I&&(I.setCurrentColor(r.value),I.changeColor(r.value))},y=()=>{if(!a.value&&c.value){const I=c.value.getBoundingClientRect();h.value={top:`${I.top}px`,left:`${I.right+8}px`}}a.value=!a.value},E=I=>{l.value=I,a.value=!1;const g=p();g&&(g.setCurrentWidth(I),g.changeWidth(I))},x=()=>{const I=p();I&&I.deleteSelectedEntity()},M=()=>{const I=p();I&&I.clearAll()},T=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const I=p();I&&I.saveAnnotations()},S=I=>{const g=I.target,k=c.value&&c.value.contains(g),P=u.value&&u.value.contains(g);!k&&!P&&(a.value=!1)};return d.onMounted(()=>{document.addEventListener("click",S)}),d.onUnmounted(()=>{document.removeEventListener("click",S)}),(I,g)=>(d.openBlock(),d.createBlock(Re,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":g[6]||(g[6]=k=>i("update:visible",k)),onClose:A},{default:d.withCtx(()=>[d.createElementVNode("div",sv,[d.createElementVNode("div",ov,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:g[0]||(g[0]=k=>C("freehandLine")),title:"手绘线"},[...g[7]||(g[7]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:g[1]||(g[1]=k=>C("arrow")),title:"箭头"},[...g[8]||(g[8]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:g[2]||(g[2]=k=>C("straightLine")),title:"直线"},[...g[9]||(g[9]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:g[3]||(g[3]=k=>C("rectangle")),title:"矩形"},[...g[10]||(g[10]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:g[4]||(g[4]=k=>C("ellipse")),title:"椭圆"},[...g[11]||(g[11]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),g[13]||(g[13]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",rv,[d.createElementVNode("div",av,[d.createElementVNode("div",lv,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":g[5]||(g[5]=k=>r.value=k),onChange:m,class:"color-input-overlay"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",cv,[d.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:c,class:"tool-item",onClick:d.withModifiers(y,["stop"])},[d.createElementVNode("div",{class:"current-width-preview",style:d.normalizeStyle({height:l.value+"px",backgroundColor:"#fff"})},null,4)],512),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[a.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"line-width-dropdown",style:d.normalizeStyle(h.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(f,k=>d.createElementVNode("div",{key:k.value,class:d.normalizeClass(["line-width-option",{selected:l.value===k.value}]),onClick:d.withModifiers(P=>E(k.value),["stop"])},[d.createElementVNode("span",uv,d.toDisplayString(k.label),1),d.createElementVNode("div",{class:"line-preview",style:d.normalizeStyle({height:k.value+"px",backgroundColor:l.value===k.value?"#1890ff":"#ddd"})},null,4)],10,dv)),64))],4)):d.createCommentVNode("",!0)]))]),g[12]||(g[12]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("button",{class:"control-btn",onClick:x,title:"删除选中"}," 🗑️ "),d.createElementVNode("button",{class:"control-btn",onClick:M,title:"清空"}," ❌ "),d.createElementVNode("button",{class:"control-btn",onClick:T,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),fv={class:"measure-content"},pv={class:"measure-tools"},gv={key:0,class:"measure-results"},mv={class:"result-row"},Av={class:"result-value"},yv={class:"result-row"},Cv={class:"result-value"},Ev={class:"result-row"},wv={class:"result-value"},bv={class:"result-row"},vv={class:"result-value"},xv={key:1,class:"result-row"},Iv={class:"result-value"},Bv={key:2,class:"result-row"},Sv={class:"result-value"},Mv={class:"measure-controls"},Tv={class:"control-group",title:"单位"},Dv={class:"unit-display"},kv=["onClick"],Pv=Ue(d.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(null),r=d.ref(null),l=d.ref("m"),a=d.ref(!1),c=d.ref(null),u=d.ref(!1),h=d.ref({}),f=d.ref(null),p=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],A=I=>{const g=l.value;return g==="mm"?`${(I*1e3).toFixed(0)}mm`:g==="cm"?`${(I*100).toFixed(1)}cm`:`${I.toFixed(2)}m`},C=I=>I>1e6?`${(I/1e6).toFixed(2)} km²`:`${I.toFixed(2)} m²`,m=()=>{if(!o.value&&s.value?.getViewer){const I=s.value.getViewer(),g=s.value.getCesium();I&&g&&(o.value=new tc({viewer:I,cesium:g}),o.value.setUnit(l.value),o.value.setSnapping(a.value),o.value.onMeasure=k=>{c.value=k})}},y=I=>{o.value||m(),r.value===I?(r.value=null,o.value?.stop()):(r.value=I,o.value?.start(I))},E=I=>{l.value=I,u.value=!1},x=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop())},M=()=>{i("update:visible",!1)},T=I=>{if(u.value){u.value=!1;return}const k=I.currentTarget.getBoundingClientRect();h.value={position:"fixed",top:`${k.top}px`,left:`${k.right+5}px`,zIndex:3e3},u.value=!0},S=I=>{u.value&&f.value&&!f.value.contains(I.target)&&(u.value=!1)};return d.onMounted(()=>{document.addEventListener("click",S),t.visible&&d.nextTick(()=>m())}),d.onUnmounted(()=>{document.removeEventListener("click",S),o.value&&o.value.destroy()}),d.watch(()=>t.visible,I=>{I?d.nextTick(()=>m()):o.value&&(o.value.stop(),r.value=null)}),d.watch(s,I=>{I&&I.getViewer&&!o.value&&t.visible&&m()}),d.watch(l,I=>{o.value&&o.value.setUnit(I)}),(I,g)=>(d.openBlock(),d.createBlock(Re,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":g[3]||(g[3]=k=>i("update:visible",k)),onClose:M},{default:d.withCtx(()=>[d.createElementVNode("div",fv,[d.createElementVNode("div",pv,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:g[0]||(g[0]=k=>y("distance")),title:"距离测量"},[...g[4]||(g[4]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:g[1]||(g[1]=k=>y("angle")),title:"角度测量"},[...g[5]||(g[5]=[d.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:g[2]||(g[2]=k=>y("area")),title:"面积测量"},[...g[6]||(g[6]=[d.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),g[15]||(g[15]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value?(d.openBlock(),d.createElementBlock("div",gv,[c.value.type==="distance"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createElementVNode("div",mv,[g[7]||(g[7]=d.createElementVNode("span",{class:"result-label"},"总长:",-1)),d.createElementVNode("span",Av,d.toDisplayString(A(c.value.dist)),1)]),d.createElementVNode("div",yv,[g[8]||(g[8]=d.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),d.createElementVNode("span",Cv,d.toDisplayString(A(c.value.dx)),1)]),d.createElementVNode("div",Ev,[g[9]||(g[9]=d.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),d.createElementVNode("span",wv,d.toDisplayString(A(c.value.dy)),1)]),d.createElementVNode("div",bv,[g[10]||(g[10]=d.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),d.createElementVNode("span",vv,d.toDisplayString(A(c.value.dz)),1)])],64)):d.createCommentVNode("",!0),c.value.type==="angle"?(d.openBlock(),d.createElementBlock("div",xv,[g[11]||(g[11]=d.createElementVNode("span",{class:"result-label"},"角度:",-1)),d.createElementVNode("span",Iv,d.toDisplayString(c.value.angle.toFixed(1))+"°",1)])):d.createCommentVNode("",!0),c.value.type==="area"?(d.openBlock(),d.createElementBlock("div",Bv,[g[12]||(g[12]=d.createElementVNode("span",{class:"result-label"},"面积:",-1)),d.createElementVNode("span",Sv,d.toDisplayString(C(c.value.area)),1)])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),d.createElementVNode("div",Mv,[d.createElementVNode("div",Tv,[d.createElementVNode("div",{class:"tool-item",onClick:d.withModifiers(T,["stop"])},[d.createElementVNode("div",Dv,d.toDisplayString(l.value),1)]),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[u.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:f,class:"unit-dropdown",style:d.normalizeStyle(h.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(p,k=>d.createElementVNode("div",{key:k.value,class:d.normalizeClass(["unit-option",{selected:l.value===k.value}]),onClick:d.withModifiers(P=>E(k.value),["stop"])},d.toDisplayString(k.label),11,kv)),64))],4)):d.createCommentVNode("",!0)]))]),g[14]||(g[14]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("div",{class:"tool-item control-btn",onClick:x,title:"清空"},[...g[13]||(g[13]=[d.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-b766acb4"]]);function Fv(){const n=d.ref(!1),e=d.reactive({x:0,y:0}),t=d.ref([]),i=d.ref(null);return{visible:n,position:e,items:t,contextData:i,show:(a,c,u)=>{a instanceof MouseEvent?(a.preventDefault(),e.x=a.clientX,e.y=a.clientY):(e.x=a.x,e.y=a.y),t.value=c,i.value=u,n.value=!0},hide:()=>{n.value=!1},addItem:a=>{t.value.push(a)},removeItem:a=>{t.value=t.value.filter(c=>c.id!==a)}}}const Rv=["onClick"],Ov={class:"menu-label"},Lv={key:0,class:"menu-arrow"},Nv=Ue(d.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(n,{emit:e}){const t=n,i=e,s=r=>{r.disabled||(r.action&&r.action(),i("action",r),i("update:visible",!1))},o=()=>{t.visible&&i("update:visible",!1)};return d.onMounted(()=>{document.addEventListener("click",o),document.addEventListener("contextmenu",r=>{r.target.closest(".leiting-context-menu")||o()})}),d.onUnmounted(()=>{document.removeEventListener("click",o)}),(r,l)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:"leiting-context-menu",style:d.normalizeStyle({left:n.position.x+"px",top:n.position.y+"px"}),onContextmenu:l[0]||(l[0]=d.withModifiers(()=>{},["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(n.items,a=>(d.openBlock(),d.createElementBlock("div",{key:a.id,class:d.normalizeClass(["menu-item",{"menu-divided":a.divided,"menu-disabled":a.disabled}]),onClick:c=>s(a)},[d.createElementVNode("span",Ov,d.toDisplayString(a.label),1),a.children?(d.openBlock(),d.createElementBlock("span",Lv,"▶")):d.createCommentVNode("",!0)],10,Rv))),128))],36)),[[d.vShow,n.visible]])}}),[["__scopeId","data-v-f288753b"]]),Uv={class:"leiting-ui-overlay"},Qi=Ue(d.defineComponent({__name:"LeitingBIM",props:{accessToken:{},cesiumUrl:{},cesiumCssUrl:{},methods:{},viewerOptions:{},treeProps:{},showTree:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!1},playerUrl:{default:"https://leiting.chenxisoft.com/resource/person/person.glb"},playerModelName:{default:"Person"},playerModelId:{default:"player_111"},playerScale:{default:.0032},tiandituToken:{default:"c25f14fb6bd4397cf8fe45144ff768d6"},globe:{type:Boolean,default:void 0},terrain:{type:Boolean,default:void 0},depthTest:{type:Boolean,default:void 0},mapProvider:{},tiandituLayerType:{},tiandituShowLabel:{type:Boolean,default:void 0},arcgisUrl:{},shadows:{type:Boolean,default:void 0},environmentMap:{type:Boolean,default:void 0},ambientOcclusion:{type:Boolean,default:void 0},time:{},brightness:{},backgroundColor:{},collision:{type:Boolean,default:void 0},mouseHabit:{},mode:{default:"3d"},mountAll3Dtiles:{},mountAllCad:{},saveRegion:{},saveCadRegion:{},saveCadCalibration:{},selectionChange:{},searchComponent:{}},emits:["register","init","ready"],setup(n,{emit:e}){const t=d.ref(),i=d.getCurrentInstance(),s=d.ref(!1),o=d.ref(""),r=d.ref({}),l=d.ref("3d"),a=n,c={title:"构件树",treeData:[]},u=d.ref(!1),h=d.ref(!1),f=d.ref(!1),p=d.ref(!1),A=d.ref(!1),C=d.ref(!1),m=d.ref(!1),y=d.ref(!1),E=d.ref(!1),x=d.ref(!1),{visible:M,position:T,items:S,show:I,hide:g}=Fv(),k=d.ref([]),P=Y=>{k.value.push(Y)},F=Y=>{k.value=k.value.filter(j=>j.id!==Y)},L=d.ref([]),G=d.ref(""),O=d.ref(null),v=d.ref([]),w=d.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,annotation:!1}),b=(Y,j)=>{Y==="componentTree"&&(Y="tree"),Y==="componentInfo"&&(Y="info"),Y in w&&(w[Y]=j)},B=d.shallowRef({});d.provide("leitingMethods",B);const R=d.ref(a.showMenu),U=d.ref([]);d.watch(()=>a.showMenu,Y=>{R.value=Y},{immediate:!0}),d.watch(()=>a.mode,Y=>{Y&&B.value?.set2d&&B.value.set2d(Y==="2d")});const N=d.ref("dark");d.provide("leiting-theme",N);const D=d.ref([]),Q=d.computed(()=>{const Y=[];return u.value&&(Y.push("tree"),Y.push("componentTree")),h.value&&Y.push("section"),f.value&&Y.push("roam"),p.value&&(Y.push("info"),Y.push("componentInfo")),A.value&&Y.push("adjust"),C.value&&Y.push("setting"),m.value&&Y.push("cadLayer"),y.value&&Y.push("cadPosition"),E.value&&Y.push("annotation"),x.value&&(Y.push("measure"),Y.push("measurement")),Y.push(...D.value),Y}),V=d.ref(null),$=(Y,j)=>{Y==="componentTree"||Y==="tree"?u.value=j:Y==="section"?h.value=j:Y==="roam"?f.value=j:Y==="componentInfo"||Y==="info"?p.value=j:Y==="homeView"?B.value?.is2dMode?.()?B.value?.flyToTopView?.({}):B.value?.flyToTileset?.({}):Y==="adjustModel"?(A.value=j,j&&V.value&&V.value.setModelType("BIM")):Y==="osgbAdjust"?(A.value=j,j&&V.value&&V.value.setModelType("OSGB")):Y==="setting"?C.value=j:Y==="cadLayer"?m.value=j:Y==="cadPosition"?y.value=j:Y==="annotation"?E.value=j:Y==="measurement"?x.value=j:j?D.value.includes(Y)||D.value.push(Y):D.value=D.value.filter(X=>X!==Y)};d.watch(u,async Y=>{if(Y&&B.value?.loadTreeForModel&&B.value?.getMapTileset){const j=B.value.getMapTileset(),X=Object.values(j).map(async se=>{if(se.leiting&&!se.leiting.tree&&se.leiting.model?.treeUrl){const oe=se.leiting.model.modelId;try{se.leiting?.node?.batchIdEIDInfos||await B.value.methods.loadNodeDetailsForModel(oe);const ae=await B.value.loadTreeForModel(oe);ae&&(Array.isArray(ae)?ae:[ae]).forEach(le=>{le&&!v.value.find(Pe=>Pe.id===le.id)&&(le.modelId=oe,v.value=[...v.value,le])})}catch(ae){console.warn(`Failed to lazy load tree for ${oe}`,ae)}}});await Promise.all(X)}});const J=()=>{B.value&&(B.value.getDxfModels&&(L.value=B.value.getDxfModels()||[]),B.value.getCadModelId&&(G.value=B.value.getCadModelId()||""))};d.watch(m,Y=>{Y&&J()}),d.watch(y,Y=>{Y&&(J(),O.value&&L.value.length&&O.value.addGltfOr3dTilesModelList(L.value))});const ne=e,re=Y=>{B.value&&B.value.saveCadCalibration&&B.value.saveCadCalibration(Y),B.value&&B.value.saveCadRegion&&B.value.saveCadRegion(Y)};return d.onMounted(async()=>{if(t.value)try{const Y={...It,cesiumUrl:a.cesiumUrl||It.cesiumUrl,cesiumCssUrl:a.cesiumCssUrl||It.cesiumCssUrl,accessToken:a.accessToken||ns()||It.accessToken};await ts(Y);const j=a.accessToken||ns()||It.accessToken;j&&(Cesium.Ion.defaultAccessToken=j),s.value=!0;const X=(oe={},ae)=>{if(t.value){const{showMenu:Ce,showTree:le,globe:Pe,terrain:ct,depthTest:$e,mapProvider:vt,tiandituLayerType:it,tiandituShowLabel:dn,arcgisUrl:Ut,shadows:_t,environmentMap:Xi,ambientOcclusion:Ke,time:Oe,brightness:st,backgroundColor:dt,collision:Qt,mouseHabit:Ht,mode:xt,...Be}=oe||{},Do=a.showMenu!==void 0?a.showMenu:Ce!==void 0?Ce:!0;R.value=Do;const ke=(ee,xe,Yt)=>ee!==void 0?ee:xe!==void 0?xe:Yt,un=ke(a.globe,Pe,!1),hn=ke(a.terrain,ct,!1),$n=ke(a.depthTest,$e,!1),Kn=ke(a.mapProvider,vt,"tianditu"),Xn=ke(a.tiandituLayerType,it,"img_w"),qi=ke(a.tiandituShowLabel,dn,!1),qc=ke(a.arcgisUrl,Ut,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),Jc=ke(a.shadows,_t,!1),Zc=ke(a.environmentMap,Xi,!1),ed=ke(a.ambientOcclusion,Ke,!1),td=ke(a.time,Oe,void 0),nd=ke(a.brightness,st,1),Ji=a.mode||xt||"3d";console.log("LeitingBIM Mode:",Ji,"Props:",a.mode,"Options:",xt),l.value=Ji;const _I=Ji==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",id=ke(a.backgroundColor,dt,_I),sd=ke(a.collision,Qt,!1),od=ke(a.mouseHabit,Ht,0);r.value={globe:un,terrain:hn,depthTest:$n,mapProvider:Kn,tiandituLayerType:Xn,tiandituShowLabel:qi,arcgisUrl:qc,shadows:Jc,environmentMap:Zc,ambientOcclusion:ed,time:td,brightness:nd,backgroundColor:id,collision:sd,mouseHabit:od};const qn=P0({container:t.value,appContext:i?.appContext,methods:{...B.value,handleMenuAction:$,setCardFullHeight:b,onLoadingStatus:ee=>{ee?ge.loading(ee,"",t.value):ge.close()},...Be,tilesLoad3dTiles:async ee=>{let xe=ee.leiting?.tree;const Yt=ee.leiting?.model?.modelId;if(!xe&&u.value&&B.value?.loadTreeForModel)try{xe=await B.value.loadTreeForModel(Yt)}catch(Zn){console.warn("Failed to lazy load tree",Zn)}xe&&(Array.isArray(xe)?xe:[xe]).forEach(Vt=>{Vt&&!v.value.find(ad=>ad.id===Vt.id)&&(Vt.modelId=Yt,v.value=[...v.value,Vt])});const{brightness:ko,contrast:Po,saturation:ut}=qn.methods.getConfigure();qn.methods.setModelColorAdjustment({brightness:ko,contrast:Po,saturation:ut}),Be.tilesLoad3dTiles?.(ee)},mountAll3Dtiles:ee=>{a.mountAll3Dtiles&&a.mountAll3Dtiles(ee),Be.mountAll3Dtiles?.(ee)},mountAllCad:ee=>{if(qn.methods.setModelBrightness){const xe=a.brightness!==void 0?a.brightness:r.value.brightness;xe!==void 0&&qn.methods.setModelBrightness(xe)}a.mountAllCad&&a.mountAllCad(ee),Be.mountAllCad?.(ee)},saveRegion:ee=>{a.saveRegion&&a.saveRegion(ee),Be.saveRegion?.(ee)},saveCadRegion:ee=>{a.saveCadRegion&&a.saveCadRegion(ee),Be.saveCadRegion?.(ee)},saveCadCalibration:ee=>{a.saveCadCalibration&&a.saveCadCalibration(ee),Be.saveCadCalibration?.(ee)},selectionChange:ee=>{a.selectionChange&&a.selectionChange(ee),Be.selectionChange?.(ee)},onSearchComponent:ee=>{a.searchComponent&&a.searchComponent(ee),Be.searchComponent?.(ee)}},viewerOptions:a.viewerOptions,options:{...Be,mode:Ji,playerUrl:a.playerUrl,playerModelName:a.playerModelName,playerModelId:a.playerModelId,playerScale:a.playerScale,globe:un,terrain:hn,depthTest:$n,mapProvider:Kn,tiandituLayerType:Xn,tiandituShowLabel:qi,tiandituToken:a.tiandituToken,arcgisUrl:qc,shadows:Jc,environmentMap:Zc,ambientOcclusion:ed,time:td,brightness:nd,backgroundColor:id,collision:sd,mouseHabit:od},callbacks:{onLoading:ee=>ee?ge.loading(ee,"",t.value):ge.close(),onSuccess:ee=>ge.success(ee,"",void 0,t.value),onError:ee=>ge.error(ee,"",void 0,t.value)}}),{Cesium:Gt,viewer:fn,methods:Zi,menuEvents:Jn}=qn,ve=Zi;Jn.on("showMenu",ee=>{R.value=ee}),Jn.on("insertMenu",ee=>{U.value=ee}),Jn.on("setMenuActive",(ee,xe)=>{$(ee,xe)}),B.value=ve,ae&&(ae.value=ve),Jn.on("setMode",ee=>{l.value=ee}),Jn.on("deleteAllModels",()=>{v.value=[]}),new Gt.ScreenSpaceEventHandler(fn.scene.canvas).setInputAction(ee=>{if(g(),l.value==="2d")return;const xe=fn.scene.pick(ee.position),Yt=fn.container.getBoundingClientRect(),ko=Yt.left+ee.position.x,Po=Yt.top+ee.position.y,ut=[];if(Gt.defined(xe)&&xe instanceof Gt.Cesium3DTileFeature){const Zn=ve.baseCompt.getFeatureId(xe),Vt=Sn(xe.tileset);ve.baseCompt.hasSelectedFeaturesMap[Vt]?.some(ei=>ei.batchId===Zn&&ei.rank===0)||(ve.baseCompt.clearSelection(),ve.baseCompt.toggleMultiSelect(Vt,Zn,ve.baseCompt.selectedColor)),ut.push({id:"details",label:"构件详情",action:()=>{p.value=!0}}),ut.push({id:"hide",label:"隐藏选中构件",action:()=>{const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,show:!1}));ve.baseCompt.setComponentVisibility(ti)}}),ut.push({id:"translucent",label:"半透明选中构件",action:()=>{const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,rgba:{...ht.rgba,a:.3}}));ve.baseCompt.setSelectColorUserModelCpt(ti,{rank:0})}}),ut.push({id:"isolate",label:"隔离选中构件",divided:!0,action:()=>{ve.baseCompt.setAllComponentsVisibility(!1);const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,show:!0}));ve.baseCompt.setComponentVisibility(ti)}})}ut.push({id:"showAll",label:"显示所有",action:()=>{ve.baseCompt.setAllComponentsVisibility(!0),ve.baseCompt.clearSelection()}}),ut.push(...k.value),I({x:ko,y:Po},ut)},Gt.ScreenSpaceEventType.RIGHT_CLICK),ve.insertContextMenu=P,ve.deleteContextMenu=F,ve.hideContextMenu=g;const rd=oe?.onLoaded||oe?.onloaded;rd&&rd({Cesium:Gt,viewer:fn,methods:Zi}),ne("init",{Cesium:Gt,viewer:fn,methods:Zi}),ne("ready",{Cesium:Gt,viewer:fn,methods:Zi})}};let se=!1;ne("register",(oe,ae)=>{se=!0,X(oe,ae)}),se||setTimeout(()=>{B.value.getViewer||X()},0)}catch(Y){o.value="Failed to load Cesium: "+(Y.message||Y),console.error(Y)}}),(Y,j)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-bim-container",[`theme-${N.value}`]]),onContextmenu:j[11]||(j[11]=d.withModifiers(()=>{},["prevent","stop"]))},[!s.value&&!o.value?(d.openBlock(),d.createBlock(d.unref(me.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):d.createCommentVNode("",!0),o.value?(d.openBlock(),d.createBlock(d.unref(me.Alert),{key:1,class:"error",type:"error",message:o.value,"show-icon":""},null,8,["message"])):d.createCommentVNode("",!0),d.createElementVNode("div",{ref_key:"containerRef",ref:t,class:"cesium-viewer"},[d.createElementVNode("div",Uv,[d.createVNode(Qn,{visible:p.value,"full-height":w.info,"onUpdate:visible":j[0]||(j[0]=X=>p.value=X)},null,8,["visible","full-height"]),d.createVNode(Hn,{ref_key:"LeitingPositionRef",ref:V,visible:A.value,"full-height":w.adjustModel,"onUpdate:visible":j[1]||(j[1]=X=>A.value=X)},null,8,["visible","full-height"]),d.createVNode(Gn,{visible:C.value,"full-height":w.setting,"tianditu-token":a.tiandituToken,"initial-config":r.value,"onUpdate:visible":j[2]||(j[2]=X=>C.value=X)},null,8,["visible","full-height","tianditu-token","initial-config"]),n.showTree!==!1?(d.openBlock(),d.createBlock(Pi,d.mergeProps({key:0},{...c,...n.treeProps},{visible:u.value,"full-height":w.tree,"tree-data":v.value.length>0?v.value:n.treeProps?.treeData||[],"onUpdate:visible":j[3]||(j[3]=X=>{u.value=X})}),null,16,["visible","full-height","tree-data"])):d.createCommentVNode("",!0),d.createVNode(hv,{visible:E.value,"onUpdate:visible":j[4]||(j[4]=X=>E.value=X)},null,8,["visible"]),d.createVNode(Pv,{visible:x.value,"onUpdate:visible":j[5]||(j[5]=X=>x.value=X)},null,8,["visible"]),d.createVNode(Un,{visible:h.value,"full-height":w.section,"onUpdate:visible":j[6]||(j[6]=X=>h.value=X)},null,8,["visible","full-height"]),d.createVNode(_n,{visible:f.value,"full-height":w.roam,"onUpdate:visible":j[7]||(j[7]=X=>f.value=X)},null,8,["visible","full-height"]),d.createVNode(Nn,{visible:R.value,"active-ids":Q.value,"custom-items":U.value,onAction:$,"is-2d":l.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"]),d.createVNode(db,{visible:m.value,"current-model-id":G.value,"onUpdate:visible":j[8]||(j[8]=X=>m.value=X)},null,8,["visible","current-model-id"]),d.createVNode(iv,{ref_key:"cadPositionRef",ref:O,visible:y.value,"onUpdate:visible":j[9]||(j[9]=X=>y.value=X),onSave:re},null,8,["visible"]),d.createVNode(Nv,{visible:d.unref(M),position:d.unref(T),items:d.unref(S),"onUpdate:visible":j[10]||(j[10]=X=>M.value=X)},null,8,["visible","position","items"]),d.renderSlot(Y.$slots,"default",d.normalizeProps(d.guardReactiveProps({methods:B.value,isReady:s.value})),void 0,!0)])],512)],34))}}),[["__scopeId","data-v-e8b89326"]]);function pc(n){const e=d.ref(),t=d.ref(n.theme||"dark"),i=d.ref(n.menuSize||"medium");d.provide("leiting-theme",t),d.provide("leiting-menu-size",i);function s(l){d.onUnmounted(()=>{e.value=null}),l(n,e)}function o(){const l=d.unref(e);return l||console.error("未获取到leiting实例!"),l}const r=new Proxy({},{get(l,a){const c=o();if(!c)return;const u=c[a];return typeof u=="function"?u.bind(c):u},set(l,a,c){const u=o();return u?(u[a]=c,!0):!1}});return[s,r]}const _v=It,Qv={install:(n,e)=>{if(n.component("LeitingBIM",Qi),n.component("LeitingTree",Pi),n.component("LeitingDraggableCard",Re),n.component("leiting-draggable-card",Re),n.component("LeitingMenu",Nn),n.component("leiting-menu",Nn),n.component("LeitingSection",Un),n.component("leiting-section",Un),n.component("LeitingPlayer",_n),n.component("leiting-player",_n),n.component("LeitingInfo",Qn),n.component("leiting-info",Qn),n.component("LeitingPosition",Hn),n.component("leiting-position",Hn),n.component("LeitingSetting",Gn),n.component("leiting-setting",Gn),!e)return;const t={..._v,...e};t.cesiumUrl&&ts(t).catch(i=>{console.error("[LeitingBim] Failed to load Cesium resources:",i)}),n.config.globalProperties.$leitingBimOptions=t}};var W={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function gc(n="soft"){switch(n){case"auto":{W.session.styleMap=new Map,W.session.nodeMap=new Map;return}case"soft":{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap,W.computedStyle=new WeakMap,W.baseStyle=new Map,W.defaultStyle=new Map,W.image=new Map,W.background=new Map,W.resource=new Map,W.font=new Set;return}default:{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap;return}}}function ho(n){const e=n.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const t=e[2].trim();return t.startsWith("#")?null:t}function Hv(n){if(!n||n==="none")return"";let e=n.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(t,i)=>{const s=i.split(",").map(o=>o.trim());return s.length!==6?`matrix(${i})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(t,i)=>{const s=i.split(",").map(o=>o.trim());return s.length!==16?`matrix3d(${i})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function Hi(n){if(/%[0-9A-Fa-f]{2}/.test(n))return n;try{return encodeURI(n)}catch{return n}}function Gv(n="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:t=12}={}){const i=new Map;let s=0;function o(r,l,a){if(s>=t)return;const c=Date.now();(i.get(l)||0)>c||(i.set(l,c+e),s++,r==="warn"&&console&&console.warn?console.warn(`${n} ${a}`):console&&console.error&&console.error(`${n} ${a}`))}return{warnOnce(r,l){o("warn",r,l)},errorOnce(r,l){o("error",r,l)},reset(){i.clear(),s=0}}}var mc=Gv("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),fo=new Map,Gi=new Map;function Yv(n){return/^data:|^blob:|^about:blank$/i.test(n)}function Vv(n,e){try{const t=typeof location<"u"&&location.href?location.href:"http://localhost/",i=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(i||".",t),o=new URL(n,t);if(o.origin===s.origin)return!0;const r=o.searchParams;if(r&&(r.has("url")||r.has("target")))return!0}catch{}return!1}function Wv(n,e){if(!e||Yv(n)||Vv(n,e))return!1;try{const t=typeof location<"u"&&location.href?location.href:"http://localhost/",i=new URL(n,t);return typeof location<"u"?i.origin!==location.origin:!0}catch{return!!e}}function zv(n,e){if(!e)return n;if(e.includes("{url}"))return e.replace("{urlRaw}",Hi(n)).replace("{url}",encodeURIComponent(n));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(n)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(n)}`;if(e.endsWith("/"))return`${e}${Hi(n)}`;const t=e.includes("?")?"&":"?";return`${e}${t}url=${encodeURIComponent(n)}`}function Ac(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(String(i.result||"")),i.onerror=()=>t(new Error("read_failed")),i.readAsDataURL(n)})}function jv(n,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,n].join("|")}async function je(n,e={}){const t=e.as??"blob",i=e.timeout??3e3,s=e.useProxy||"",o=e.errorTTL??8e3,r=e.headers||{},l=!!e.silent;if(/^data:/i.test(n))try{if(t==="text")return{ok:!0,data:String(n),status:200,url:n,fromCache:!1};if(t==="dataURL")return{ok:!0,data:String(n),status:200,url:n,fromCache:!1,mime:String(n).slice(5).split(";")[0]||""};const[,m="",y=""]=String(n).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(m)?atob(y):decodeURIComponent(y),M=new Uint8Array([...x].map(S=>S.charCodeAt(0))),T=new Blob([M],{type:(m||"").split(";")[0]||""});return{ok:!0,data:T,status:200,url:n,fromCache:!1,mime:T.type||""}}catch{return{ok:!1,data:null,status:0,url:n,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(n))try{const m=await fetch(n);if(!m.ok)return{ok:!1,data:null,status:m.status,url:n,fromCache:!1,reason:"http_error"};const y=await m.blob(),E=y.type||m.headers.get("content-type")||"";return t==="dataURL"?{ok:!0,data:await Ac(y),status:m.status,url:n,fromCache:!1,mime:E}:t==="text"?{ok:!0,data:await y.text(),status:m.status,url:n,fromCache:!1,mime:E}:{ok:!0,data:y,status:m.status,url:n,fromCache:!1,mime:E}}catch{return{ok:!1,data:null,status:0,url:n,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(n))return t==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:n,fromCache:!1,mime:"image/png"}:{ok:!0,data:t==="text"?"":new Blob([]),status:200,url:n,fromCache:!1};const a=jv(n,{as:t,timeout:i,useProxy:s,errorTTL:o}),c=Gi.get(a);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&Gi.delete(a);const u=fo.get(a);if(u)return u;const h=Wv(n,s)?zv(n,s):n;let f=e.credentials;if(!f)try{const m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(n,m);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}const p=new AbortController,A=setTimeout(()=>p.abort("timeout"),i),C=(async()=>{try{const m=await fetch(h,{signal:p.signal,credentials:f,headers:r});if(!m.ok){const x={ok:!1,data:null,status:m.status,url:h,fromCache:!1,reason:"http_error"};if(o>0&&Gi.set(a,{until:Date.now()+o,result:x}),!l){const M=`${m.status} ${m.statusText||""}`.trim();mc.warnOnce(`http:${m.status}:${t}:${new URL(n,location?.href??"http://localhost/").origin}`,`HTTP error ${M} while fetching ${t} ${n}`)}return e.onError&&e.onError(x),x}if(t==="text")return{ok:!0,data:await m.text(),status:m.status,url:h,fromCache:!1};const y=await m.blob(),E=y.type||m.headers.get("content-type")||"";return t==="dataURL"?{ok:!0,data:await Ac(y),status:m.status,url:h,fromCache:!1,mime:E}:{ok:!0,data:y,status:m.status,url:h,fromCache:!1,mime:E}}catch(m){const y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.message||"").includes("timeout")?"timeout":"abort":"network",E={ok:!1,data:null,status:0,url:h,fromCache:!1,reason:y};if(!/^blob:/i.test(n)&&o>0&&Gi.set(a,{until:Date.now()+o,result:E}),!l){const x=`${y}:${t}:${new URL(n,location?.href??"http://localhost/").origin}`,M=y==="timeout"?`Timeout after ${i}ms. Consider increasing timeout or using a proxy for ${n}`:y==="abort"?`Request aborted while fetching ${t} ${n}`:`Network/CORS issue while fetching ${t} ${n}. A proxy may be required`;mc.errorOnce(x,M)}return e.onError&&e.onError(E),E}finally{clearTimeout(A),fo.delete(a)}})();return fo.set(a,C),C}function po(n,e){if(!e||!n.width||!n.height)return n;const t=document.createElement("canvas");t.width=n.width,t.height=n.height;const i=t.getContext("2d");return i.fillStyle=e,i.fillRect(0,0,t.width,t.height),i.drawImage(n,0,0),t}async function go(n,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(n)||n.trim()==="none")return n;const i=ho(n);if(!i)return n;const s=Hi(i);if(W.background.has(s)){const o=W.background.get(s);return o?`url("${o}")`:"none"}try{const o=await je(s,{as:"dataURL",useProxy:e.useProxy});return o.ok?(W.background.set(s,o.data),`url("${o.data}")`):(W.background.set(s,null),"none")}catch{return W.background.set(s,null),"none"}}var yc=new Set(["meta","script","noscript","title","link","template"]),Yi=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),$v=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function Kv(){for(let n of $v){const e=String(n).toLowerCase();yc.has(e)||Yi.has(e)||Cc(e)}}function Cc(n){if(n=String(n).toLowerCase(),Yi.has(n)){const o={};return W.defaultStyle.set(n,o),o}if(W.defaultStyle.has(n))return W.defaultStyle.get(n);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));const t=document.createElement(n);t.style.all="initial",e.appendChild(t);const i=getComputedStyle(t),s={};for(let o of i){if(Ec(o))continue;const r=i.getPropertyValue(o);s[o]=r}return e.removeChild(t),W.defaultStyle.set(n,s),s}var Xv=/(?:^|-)(animation|transition)(?:-|$)/i,qv=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Jv=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function Ec(n){const e=String(n).toLowerCase();return!!(Jv.has(e)||qv.test(e)||Xv.test(e))}function mo(n,e){if(e=String(e||"").toLowerCase(),Yi.has(e))return"";const t=[],i=Cc(e);for(let[s,o]of Object.entries(n)){if(Ec(s))continue;const r=i[s];o&&o!==r&&t.push(`${s}:${o}`)}return t.sort(),t.join(";")}function Zv(n){const e=new Set;return n.nodeType!==Node.ELEMENT_NODE&&n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(n.tagName&&e.add(n.tagName.toLowerCase()),typeof n.querySelectorAll=="function"&&n.querySelectorAll("*").forEach(t=>e.add(t.tagName.toLowerCase())),Array.from(e))}function ex(n){const e=new Map;for(let i of n){const s=W.defaultStyle.get(i);if(!s)continue;const o=Object.entries(s).map(([r,l])=>`${r}:${l};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(i))}let t="";for(let[i,s]of e.entries())t+=`${s.join(",")} { ${i} }
118
- `;return t}function tx(n){const e=Array.from(new Set(n.values())).filter(Boolean).sort(),t=new Map;let i=1;for(const s of e)t.set(s,`c${i++}`);return t}function Ao(n,e=null){if(!(n instanceof Element))return window.getComputedStyle(n,e);let t=W.computedStyle.get(n);if(t||(t=new Map,W.computedStyle.set(n,t)),!t.has(e)){const i=window.getComputedStyle(n,e);t.set(e,i)}return t.get(e)}function wc(n){const e={};for(let t of n)e[t]=n.getPropertyValue(t);return e}function yo(n){const e=[];let t=0,i=0;for(let s=0;s<n.length;s++){const o=n[s];o==="("&&t++,o===")"&&t--,o===","&&t===0&&(e.push(n.slice(i,s).trim()),i=s+1)}return e.push(n.slice(i).trim()),e}function ln(n,{fast:e=!1}={}){if(e)return n();"requestIdleCallback"in window?requestIdleCallback(n,{timeout:50}):setTimeout(n,1)}function nt(){const n=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(n),t=/AppleWebKit/i.test(n)&&/Mobile/i.test(n)&&!/Safari/i.test(n),i=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(n);return e||t||i}var bc=new WeakMap,Co=new Map,Eo=0;function Yn(){Eo++}var vc=!1;function nx(n=document.documentElement){if(!vc){vc=!0;try{new MutationObserver(()=>Yn()).observe(n,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Yn()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const e=document.fonts;e&&(e.addEventListener?.("loadingdone",Yn),e.ready?.then(()=>Yn()).catch(()=>{}))}catch{}}}function ix(n,e={}){const t={},i=n.getPropertyValue("visibility");for(let s=0;s<n.length;s++){const o=n[s];let r=n.getPropertyValue(o);(o==="background-image"||o==="content")&&r.includes("url(")&&!r.includes("data:")&&(r="none"),t[o]=r}if(e.embedFonts){const s=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const o of s)if(!t[o])try{const r=n.getPropertyValue(o);r&&(t[o]=r)}catch{}}return i==="hidden"&&(t.opacity="0"),t}var xc=new WeakMap;function sx(n){let e=xc.get(n);return e||(e=Object.entries(n).sort((i,s)=>i[0]<s[0]?-1:i[0]>s[0]?1:0).map(([i,s])=>`${i}:${s}`).join(";"),xc.set(n,e),e)}function ox(n,e=null,t={}){const i=bc.get(n);if(i&&i.epoch===Eo)return i.snapshot;const s=e||getComputedStyle(n),o=ix(s,t);return ux(n,s,o),bc.set(n,{epoch:Eo,snapshot:o}),o}function rx(n,e){return n&&n.session&&n.persist?n:n&&(n.styleMap||n.styleCache||n.nodeMap)?{session:n,persist:{snapshotKeyCache:Co,defaultStyle:W.defaultStyle,baseStyle:W.baseStyle,image:W.image,resource:W.resource,background:W.background,font:W.font},options:e||{}}:{session:W.session,persist:{snapshotKeyCache:Co,defaultStyle:W.defaultStyle,baseStyle:W.baseStyle,image:W.image,resource:W.resource,background:W.background,font:W.font},options:n||e||{}}}async function cn(n,e,t,i){if(n.tagName==="STYLE")return;const s=rx(t,i),o=s.options&&s.options.cache||"auto";if(o!=="disabled"&&nx(document.documentElement),o==="disabled"&&!s.session.__bumpedForDisabled&&(Yn(),Co.clear(),s.session.__bumpedForDisabled=!0),Yi.has(n.tagName?.toLowerCase())){const f=n.getAttribute?.("style");f&&e.setAttribute("style",f)}const{session:r,persist:l}=s;r.styleCache.has(n)||r.styleCache.set(n,getComputedStyle(n));const a=r.styleCache.get(n),c=ox(n,a,s.options),u=sx(c);let h=l.snapshotKeyCache.get(u);if(!h){const f=n.tagName?.toLowerCase()||"div";h=mo(c,f),l.snapshotKeyCache.set(u,h)}r.styleMap.set(e,h)}function ax(n){return n instanceof HTMLImageElement||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof HTMLIFrameElement||n instanceof SVGElement||n instanceof HTMLObjectElement||n instanceof HTMLEmbedElement}function lx(n){return n.backgroundImage&&n.backgroundImage!=="none"||n.backgroundColor&&n.backgroundColor!=="rgba(0, 0, 0, 0)"&&n.backgroundColor!=="transparent"||(parseFloat(n.borderTopWidth)||0)>0||(parseFloat(n.borderBottomWidth)||0)>0||(parseFloat(n.paddingTop)||0)>0||(parseFloat(n.paddingBottom)||0)>0?!0:(n.overflowBlock||n.overflowY||"visible")!=="visible"}function cx(n){const e=n.parentElement;if(!e)return!1;const t=getComputedStyle(e).display||"";return t.includes("flex")||t.includes("grid")}function dx(n,e){if(n.textContent&&/\S/.test(n.textContent))return!0;const t=n.firstElementChild,i=n.lastElementChild;if(t&&t.tagName==="BR"||i&&i.tagName==="BR")return!0;const s=n.scrollHeight;if(s===0)return!1;const o=parseFloat(e.paddingTop)||0,r=parseFloat(e.paddingBottom)||0;return s>o+r}function ux(n,e,t){if(n instanceof HTMLElement&&n.style&&n.style.height)return;const i=e.display||"";if(i.includes("flex")||i.includes("grid")||ax(n))return;const s=e.position;s==="absolute"||s==="fixed"||s==="sticky"||e.transform==="none"&&(lx(e)||cx(n)||dx(n,e)&&(delete t.height,delete t["block-size"]))}function hx(n,e){if(!(n instanceof Element)||!(e instanceof Element))return;const t=n.getAttribute?.("style");let i=!!(t&&t.includes("var("));if(!i&&n.attributes?.length){const r=n.attributes;for(let l=0;l<r.length;l++){const a=r[l];if(a&&typeof a.value=="string"&&a.value.includes("var(")){i=!0;break}}}if(!i)return;let s;try{s=getComputedStyle(n)}catch{return}const o=n.style;if(o&&o.length)for(let r=0;r<o.length;r++){const l=o[r],a=o.getPropertyValue(l);if(!a||!a.includes("var("))continue;const c=s.getPropertyValue(l);if(c)try{e.style.setProperty(l,c.trim(),o.getPropertyPriority(l))}catch{}}if(n.attributes?.length){const r=n.attributes;for(let l=0;l<r.length;l++){const a=r[l];if(!a||typeof a.value!="string"||!a.value.includes("var("))continue;const c=a.name;let u="";try{u=s.getPropertyValue(c)}catch{}if(u)try{e.style.setProperty(c,u.trim())}catch{}}}}function wo(n,e,t){return Promise.all(n.map(i=>new Promise(s=>{function o(){ln(r=>{(r&&typeof r.timeRemaining=="function"?r.timeRemaining()>0:!0)?e(i,s):o()},{fast:t})}o()})))}function fx(n){return n=n.trim(),!n||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(n)?n:`${n}:not([data-sd-slotted])`}function px(n,e,t=!0){return n.split(",").map(i=>i.trim()).filter(Boolean).map(i=>{if(i.startsWith(":where(")||i.startsWith("@"))return i;const s=t?fx(i):i;return`:where(${e} ${s})`}).join(", ")}function gx(n,e){return n?(n=n.replace(/:host\(([^)]+)\)/g,(t,i)=>`:where(${e}:is(${i.trim()}))`),n=n.replace(/:host\b/g,`:where(${e})`),n=n.replace(/:host-context\(([^)]+)\)/g,(t,i)=>`:where(:where(${i.trim()}) ${e})`),n=n.replace(/::slotted\(([^)]+)\)/g,(t,i)=>`:where(${e} ${i.trim()})`),n=n.replace(/(^|})(\s*)([^@}{]+){/g,(t,i,s,o)=>{const r=px(o,e,!0);return`${i}${s}${r}{`}),n):""}function mx(n){return n.shadowScopeSeq=(n.shadowScopeSeq||0)+1,`s${n.shadowScopeSeq}`}function Ax(n){let e="";try{n.querySelectorAll("style").forEach(i=>{e+=(i.textContent||"")+`
117
+ `});f.isModelAdjustment=!0,h.customShader=f}else e.brightness!==void 0&&e.brightness!==1&&!h.style&&(h.style=new i.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=null;_updateLightDirection=e=>{e.light instanceof this.cesium.DirectionalLight&&(e.light.direction=e.camera.directionWC)};setEnvironmentMapEnable(e){this.is2d||(e?(this.viewer.scene.light=new this.cesium.DirectionalLight({direction:this.viewer.scene.camera.directionWC}),this.viewer.scene.preRender.addEventListener(this._updateLightDirection)):(this._defaultSkyBox&&(this.viewer.scene.skyBox=this._defaultSkyBox),this.viewer.scene.preRender.removeEventListener(this._updateLightDirection),this.viewer.scene.light=new this.cesium.SunLight),this.viewer.scene.imageBasedLighting&&(this.viewer.scene.imageBasedLighting.imageBasedLightingFactor=e?new this.cesium.Cartesian2(2,2):new this.cesium.Cartesian2(1,1)))}setAmbientOcclusion(e){if(this.is2d)return;const t=this.viewer.scene;if(!t||!t.postProcessStages||!t.postProcessStages.ambientOcclusion)return;const i=t.postProcessStages.ambientOcclusion;i.enabled=e,e&&(i.uniforms.ambientOcclusionOnly=!1,i.uniforms.intensity=3,i.uniforms.bias=.1,i.uniforms.lengthCap=.03,i.uniforms.stepSize=1,i.uniforms.blurStepSize=.86)}setCollisionDetection(e){if(this.is2d){this.viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1;return}const t=this.viewer.scene.screenSpaceCameraController;t.enableCollisionDetection=e,e||t.minimumZoomDistance<1&&(t.minimumZoomDistance=1)}setMouseHabit(e){if(this.is2d)return;const t=this.viewer.scene.screenSpaceCameraController;t.enableTranslate=!0,t.enableRotate=!0,t.enableZoom=!0,t.enableTilt=!0,t.enableLook=!1,t.lookEventTypes=[],e===1?(t.rotateEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.MIDDLE_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.LEFT_DRAG]):(t.rotateEventTypes=[this.cesium.CameraEventType.LEFT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.MIDDLE_DRAG])}}class R0{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}getCameraView(){const e=this.viewer.camera;return{position:{x:e.position.x,y:e.position.y,z:e.position.z},orientation:{heading:e.heading,pitch:e.pitch,roll:e.roll},duration:1}}flyToCameraView(e){const{position:t,orientation:i,duration:s}=e,o=new this.cesium.Cartesian3(t.x,t.y,t.z),r=new this.cesium.HeadingPitchRoll(i.heading,i.pitch,i.roll);!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}getCurrentCameraPositionAndTarget(){const e=this.getCameraView();return{position:e.position,target:{heading:e.orientation.heading,pitch:e.orientation.pitch,roll:e.orientation.roll},duration:e.duration}}setCameraView(e){const t=e.target||e.orientation||{};this.flyToCameraView({position:{x:Number(e.position.x),y:Number(e.position.y),z:Number(e.position.z)},orientation:{heading:Number(t.heading||0),pitch:Number(t.pitch||0),roll:Number(t.roll||0)},duration:e.duration})}}function O0(n){const{container:e,appContext:t,methods:i,viewerOptions:s,options:o,callbacks:r}=n,l=new gi,a=window.Cesium;if(!a)throw new Error("Cesium is not loaded");e.id=`cesium-container-${Dg()}`;const c={animation:!1,timeline:!1,infoBox:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,navigationHelpButton:!1,geocoder:!1,baseLayerPicker:!1,selectionIndicator:!1,creditContainer:document.createElement("div"),contextOptions:{webgl:{alpha:!0}}},u=t?.config?.globalProperties?.$leitingBimOptions,h={...c,...u?.viewerOptions??{},...s??{}},f=new a.Viewer(e,h);f.camera.setView({destination:a.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:a.Math.toRadians(0),pitch:a.Math.toRadians(-90),roll:0}});let p=i;if(!p&&u&&(u.methods||(u.methods={}),p=u.methods),p){const A=new Yg({cesium:a,viewer:f,options:o,callbacks:r}),C=new ka({cesium:a,viewer:f}),m=new F0({cesium:a,viewer:f}),y=new Vg({cesium:a,viewer:f}),E=new R0({cesium:a,viewer:f});let I;const M=new tc({cesium:a,viewer:f});o&&(o.globe!==void 0&&m.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&m.setTerrainEnable(o.terrain),o.depthTest!==void 0&&m.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&m.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&m.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&m.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&m.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&m.setTime(o.time),o.brightness!==void 0&&m.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&m.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&m.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&m.setMouseHabit(o.mouseHabit)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),m.setCadMode("2d"),I=new lo({cesium:a,viewer:f})),C.events.on("tilesetLoaded",g=>{A.baseCompt.attachTileset(g,A.baseCompt.selectedColor),A.baseSection.attachTileset(g,g.leiting?.model?.modelId),p&&p.tilesLoad3dTiles&&p.tilesLoad3dTiles(g),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(g.leiting)}),C.events.on("loadingStatus",g=>{p&&p.onLoadingStatus&&p.onLoadingStatus(g)}),C.events.on("mountAll3Dtiles",({modelList:g,mapTileset:F})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(g),p?.mountAll3Dtiles&&p.mountAll3Dtiles(F)}),y.events.on("mountAllCad",g=>{o?.mountAllCad&&o.mountAllCad(g),p?.mountAllCad&&p.mountAllCad(g)}),A.baseCompt.loadNodeDetailsForModel=g=>C.loadNodeDetailsForModel(g),A.baseCompt.selectionChange(g=>{g.length!==0&&(o?.selectionChange&&o.selectionChange(g),p?.selectionChange&&p.selectionChange(g))}),p.onSearchComponent=g=>{o?.searchComponent&&o.searchComponent(g),p?.searchComponent&&p.searchComponent(g)};const k=p.saveRegion;p.saveRegion=g=>{o?.saveRegion&&o.saveRegion(g),k&&k!==o?.saveRegion&&k(g)};const S=p.saveCadCalibration;p.saveCadCalibration=g=>{o?.saveCadCalibration&&o.saveCadCalibration(g),S&&S!==o?.saveCadCalibration&&S(g)};const x=p.saveCadRegion;p.saveCadRegion=g=>{o?.saveCadRegion&&o.saveCadRegion(g),x&&x!==o?.saveCadRegion&&x(g)},p.getCesium=()=>a,p.getViewer=()=>f,p.getAnnotationInstance=()=>I,p.getMeasureInstance=()=>M,p.flyTo=g=>{E.setCameraView(g)},p.addPoint=(g,F,D=0)=>{f.entities.add({position:a.Cartesian3.fromDegrees(g,F,D),point:{pixelSize:10,color:a.Color.RED}})},p.enableTestLabel=()=>A.enableTestLabel(),p.setBackgroundColor=g=>m.setBackgroundColor(g),p.enableCesiumFXAA=g=>A.enableCesiumFXAA(g),p.setSceneOptions=g=>A.setSceneOptions(g),p.getCameraInfo=()=>E.getCameraView(),p.flyToCameraView=g=>E.flyToCameraView(g),p.getCurrentCameraPositionAndTarget=()=>E.getCurrentCameraPositionAndTarget(),p.setCameraView=g=>E.setCameraView(g),p.getImageBase64=()=>{const g=f.scene.canvas;return f.render(),g.toDataURL("image/png")},p.getSnapDomSImageBase64=(g,F)=>A.getSnapDomSImageBase64(g,F),p.addModels=g=>C.addModels(g),p.add3DtilesModel=g=>C.addModels(g),p.addOSGB=g=>C.addOSGB(g),p.updateOSGBMatrix=g=>C.updateOSGBMatrix(g),p.showModels=g=>C.showModels(g),p.showTileset=g=>C.showModels(g),p.deleteModels=g=>C.deleteModels(g),p.deleteAllModelList=()=>{C.deleteAllModels(),l.emit("deleteAllModels")},p.deleteAllModels=()=>{C.deleteAllModels(),l.emit("deleteAllModels")},p.flyToTileset=g=>C.flyToTileset(g),p.flyToByModelId=g=>C.flyToTileset(g),p.updateModelEffect=g=>A.updateModelEffect(g),p.getMapTileset=()=>C.getMapTileset(),p.getBIMmodelId=()=>C.getBIMmodelId(),p.getModelList=()=>C.getModelList(),p.loadTreeForModel=g=>C.loadTreeForModel(g),p.loadNodeDetailsForModel=g=>C.loadNodeDetailsForModel(g),p.setMapTileset=g=>C.setMapTileset(g),p.setBIMmodelId=g=>C.setBIMmodelId(g),p.setModelList=g=>C.setModelList(g),p.setSelectColorUserModelCpt=(g,F={})=>A.baseCompt.setSelectColorUserModelCpt(g,F),A.baseCompt.setLoadNodeDetailsCallback(g=>C.loadNodeDetailsForModel(g)),p.setAllSelectColorUserModelCpt=g=>A.baseCompt.setAllSelectColorUserModelCpt(g),p.setSelectColorUserModelCptByClear=()=>A.baseCompt.clearAllHaveSelected(),p.clearSelectColorUserModelCpt=()=>A.baseCompt.clearAllHaveSelected(),p.setSelecteds=(g,F)=>A.baseCompt.setSelectColorUserModelCpt(g,F??{rank:0}),p.setSelectedColor=(g,F,D,P)=>A.baseCompt.setSelectedColorRgba(g,F,D,P),p.clearAllHaveSelected=()=>A.baseCompt.clearAllHaveSelected(),p.getSelected=g=>A.baseCompt.getSelected(g),p.selectionChange=g=>{A.baseCompt.selectionChange(g)},p.flyToObjects=g=>A.baseCompt.flyToObjects(g),p.setAllConstructionProgressTracking=g=>A.baseCompt.setAllConstructionProgressTracking(g),p.enableAllConstructionProgressTracking=()=>A.baseCompt.enableConstructionProgressTracking(),p.disableConstructionProgressTracking=()=>A.baseCompt.disableConstructionProgressTracking(),p.disableAllConstructionProgressTracking=()=>A.baseCompt.disableConstructionProgressTracking(),p.freshConstructionProgressTracking=()=>A.baseCompt.freshConstructionProgressTracking(),p.reStartAnimation=()=>A.baseCompt.reStartAnimation(),p.resumeFlyTo=()=>A.baseCompt.resumeFlyTo(),p.pauseFlyTo=()=>A.baseCompt.pauseFlyTo(),p.pauseAnimation=()=>A.baseCompt.pauseFlyTo(),p.resumeAnimation=()=>A.baseCompt.resumeFlyTo(),p.setElementsListVisible=g=>A.baseCompt.setComponentVisibility(g),p.setAllElementsVisible=g=>A.baseCompt.setAllComponentsVisibility(g),p.getElementsVisible=g=>A.baseCompt.getComponentsByVisibility(g),p.setComponentVisibility=g=>A.baseCompt.setComponentVisibility(g),p.setAllComponentsVisibility=g=>A.baseCompt.setAllComponentsVisibility(g),p.getComponentsByVisibility=g=>A.baseCompt.getComponentsByVisibility(g),p.openSection=(g,F)=>A.baseSection.open(g,F),p.closeSection=g=>A.baseSection.close(g),p.updateSectionRange=g=>A.baseSection.updateRange(g),p.getSectionRange=()=>A.baseSection.getRange(),p.fitToModels=()=>A.baseSection.fitToModels(),p.setSectionBoxVisibility=g=>A.baseSection.setBoxVisibility(g),p.openPlayer=()=>{A.baseCompt.disableSelection(),A.basePlayer.openPlayer()},p.closePlayer=()=>{A.basePlayer.closePlayer(),A.baseCompt.enableSelection()},p.setPersonPosition=g=>A.basePlayer.setPersonPosition(g),p.setPlayerSpeed=g=>A.basePlayer.setSpeed({speed:g}),p.setPlayerParams=g=>A.basePlayer.setParams(g),p.setPlayerMoveState=(g,F)=>A.basePlayer.setMoveState(g,F),p.bindPlayerUiKeys=g=>A.basePlayer.bindUiKeys(g),p.setGlobeEnvironmentVisible=g=>m.setGlobeEnvironmentVisible(g),p.setGlobeColor=g=>m.setGlobeColor(g),p.setCadMode=g=>m.setCadMode(g),p.setTerrainEnable=g=>m.setTerrainEnable(g),p.setDepthTestEnable=g=>m.setDepthTestEnable(g),p.changeBaseMap=(g,F)=>m.changeBaseMap(g,F),p.searchLocation=(g,F)=>m.searchLocation(g,F),p.setShadowsEnable=g=>m.setShadowsEnable(g),p.setShadowDarkness=g=>{m.setShadowDarkness?m.setShadowDarkness(g):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},p.setTime=g=>m.setTime(g),p.setModelBrightness=g=>m.setModelBrightness(g),p.setModelColorAdjustment=g=>m.setModelColorAdjustment(g),p.setEnvironmentMapEnable=g=>m.setEnvironmentMapEnable(g),p.setAmbientOcclusion=g=>m.setAmbientOcclusion(g),p.setCollisionDetection=g=>m.setCollisionDetection(g),p.setMouseHabit=g=>m.setMouseHabit(g),p.is2dMode=()=>m.is2d,p.setSceneMode=g=>{const F=g?"2d":"3d";m.setCadMode(F),g&&!I&&(I=new lo({cesium:a,viewer:f})),l.emit("setMode",F)},p.setGisOptions=g=>{g.globe!==void 0&&m.setGlobeEnvironmentVisible(g.globe),g.elevation!==void 0&&m.setTerrainEnable(g.elevation),g.depthTestAgainstTerrain!==void 0&&m.setDepthTestEnable(g.depthTestAgainstTerrain),g.rendering!==void 0&&m.setAmbientOcclusion(g.rendering)},p.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),p.setConfigure=g=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",g)},p.addDxfModel=g=>{const F={...g};return F.files&&!F.fileNames&&(F.fileNames=F.files),F.fileNames||(F.fileNames=[]),y.addDxfModel(F)},p.deleteCad=g=>y.deleteCad(g),p.deleteAllCad=()=>y.deleteAllCad(),p.showDxfModel=g=>y.showJson(g),p.showDxfLayer=g=>y.showJsonByLayer(g),p.flyToCadModel=(g={})=>y.flyToCadModel(g),p.getDxfModels=g=>y.getDxfModels(g),p.getDxfLayers=g=>y.getMapLayers(g),p.getCadModelId=()=>y.getModelId(),p.setDxfOpen=g=>y.setDxfOpen(g),p.getDxfOpen=()=>y.getDxfOpen(),p.adjustingModelByCad=g=>y.adjustingModelByCad(g),p.saveAnnotations=()=>{let g=null;return I&&(g=I.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(g),g},p.loadAnnotations=g=>I?I.loadAnnotations(g):!1,p.set2d=g=>{const F=g?"2d":"3d";m.setCadMode(F),g&&!I&&(I=new lo({cesium:a,viewer:f})),l.emit("setMode",F)},p.flyToTopView=()=>{y.flyToCadModel()},p.menuEvents=l,p.insertMenu=g=>{l.emit("insertMenu",g)},p.setMenuListFilter=g=>{l.emit("setMenuListFilter",g)},p.showMenu=g=>{l.emit("showMenu",g)},p.setMenuActive=(g,F)=>{l.emit("setMenuActive",g,F)},p.insertContextMenu=g=>{console.warn("insertContextMenu is not initialized yet. Please wait for LeitingBIM component to mount.",g)},p.deleteContextMenu=g=>{console.warn("deleteContextMenu is not initialized yet.",g)},p.hideContextMenu=()=>{console.warn("hideContextMenu is not initialized yet.")},p.baseCompt=A.baseCompt,p.getTree=()=>{const g=[],F=C.getMapTileset();return Object.keys(F).forEach(D=>{const P=F[D];if(P&&P.leiting&&P.leiting.tree){const L=P.leiting.tree;Array.isArray(L)?g.push(...L):g.push(L)}}),g},p.getAllComponents=()=>{const g=C.getMapTileset(),F={},D=[];try{Object.keys(g).forEach(P=>{const L=g[P];if(!L||!L.leiting)return;const G=L.leiting,N=G.node,b=G.model.formData,w=G.box;if(!N||!N.nodeExtras)return;const v=G.model.modelId;F[v]=N.nodeExtras;const B=N.nodeExtras.element;if(!B)return;const R=w?w.center:{x:0,y:0,z:0};Object.values(B).forEach(U=>{if(U.box3)try{const O=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(b.totalRotation||0)),T=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(O),new a.Cartesian3(0,0,0)),Q=a.Cartesian3.fromDegrees(b.longitude,b.latitude,b.height),V=a.Transforms.eastNorthUpToFixedFrame(Q);a.Matrix4.multiply(V,T,V);const $=new a.Cartesian3(R.x,R.y,0),J=new a.Cartesian3;a.Matrix4.multiplyByPoint(V,$,J);const ne=a.Cartographic.fromCartesian(J),re=U.box3?.Center?.x||0,Y=U.box3?.Center?.y||0,j=U.box3?.Center?.z||0,X=new a.Cartesian3(-R.x+re,-R.y+Y,0+j),se=a.Matrix4.fromTranslation(X),oe=a.Matrix4.clone(se);a.Matrix4.multiply(T,oe,oe);const ae=a.Cartesian3.fromDegrees(ne.longitude/Math.PI*180,ne.latitude/Math.PI*180,b.height),Ce=a.Transforms.eastNorthUpToFixedFrame(ae);a.Matrix4.multiply(Ce,oe,Ce);const le=a.Cartographic.fromCartesian(new a.Cartesian3(Ce[12],Ce[13],Ce[14]));U.box3.cartographic={longitude:le.longitude/Math.PI*180,latitude:le.latitude/Math.PI*180,height:le.height};const Pe={id:U.uniqueId,billboard:[{theme:"Tag9999",position:[U.box3.cartographic.longitude,U.box3.cartographic.latitude,U.box3.cartographic.height],options:{text:U.name}}]};D.push(Pe)}catch(O){console.warn("Error calculating component position:",O)}})})}catch(P){console.error("getAllComponents error:",P)}return F},p.getCptInfos=g=>{if(!Array.isArray(g))return[];const F=C.getMapTileset(),D=[],P={};g.forEach(L=>{!L.modelId||!L.elementId||(P[L.modelId]||(P[L.modelId]=[]),P[L.modelId]?.push(L.elementId))});try{Object.keys(P).forEach(L=>{const G=F[L];if(!G||!G.leiting)return;const N=G.leiting,b=N.node,w=N.model.formData,v=N.box;if(!b||!b.nodeExtras)return;const B=b.nodeExtras.element;if(!B)return;const R=v?v.center:{x:0,y:0,z:0};P[L]?.forEach(U=>{const O=B[U];if(O&&O.box3)try{const T=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(w.totalRotation||0)),Q=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(T),new a.Cartesian3(0,0,0)),V=a.Cartesian3.fromDegrees(w.longitude,w.latitude,w.height),$=a.Transforms.eastNorthUpToFixedFrame(V);a.Matrix4.multiply($,Q,$);const J=new a.Cartesian3(R.x,R.y,0),ne=new a.Cartesian3;a.Matrix4.multiplyByPoint($,J,ne);const re=a.Cartographic.fromCartesian(ne),Y=O.box3?.Center?.x||0,j=O.box3?.Center?.y||0,X=O.box3?.Center?.z||0,se=new a.Cartesian3(-R.x+Y,-R.y+j,0+X),oe=a.Matrix4.fromTranslation(se),ae=a.Matrix4.clone(oe);a.Matrix4.multiply(Q,ae,ae);const Ce=a.Cartesian3.fromDegrees(re.longitude/Math.PI*180,re.latitude/Math.PI*180,w.height),le=a.Transforms.eastNorthUpToFixedFrame(Ce);a.Matrix4.multiply(le,ae,le);const Pe=a.Cartographic.fromCartesian(new a.Cartesian3(le[12],le[13],le[14]));O.box3.cartographic={longitude:Pe.longitude/Math.PI*180,latitude:Pe.latitude/Math.PI*180,height:Pe.height},D.push(O)}catch(T){console.warn("Error calculating component position:",T)}})})}catch(L){console.error("getCptInfos error:",L)}return D},window.Methods=p}return console.log("methods",p),{Cesium:a,viewer:f,methods:p,menuEvents:l}}function co(n){return d.getCurrentScope()?(d.onScopeDispose(n),!0):!1}function uo(n){return typeof n=="function"?n():d.unref(n)}const L0=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const N0=Object.prototype.toString,U0=n=>N0.call(n)==="[object Object]",_0=()=>{};function Q0(n){return d.getCurrentInstance()}function nc(n,e=!0,t){Q0()?d.onMounted(n,t):e?n():d.nextTick(n)}function Nt(n){var e;const t=uo(n);return(e=t?.$el)!=null?e:t}const Ln=L0?window:void 0;function H0(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=Ln):[e,t,i,s]=n,!e)return _0;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const o=[],r=()=>{o.forEach(u=>u()),o.length=0},l=(u,h,f,p)=>(u.addEventListener(h,f,p),()=>u.removeEventListener(h,f,p)),a=d.watch(()=>[Nt(e),uo(s)],([u,h])=>{if(r(),!u)return;const f=U0(h)?{...h}:h;o.push(...t.flatMap(p=>i.map(A=>l(u,p,A,f))))},{immediate:!0,flush:"post"}),c=()=>{a(),r()};return co(c),c}function G0(){const n=d.ref(!1),e=d.getCurrentInstance();return e&&d.onMounted(()=>{n.value=!0},e),n}function ic(n){const e=G0();return d.computed(()=>(e.value,!!n()))}function Y0(n,e={}){const{window:t=Ln}=e,i=ic(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=d.ref(!1),r=c=>{o.value=c.matches},l=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},a=d.watchEffect(()=>{i.value&&(l(),s=t.matchMedia(uo(n)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return co(()=>{a(),l(),s=void 0}),o}function V0(n,e,t={}){const{window:i=Ln,...s}=t;let o;const r=ic(()=>i&&"ResizeObserver"in i),l=()=>{o&&(o.disconnect(),o=void 0)},a=d.computed(()=>Array.isArray(n)?n.map(h=>Nt(h)):[Nt(n)]),c=d.watch(a,h=>{if(l(),r.value&&i){o=new ResizeObserver(e);for(const f of h)f&&o.observe(f,s)}},{immediate:!0,flush:"post"}),u=()=>{l(),c()};return co(u),{isSupported:r,stop:u}}function W0(n,e={width:0,height:0},t={}){const{window:i=Ln,box:s="content-box"}=t,o=d.computed(()=>{var h,f;return(f=(h=Nt(n))==null?void 0:h.namespaceURI)==null?void 0:f.includes("svg")}),r=d.ref(e.width),l=d.ref(e.height),{stop:a}=V0(n,([h])=>{const f=s==="border-box"?h.borderBoxSize:s==="content-box"?h.contentBoxSize:h.devicePixelContentBoxSize;if(i&&o.value){const p=Nt(n);if(p){const A=p.getBoundingClientRect();r.value=A.width,l.value=A.height}}else if(f){const p=Array.isArray(f)?f:[f];r.value=p.reduce((A,{inlineSize:C})=>A+C,0),l.value=p.reduce((A,{blockSize:C})=>A+C,0)}else r.value=h.contentRect.width,l.value=h.contentRect.height},t);nc(()=>{const h=Nt(n);h&&(r.value="offsetWidth"in h?h.offsetWidth:e.width,l.value="offsetHeight"in h?h.offsetHeight:e.height)});const c=d.watch(()=>Nt(n),h=>{r.value=h?e.width:0,l.value=h?e.height:0});function u(){a(),c()}return{width:r,height:l,stop:u}}function z0(n={}){const{window:e=Ln,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=n,r=d.ref(t),l=d.ref(i),a=()=>{e&&(o?(r.value=e.innerWidth,l.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight))};if(a(),nc(a),H0("resize",a,{passive:!0}),s){const c=Y0("(orientation: portrait)");d.watch(c,()=>a())}return{width:r,height:l}}const j0={class:"title"},$0={class:"actions"},K0={class:"card-body"},X0=d.defineComponent({__name:"LeitingDraggableCard",props:{visible:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},title:{type:String,default:"Title"},initialPosition:{type:Object,default:()=>({x:0,y:0})},width:{type:[Number,String],default:300},minWidth:{type:Number,default:200},fullHeight:{type:Boolean,default:!1},align:{type:String,default:""}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=d.inject("leiting-theme",d.ref("dark")),s=e,o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:M=>{s("update:visible",M),s("update:open",M)}}),r=d.ref(null),l=d.ref(t.initialPosition?.x||0),a=d.ref(t.initialPosition?.y||0),c=d.ref(t.width),u=d.ref(t.fullHeight?"100%":"600px");d.watch(()=>t.fullHeight,M=>{M?u.value="100%":u.value==="100%"&&(u.value="600px")});const{height:h}=z0();d.watch(h,()=>{t.fullHeight&&(u.value="100%")});const f=d.ref(!1),p=M=>{f.value=!0,M.preventDefault(),M.stopPropagation();const k=M.clientX,S=M.clientY,x=typeof c.value=="number"?c.value:r.value?.offsetWidth||0,g=typeof u.value=="number"?u.value:r.value?.offsetHeight||0,F=P=>{if(!f.value)return;P.preventDefault();const L=P.clientX-k,G=P.clientY-S,N=x+L,b=g+G;N>100&&(c.value=N),b>100&&(u.value=b)},D=()=>{f.value=!1,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",D)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",D)},A=d.computed(()=>({left:`${l.value}px`,top:`${a.value}px`,width:typeof c.value=="number"?`${c.value}px`:c.value,height:typeof u.value=="number"?`${u.value}px`:u.value,position:"absolute",zIndex:2e3})),C=()=>{d.nextTick(()=>{if(r.value){const M=r.value.offsetParent||document.body,k=M.clientWidth,S=M.clientHeight,x=typeof c.value=="number"?c.value:r.value.offsetWidth||350,g=typeof u.value=="number"?u.value:r.value.offsetHeight||600;l.value+x>k&&(l.value=Math.max(0,k-x-20)),a.value+g>S&&(a.value=Math.max(0,S-g-20)),l.value<0&&(l.value=0),a.value<0&&(a.value=0)}})},m=d.ref(!1),y=M=>{if(M.target.closest(".close-btn")||M.target.closest(".actions"))return;m.value=!0,M.preventDefault(),M.stopPropagation();const k=M.clientX,S=M.clientY,x=l.value,g=a.value,F=P=>{if(!m.value)return;P.preventDefault();const L=P.clientX-k,G=P.clientY-S;l.value=x+L,a.value=g+G},D=()=>{m.value=!1,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",D),C()};document.addEventListener("mousemove",F),document.addEventListener("mouseup",D)},E=()=>{d.nextTick(()=>{if(t.align&&r.value){const M=r.value.offsetParent||document.body,k=typeof c.value=="number"?c.value:r.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,M.clientWidth-k-20):t.align==="center"&&(l.value=Math.max(0,(M.clientWidth-k)/2))}C()})};d.onMounted(()=>{t.align?E():C()}),d.watch(o,M=>{M&&(t.align?E():C())});const I=()=>{o.value=!1,s("close")};return(M,k)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{ref_key:"cardRef",ref:r,class:d.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+d.unref(i)]]),style:d.normalizeStyle(A.value)},[d.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:y},[d.createElementVNode("span",j0,d.toDisplayString(n.title),1),d.createElementVNode("div",$0,[d.renderSlot(M.$slots,"header-extra",{},void 0,!0),d.createElementVNode("span",{class:"close-btn",onClick:I},"×")])],544),d.createElementVNode("div",K0,[d.renderSlot(M.$slots,"default",{},void 0,!0)]),d.createElementVNode("div",{class:"resize-handle",onMousedown:p},[...k[0]||(k[0]=[d.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[d.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32)],6)),[[d.vShow,o.value]])}}),Ue=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},Re=Ue(X0,[["__scopeId","data-v-50bf6126"]]);function q0(n){const e=d.ref([]),t=d.ref([]),i=d.ref([]),s=d.ref(""),o=d.ref(!0);d.watch(()=>d.unref(n),h=>{if(!h||h.length===0)return;const f=[],p=(m,y)=>{m.forEach(E=>{const I=E.id||E.key||E.$id,M=E.modelId||y;M&&(E.modelId=M),I&&f.push(I),E.children&&E.children.length>0&&p(E.children,M)})};p(h);const A=new Set(i.value);let C=!1;f.forEach(m=>{A.has(m)||(A.add(m),C=!0)}),C&&(i.value=Array.from(A))},{immediate:!0,deep:!0});const r=d.computed(()=>{const h=d.unref(n);if(!h)return[];const f=[],p=(A,C)=>{A.forEach(m=>{const y=m.id||m.key||m.$id,E=m.name||m.title;f.push({key:y,title:E,parentKey:C}),m.children&&m.children.length>0&&p(m.children,y)})};return p(h),f}),l=h=>{e.value=h,o.value=!1},a=h=>{i.value=h},c=h=>{t.value=h},u=h=>r.value.find(p=>p.key===h)?.parentKey;return d.watch(s,h=>{if(!h)return;const p=r.value.filter(C=>C.title&&C.title.toLowerCase().includes(h.toLowerCase())).map(C=>C.parentKey),A=new Set;p.forEach(C=>{let m=C;for(;m;)A.add(m),m=u(m)}),e.value=[...A],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:i,searchValue:s,autoExpandParent:o,onExpand:l,onCheck:a,onSelect:c}}const J0={class:"search-box"},Z0={key:0},eC={style:{color:"#f50"}},tC={key:1},nC={key:1,class:"empty-tip"},Pi=Ue(d.defineComponent({__name:"LeitingTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"构件树"},width:{type:[Number,String],default:320},treeData:{type:Array,default:()=>[]},initialPosition:{type:Object,default:()=>({x:0,y:0})},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close","select","check"],setup(n,{emit:e}){const t=me.Input.Search,i=me.Tree,s=n,o=e,r=d.inject("leiting-theme",d.ref("dark")),l=d.inject("leitingMethods"),a=g=>{l?.value?.onSearchComponent&&l.value.onSearchComponent(g)},c=d.computed({get:()=>s.open!==void 0?s.open:s.visible,set:g=>{o("update:visible",g),o("update:open",g)}}),u=d.ref(null),{height:h}=W0(u),f=d.computed(()=>h.value||300),p=d.ref({children:"children",title:"name",key:"id"}),{expandedKeys:A,selectedKeys:C,checkedKeys:m,searchValue:y,autoExpandParent:E}=q0(d.toRef(s,"treeData")),I=g=>{A.value=g,E.value=!1},M=g=>{const F=[],D=P=>{if(!P.children||P.children.length===0){const G=P.element_Id;P.modelId&&G&&F.push({modelId:P.modelId,elementId:G})}else P.children.forEach(D)};return D(g),F},k=(g,F)=>{m.value=g,o("check",g,F);const D=M(F.node).map(P=>({...P,show:F.checked}));l?.value?.setComponentVisibility&&l.value.setComponentVisibility(D),l?.value?.onTreeCheck&&l.value.onTreeCheck(g,F)},S=(g,F)=>{if(C.value=g,o("select",g,F),F.selected){const D=M(F.node);D.length>0&&l?.value?.flyToObjects&&l.value.flyToObjects({selectCpts:D})}l?.value?.onTreeSelect&&l.value.onTreeSelect(g,F)},x=()=>{o("update:visible",!1),o("close")};return(g,F)=>(d.openBlock(),d.createBlock(Re,{visible:c.value,"onUpdate:visible":F[1]||(F[1]=D=>c.value=D),title:n.title,"initial-position":n.initialPosition,"full-height":n.fullHeight,onClose:x},{default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["leiting-tree-container",[`theme-${d.unref(r)}`]])},[d.createElementVNode("div",J0,[d.createVNode(d.unref(t),{value:d.unref(y),"onUpdate:value":F[0]||(F[0]=D=>d.isRef(y)?y.value=D:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:a},null,8,["value"])]),d.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:u},[n.treeData&&n.treeData.length?(d.openBlock(),d.createBlock(d.unref(i),{key:0,"tree-data":n.treeData,"field-names":p.value,height:f.value,"expanded-keys":d.unref(A),"auto-expand-parent":d.unref(E),"selected-keys":d.unref(C),"checked-keys":d.unref(m),checkable:"","block-node":"",onExpand:I,onSelect:S,onCheck:k},{title:d.withCtx(({name:D,title:P})=>[(D||P)&&d.unref(y)&&(D||P).toLowerCase().indexOf(d.unref(y).toLowerCase())>-1?(d.openBlock(),d.createElementBlock("span",Z0,[d.createTextVNode(d.toDisplayString((D||P).substr(0,(D||P).toLowerCase().indexOf(d.unref(y).toLowerCase())))+" ",1),d.createElementVNode("span",eC,d.toDisplayString(d.unref(y)),1),d.createTextVNode(" "+d.toDisplayString((D||P).substr((D||P).toLowerCase().indexOf(d.unref(y).toLowerCase())+d.unref(y).length)),1)])):(d.openBlock(),d.createElementBlock("span",tC,d.toDisplayString(D||P),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(d.openBlock(),d.createElementBlock("div",nC,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-749af6eb"]]),iC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAERSURBVDhPvZTrEYIwEISTCrQD6EA7gA60AylBK1Aq0A7ECrQDoQPsADrACuLuTMJkIiHxjzezgyR7H3d5KJVSqRAigcaQUjYYX2JgZY/P/O4lEgYYFo7pgPcc2kSCBoIUzDeo0klPPEsNYlX7AKzA/M6ASrRzYoIGG5DAOCvzBvzMOxqQazSgLLI1QdAW5jWpUAPV0AVKIc7FRCuNy7RkWozJtj1BED7ANbpDXHhffFXUwUnZwRYp7qw7Rx8/lLkV9R4QD2w1A8pjW3sA4h5au+pXEBS76P8D6Ut9/nXXaiRQdnBXqBfEC+4GdzSxW5v6F7CTeHnbCVCBsWIE+RYVrdF4DSz6OwgiADDexbmT3X0A4fSDfDjUugcAAAAASUVORK5CYII=",sC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",oC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHDSURBVDhPlZOxL0NRFIe9ECubhehoIIjJ1HYwCkIiJpUQEkN1YZBobU0kFKNI3iTGYrDRv0BIhLXCYpCwiO35fs25zWva98JNvpz37j33d8+551yvLWIEQXDG0izMe55XjvJz816MUJG1LVuvYJcQrEb5xwkV2JSHGfAhgBJiu63E4oSUzpRtusa+wBooKkWnKOujQYh7SbCShQx0m9cpds4iOseOw7BFmUPwU341IQT2MaOQgi9QND+wiqNnBxT4X7SIbrAqhNI9wiUvJ+W8A99wDEWdwrw25iVkkenAEb5LkIQPuIMJWJGQoriFd+iBCkhc8zUhfJSm7mva5l3aadubDgtpMgGKpB/eoBfuQZFoPNhBj9gTaC3kKkEEGXPswF7Y5rLro1AW8UI6GmelmAzfkUWlNaWt6/iT0DOOA5bqoSuzHfIvofATqSJQb8KoiJbtPi6x2dA9FPjXE1F/uZKrv3IwCFcNqVmoPlal7QJ9q/wZCbk7Ioo9/tehE9q1r0nIxNQbG4YEXdkVjQ5J2OZXbB88gVrgQIJNj9aaT4LboPK7J6O0Ktb1KYtc/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",rC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",aC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",lC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1Ns+yrIe0EH7HPC8YnyGjAegkEB5cYyiwrdWXIEc1xnSREGcuiTQEWeg7gG4+CMcl9ALnLkvogwScv+wq6FMQJJCJDgBtBcSAI3QClwe2YZAHcY2Ho4kGAVLA6U5/CEvdp4KYhesFhBPpCZIAz6jStHhproJcHyAHbb5nF+6RZ8CsGslIQaHp/gSxRzlApU4GugPxNuDN/eNarAJxapUPgm8rQ9C1SAI9AOGiHhGApSdnRN8FshbEiLwiLI1rMUM6zSQ0tX9c2lp/Iw0iMIPU38iFIN1mTmOjKa98vyWB4QM5XQnvsbFsyAAAAABJRU5ErkJggg==",cC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",dC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",uC={class:"menu-container"},hC=["onClick","title"],fC={class:"menu-icon"},pC=["src","alt"],gC={key:3,style:{"font-size":"12px"}},mC={key:0,class:"sub-menu"},AC=["onClick"],Nn=d.defineComponent({__name:"LeitingMenu",props:{visible:{type:Boolean,default:!0},activeIds:{type:Array,default:()=>[]},is2d:{type:Boolean,default:!1},customItems:{type:Array,default:()=>[]}},emits:["action"],setup(n,{emit:e}){const t=n,i=d.inject("leiting-theme",d.ref("dark")),s=d.inject("leiting-menu-size",d.ref("medium")),o=d.inject("leitingMethods",d.ref({})),r=d.computed(()=>i.value||i),l=d.computed(()=>s.value||s),a=d.ref([{ID:"home",title:"主视角",src:iC,key:"homeView"},{ID:"tree",title:"目录树",src:sc,key:"componentTree"},{ID:"cadLayer",title:"图层",src:sc,key:"cadLayer"},{ID:"measure",title:"量算",src:sC,key:"measurement"},{ID:"section",title:"剖切",src:oC,key:"section"},{ID:"roam",title:"人物漫游",src:rC,key:"roam"},{ID:"info",title:"构件信息",src:aC,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:lC,key:"cadPosition"},{ID:"annotation",title:"标注",src:dC,key:"annotation"},{ID:"setting",title:"设置",src:cC,key:"setting"}]),c=d.ref([]),u=d.ref([...t.activeIds]);d.watch(()=>t.activeIds,k=>{u.value=[...k]},{deep:!0});const h=d.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",k=>{c.value=k}),o.value.menuEvents.on("setMenuActive",(k,S)=>{S?u.value.includes(k)||u.value.push(k):u.value=u.value.filter(x=>x!==k)}));const f=d.computed(()=>{let k=a.value;if(t.is2d){const S=["homeView","measurement","cadLayer","annotation"];k=k.filter(x=>x.key&&S.includes(x.key))}else{const S=["cadLayer","cadPosition","annotation"];k=k.filter(x=>!x.key||!S.includes(x.key))}if(c.value.length>0&&(k=k.filter(S=>!S.key||!c.value.includes(S.key))),t.customItems&&t.customItems.length>0){const S=t.customItems.map(x=>({...x,key:x.ID,src:x.src||x.icon}));return[...k,...S]}return k}),p=e,A=k=>{const S=["homeView"];if(k.key&&S.includes(k.key))u.value.includes(k.ID)||(u.value.push(k.ID),setTimeout(()=>{const g=u.value.indexOf(k.ID);g>-1&&u.value.splice(g,1)},1e3));else{const g=u.value.indexOf(k.ID);g>-1?u.value.splice(g,1):u.value.push(k.ID)}const x=u.value.includes(k.ID);k.func&&k.func(k),k.key&&p("action",k.key,x)},C=k=>{a.value=[...a.value,...k]},m=k=>{c.value=k},y=k=>{console.log("LeitingMenu received showMenu event:",k)},E=(k,S)=>{const x=a.value.find(g=>g.ID===k||g.key===k);if(x){const g=u.value.indexOf(x.ID);S&&g===-1?u.value.push(x.ID):!S&&g>-1&&u.value.splice(g,1)}};let I=null;const M=()=>{o.value?.menuEvents&&(I&&(I.off("insertMenu",C),I.off("setMenuListFilter",m),I.off("showMenu",y),I.off("setMenuActive",E)),I=o.value.menuEvents,I.on("insertMenu",C),I.on("setMenuListFilter",m),I.on("showMenu",y),I.on("setMenuActive",E))};return d.onMounted(()=>{M()}),d.onUnmounted(()=>{I&&(I.off("insertMenu",C),I.off("setMenuListFilter",m),I.off("showMenu",y),I.off("setMenuActive",E))}),d.watch(o,()=>{M()},{deep:!0}),(k,S)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+l.value]])},[d.createElementVNode("div",uC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.ID,class:d.normalizeClass(["menu-item",{active:u.value.includes(x.ID)}]),onClick:g=>A(x),title:x.title},[d.createElementVNode("div",fC,[x.src?(d.openBlock(),d.createElementBlock("img",{key:0,src:x.src,alt:x.title},null,8,pC)):typeof x.icon=="object"?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(x.icon),{key:1})):typeof x.icon=="string"?(d.openBlock(),d.createElementBlock("i",{key:2,class:d.normalizeClass(["iconfont",`icon-${x.icon}`])},null,2)):(d.openBlock(),d.createElementBlock("span",gC,d.toDisplayString(x.title.substring(0,2)),1))]),x.children&&x.children.length>0?(d.openBlock(),d.createElementBlock("div",mC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.children,g=>(d.openBlock(),d.createElementBlock("div",{key:g.ID,class:d.normalizeClass(["sub-menu-item",{active:u.value.includes(g.ID)}]),onClick:d.withModifiers(F=>A(g),["stop"])},d.toDisplayString(g.title),11,AC))),128))])):d.createCommentVNode("",!0)],10,hC))),128))])],2)),[[d.vShow,h.value]])}}),yC={class:"leiting-section-content"},CC={class:"section-form-item"},EC={class:"radio-group"},wC={class:"section-form-item"},bC={class:"switch-container"},vC={class:"switch"},IC={class:"status-text"},xC={class:"section-form-item slider-item"},BC={class:"slider-wrapper"},SC={class:"section-form-item slider-item"},MC={class:"slider-wrapper"},TC={class:"section-form-item slider-item"},DC={class:"slider-wrapper"},kC={class:"section-form-item table-item"},PC={class:"model-table-container"},FC={class:"model-table"},RC={width:"40"},OC=["checked"],LC=["onClick"],NC=["value"],UC={class:"model-name"},Un=Ue(d.defineComponent({__name:"LeitingSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"剖切控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:N=>{i("update:visible",N),i("update:open",N)}}),r=d.ref("Box"),l=d.ref(!1),a=d.ref([]),c=d.ref([]),u=d.computed(()=>c.value.length===0?!1:c.value.every(N=>a.value.includes(N.modelId))),h=N=>{N.target.checked?a.value=c.value.map(w=>w.modelId):a.value=[],F()},f=d.ref([-10,10]),p=d.ref([-10,10]),A=d.ref([-10,10]),C=d.ref([-100,100]),m=d.ref([-100,100]),y=d.ref([-100,100]);let E=!1;const I=N=>{E=!0;const{targetZPlus:b,targetZMinus:w,targetXPlus:v,targetXMinus:B,targetYPlus:R,targetYMinus:U}=N;A.value=[-w,b],f.value=[-B,v],p.value=[-U,R],setTimeout(()=>{E=!1},100)},M=()=>{E||a.value.length===0||!s?.value?.updateSectionRange||s.value.updateSectionRange({targetZPlus:A.value[1],targetZMinus:-A.value[0],targetXPlus:f.value[1],targetXMinus:-f.value[0],targetYPlus:p.value[1],targetYMinus:-p.value[0]})},k=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)},S=N=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const w=s.value.getMapTileset()[N];if(w&&w.leiting?.box){const{min:v,max:B}=w.leiting.box,R=(B.x-v.x)/2,U=(B.y-v.y)/2,O=(B.z-v.z)/2;a.value.length<=1&&(C.value=[-R*2,R*2],m.value=[-U*2,U*2],y.value=[-O*2,O*2],f.value=[-R,R],p.value=[-U,U],A.value=[-O,O],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:O,targetZMinus:O,targetXPlus:R,targetXMinus:R,targetYPlus:U,targetYMinus:U})),s.value.openSection(N,{moveCallBack:I}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)}},x=N=>{const b=a.value.indexOf(N);b>-1?a.value.splice(b,1):a.value.push(N),F()};let g=[];const F=()=>{const N=a.value.filter(w=>!g.includes(w)),b=g.filter(w=>!a.value.includes(w));N.forEach(w=>S(w)),b.forEach(w=>{s?.value?.closeSection&&s.value.closeSection(w)}),g=[...a.value]},D=()=>{},P=()=>{o.value=!1,i("close")},L=()=>{l.value=!1,a.value=[],g=[],f.value=[-10,10],p.value=[-10,10],A.value=[-10,10],C.value=[-100,100],m.value=[-100,100],y.value=[-100,100]};d.watch(()=>t.visible,N=>{N?G():(s?.value?.closeSection&&s.value.closeSection(),L())});const G=()=>{s?.value&&typeof s.value.getModelList=="function"&&(c.value=s.value.getModelList()||[],c.value.length>0&&a.value.length===0&&(a.value=[c.value[0].modelId],g=[...a.value]),t.visible&&a.value.length>0&&(l.value=!0,a.value.forEach(N=>S(N))))};return d.watch(()=>s?.value,()=>{G()},{immediate:!0,deep:!0}),d.onMounted(()=>{G()}),(N,b)=>(d.openBlock(),d.createBlock(Re,{visible:o.value,title:"剖切分析","full-height":n.fullHeight,"onUpdate:visible":P},{default:d.withCtx(()=>[d.createElementVNode("div",yC,[d.createElementVNode("div",CC,[b[8]||(b[8]=d.createElementVNode("span",{class:"label"},"模式",-1)),d.createElementVNode("div",EC,[d.createElementVNode("label",{class:d.normalizeClass(["radio-item",{active:r.value==="Box"}])},[d.withDirectives(d.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":b[0]||(b[0]=w=>r.value=w),onChange:D},null,544),[[d.vModelRadio,r.value]]),b[7]||(b[7]=d.createTextVNode(" 剖切盒 ",-1))],2)])]),d.createElementVNode("div",wC,[b[10]||(b[10]=d.createElementVNode("span",{class:"label"},"显示",-1)),d.createElementVNode("div",bC,[d.createElementVNode("label",vC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":b[1]||(b[1]=w=>l.value=w),onChange:k},null,544),[[d.vModelCheckbox,l.value]]),b[9]||(b[9]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",IC,d.toDisplayString(l.value?"显示":"隐藏"),1)])]),d.createElementVNode("div",xC,[b[11]||(b[11]=d.createElementVNode("span",{class:"label"},"X 轴",-1)),d.createElementVNode("div",BC,[d.createVNode(d.unref(me.Slider),{value:f.value,"onUpdate:value":b[2]||(b[2]=w=>f.value=w),range:"",min:C.value[0],max:C.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",SC,[b[12]||(b[12]=d.createElementVNode("span",{class:"label"},"Y 轴",-1)),d.createElementVNode("div",MC,[d.createVNode(d.unref(me.Slider),{value:p.value,"onUpdate:value":b[3]||(b[3]=w=>p.value=w),range:"",min:m.value[0],max:m.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",TC,[b[13]||(b[13]=d.createElementVNode("span",{class:"label"},"Z 轴",-1)),d.createElementVNode("div",DC,[d.createVNode(d.unref(me.Slider),{value:A.value,"onUpdate:value":b[4]||(b[4]=w=>A.value=w),range:"",min:y.value[0],max:y.value[1],step:.1,onChange:M},null,8,["value","min","max"])])]),d.createElementVNode("div",kC,[b[15]||(b[15]=d.createElementVNode("span",{class:"label"},"模型",-1)),d.createElementVNode("div",PC,[d.createElementVNode("table",FC,[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[d.createElementVNode("th",RC,[d.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:h},null,40,OC)]),b[14]||(b[14]=d.createElementVNode("th",null,"名称",-1))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,w=>(d.openBlock(),d.createElementBlock("tr",{key:w.modelId,class:d.normalizeClass({selected:a.value.includes(w.modelId)}),onClick:v=>x(w.modelId)},[d.createElementVNode("td",null,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:w.modelId,"onUpdate:modelValue":b[5]||(b[5]=v=>a.value=v),onClick:b[6]||(b[6]=d.withModifiers(()=>{},["stop"])),onChange:F},null,40,NC),[[d.vModelCheckbox,a.value]])]),d.createElementVNode("td",UC,d.toDisplayString(w.modelName),1)],10,LC))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),_C={class:"leiting-player-content"},QC={class:"player-form-item"},HC={class:"switch-container"},GC={class:"switch"},YC={class:"status-text"},VC={class:"player-form-item"},WC={class:"switch-container"},zC={class:"switch"},jC={class:"status-text"},$C={class:"player-form-item"},KC={class:"switch-container"},XC={class:"switch"},qC={class:"status-text"},JC={class:"player-form-item slider-item"},ZC={class:"slider-wrapper"},eE={class:"value-text"},tE={class:"instructions"},nE={class:"key-map"},iE={class:"key-row"},sE={class:"key-row"},oE={class:"key-row"},rE={class:"key-row"},aE={class:"key-row"},lE={class:"key-row"},_n=Ue(d.defineComponent({__name:"LeitingPlayer",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"漫游控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref(!1),r=d.ref(!1),l=d.ref(!0),a=d.ref(5),c=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:S=>{i("update:visible",S),i("update:open",S)}}),u=d.ref(null),h=d.ref(null),f=d.ref(null),p=d.ref(null),A=d.ref(null),C=d.ref(null),m=()=>{o.value?E():I()},y=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:l.value})},E=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(a.value),y(),s.value.bindPlayerUiKeys&&(await d.nextTick(),s.value.bindPlayerUiKeys({moveFront:u.value,moveBack:h.value,moveLeft:f.value,moveRight:p.value,moveUp:A.value,moveDown:C.value})))},I=()=>{s?.value?.closePlayer&&s.value.closePlayer()},M=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(a.value)},k=()=>{c.value=!1,i("close")};return d.watch(()=>t.visible,S=>{S?(o.value=!0,s?.value?E():setTimeout(()=>{s?.value&&E()},100)):o.value&&(o.value=!1,I())},{immediate:!0}),(S,x)=>(d.openBlock(),d.createBlock(Re,{title:n.title,visible:c.value,"full-height":n.fullHeight,"onUpdate:visible":k},{default:d.withCtx(()=>[d.createElementVNode("div",_C,[d.createElementVNode("div",QC,[x[5]||(x[5]=d.createElementVNode("span",{class:"label"},"启用",-1)),d.createElementVNode("div",HC,[d.createElementVNode("label",GC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":x[0]||(x[0]=g=>o.value=g),onChange:m},null,544),[[d.vModelCheckbox,o.value]]),x[4]||(x[4]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",YC,d.toDisplayString(o.value?"开启":"关闭"),1)])]),d.createElementVNode("div",VC,[x[7]||(x[7]=d.createElementVNode("span",{class:"label"},"重力",-1)),d.createElementVNode("div",WC,[d.createElementVNode("label",zC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":x[1]||(x[1]=g=>r.value=g),onChange:y},null,544),[[d.vModelCheckbox,r.value]]),x[6]||(x[6]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",jC,d.toDisplayString(r.value?"开启":"关闭"),1)])]),d.createElementVNode("div",$C,[x[9]||(x[9]=d.createElementVNode("span",{class:"label"},"碰撞",-1)),d.createElementVNode("div",KC,[d.createElementVNode("label",XC,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":x[2]||(x[2]=g=>l.value=g),onChange:y},null,544),[[d.vModelCheckbox,l.value]]),x[8]||(x[8]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",qC,d.toDisplayString(l.value?"开启":"关闭"),1)])]),d.createElementVNode("div",JC,[x[10]||(x[10]=d.createElementVNode("span",{class:"label"},"速度",-1)),d.createElementVNode("div",ZC,[d.createVNode(d.unref(me.Slider),{value:a.value,"onUpdate:value":x[3]||(x[3]=g=>a.value=g),min:1,max:10,step:1,onChange:M},null,8,["value"])]),d.createElementVNode("span",eE,d.toDisplayString(a.value),1)]),x[19]||(x[19]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",tE,[x[18]||(x[18]=d.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),d.createElementVNode("div",nE,[d.createElementVNode("div",iE,[d.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:u},"W",512),x[11]||(x[11]=d.createTextVNode(" 前进 ",-1))]),d.createElementVNode("div",sE,[d.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:h},"S",512),x[12]||(x[12]=d.createTextVNode(" 后退 ",-1))]),d.createElementVNode("div",oE,[d.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:f},"A",512),x[13]||(x[13]=d.createTextVNode(" 左移 ",-1))]),d.createElementVNode("div",rE,[d.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:p},"D",512),x[14]||(x[14]=d.createTextVNode(" 右移 ",-1))]),d.createElementVNode("div",aE,[d.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:A},"Q",512),x[15]||(x[15]=d.createTextVNode(" 上升 ",-1))]),d.createElementVNode("div",lE,[d.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:C},"E",512),x[16]||(x[16]=d.createTextVNode(" 下降 ",-1))]),x[17]||(x[17]=d.createElementVNode("div",{class:"key-row"},[d.createElementVNode("span",{class:"mouse-icon"},"🖱️"),d.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),cE={class:"info-content"},dE={key:0,class:"component-title"},Qn=Ue(d.defineComponent({__name:"LeitingInfo",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),l=d.ref([]),a=d.ref([]),c=d.ref(0),u=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:y=>{i("update:visible",y),i("update:open",y)}}),h=()=>{u.value=!1},f=y=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[y]||y,p=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],A=async y=>{const E=++c.value;if(a.value=y,!y||y.length===0){o.value=[];return}if(!u.value)return;let I=y;y.length>10&&(ge.warning(`选中构件数量过多(${y.length}个),仅显示前10个`),I=y.slice(0,10));const M=s?.value;let k=M?.getMapTileset?M.getMapTileset():{};r.value=!0;const S=[],x={};if(I.forEach(D=>{const L=k[D.modelId]?.leiting?.model?.dbName;L&&D.elementId&&S.push({dbName:L,elementId:D.elementId,modelId:D.modelId})}),S.length>0)try{const D=S.map(L=>({dbName:L.dbName,elementId:L.elementId})),P=await Tg(D);P&&Array.isArray(P)&&P.forEach(L=>{const G=S.find(N=>N.dbName===L.dbName&&N.elementId===L.elementId);if(G){const N=`${G.modelId}_${L.elementId}`;x[N]=L}})}catch(D){console.warn("API fetch component details failed, falling back to local data",D)}const g=new Set;if(I.forEach(D=>{const P=k[D.modelId],L=`${D.modelId}_${D.elementId}`;x[L]||P&&P.leiting&&!P.leiting?.node?.nodeExtras&&P.leiting.model?.nodeUrl&&g.add(D.modelId)}),g.size>0&&M?.loadNodeDetailsForModel)try{const D=Array.from(g).map(P=>M.loadNodeDetailsForModel(P));await Promise.all(D)}catch(D){console.error("Failed to load node details",D)}if(E!==c.value)return;k=M?.getMapTileset?M.getMapTileset():{};const F=[];I.forEach((D,P)=>{const G=k[D.modelId]?.leiting||{},N=x[`${D.modelId}_${D.elementId}`];let b={modelName:G.model?.modelId||D.modelId};b.elementID||(b.elementID=D.elementId);let w=null;if(N)w=N;else{const R=G.node?.nodeExtras?.element||G.node?.nodeExtras;if(R){const U=b.elementID;R[U]&&(w=R[U])}}w&&w.box3&&(b.length=`${w.box3.length?.toFixed(2)||0}米`,b.width=`${w.box3.width?.toFixed(2)||0}米`,b.height=`${w.box3.height?.toFixed(2)||0}米`);const v=[];w&&(w.name&&(b.elementName=w.name),w.categoryName&&(b.categoryName=w.categoryName),w.familySymbolName&&(b.familySymbolName=w.familySymbolName),w.levelName&&(b.levelName=w.levelName));const B={};if(p.forEach(R=>{b[R]!==void 0&&(B[R]=b[R])}),v.push({name:"基础信息",params:B}),w){const R=Array.isArray(w)?w:Array.isArray(w?.parameters)?w.parameters:null;if(R){if(R.flat().forEach(O=>{if(O&&O.GroupName&&Array.isArray(O.Parameters)){const T={};O.Parameters.forEach(Q=>{Q.name&&(T[Q.name]=Q.value??"")}),Object.keys(T).length>0&&v.push({name:O.GroupName,params:T})}}),!Array.isArray(w)){const{parameters:O,...T}=w,Q={};Object.keys(T).forEach(V=>{!p.includes(V)&&V!=="uniqueId"&&typeof T[V]!="object"&&(Q[V]=T[V])}),Object.keys(Q).length>0&&v.push({name:"其他属性",params:Q})}}else{let U=!1;if(Object.keys(w).forEach(O=>{w[O]&&typeof w[O]=="object"&&!Array.isArray(w[O])&&(U=!0,v.push({name:O,params:w[O]}))}),!U){const O={};Object.keys(w).forEach(T=>{if(!p.includes(T)&&T!=="batchId"){const Q=w[T];typeof Q=="string"&&Q.length>500?O[T]=Q.substring(0,500)+"...":O[T]=Q}}),Object.keys(O).length>0&&v.push({name:"属性",params:O})}}}F.push({id:P,title:`${b.modelName}${b.elementName?` - ${b.elementName}`:""}`,groups:v})}),o.value=F,E===c.value&&(r.value=!1),F.length>0?l.value=[`${F[0].id}-基础信息`]:l.value=[]};let C=!1;const m=()=>{if(C)return;const y=s?.value;y&&y.selectionChange&&(y.selectionChange(A),C=!0)};return d.watch(()=>s?.value,()=>{m()},{deep:!0,immediate:!0}),d.watch(u,y=>{y&&a.value.length>0&&A(a.value)}),d.onMounted(()=>{m()}),(y,E)=>(d.openBlock(),d.createBlock(Re,{visible:u.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":n.fullHeight,onClose:h,"onUpdate:visible":E[1]||(E[1]=I=>u.value=I),class:"base-info-card"},{default:d.withCtx(()=>[d.createElementVNode("div",cE,[d.createVNode(d.unref(me.Spin),{spinning:r.value},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",dE,d.toDisplayString(I.title),1)):d.createCommentVNode("",!0),d.createVNode(d.unref(me.Collapse),{activeKey:l.value,"onUpdate:activeKey":E[0]||(E[0]=M=>l.value=M),ghost:"","expand-icon-position":"end"},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(I.groups,M=>(d.openBlock(),d.createBlock(d.unref(me.CollapsePanel),{key:`${I.id}-${M.name}`,header:M.name},{default:d.withCtx(()=>[d.createVNode(d.unref(me.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(M.params,(k,S)=>(d.openBlock(),d.createBlock(d.unref(me.DescriptionsItem),{key:S,label:f(String(S))},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(k),1)]),_:2},1032,["label"]))),128))]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:2},1032,["activeKey"])]))),128))]),_:1},8,["spinning"])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-3b43a977"]]);class oc{viewer;Cesium;pickHandler=null;bimEntityId="";mapEntityId="";constructor(e,t){this.viewer=e,this.Cesium=t}removeMarker(e){if(!this.viewer)return;const t=e==="BIM"?this.bimEntityId:this.mapEntityId;t&&(this.viewer.entities.removeById(t),e==="BIM"?this.bimEntityId="":this.mapEntityId="")}clearMarkers(){this.removeMarker("BIM"),this.removeMarker("MAP")}addMarker(e,t){if(!this.viewer||!this.Cesium)return;this.removeMarker(e);const i=`adjust-marker-${e}-${Date.now()}`;e==="BIM"?this.bimEntityId=i:this.mapEntityId=i,this.viewer.entities.add({id:i,position:this.Cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),point:{pixelSize:10,color:e==="BIM"?this.Cesium.Color.RED:this.Cesium.Color.ORANGE,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:`${e==="BIM"?"BIM":"地图"}标记点`,font:"14pt sans-serif",style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:new this.Cesium.Cartesian2(0,-10),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,backgroundColor:new this.Cesium.Color(.1,.1,.1,.8),showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}registerPickHandler(e){this.destroyPickHandler(),!(!this.Cesium||!this.viewer)&&(this.pickHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pickHandler.setInputAction(t=>{let i;try{i=this.viewer.scene.pickPosition(t.position)}catch(s){console.warn("pickPosition failed:",s)}if(!i){const s=this.viewer.camera.getPickRay(t.position);i=this.viewer.scene.globe.pick(s,this.viewer.scene)}if(i||(i=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid)),i){const s=this.Cesium.Cartographic.fromCartesian(i),o=this.Cesium.Math.toDegrees(s.longitude),r=this.Cesium.Math.toDegrees(s.latitude),l=s.height;e({longitude:o,latitude:r,height:l})}},this.Cesium.ScreenSpaceEventType.LEFT_CLICK,this.Cesium.KeyboardEventModifier.SHIFT))}destroyPickHandler(){this.pickHandler&&(this.pickHandler.destroy(),this.pickHandler=null)}calculateOffset(e,t){return{dLon:t.longitude-e.longitude,dLat:t.latitude-e.latitude,dHeight:t.height-e.height}}}const uE={class:"adjust-panel"},hE={class:"control-panel"},fE={class:"form-item"},pE={class:"radio-group"},gE={class:"form-item"},mE={class:"radio-group"},AE={class:"form-item"},yE={class:"value"},CE={class:"param-row"},EE={class:"param-row"},wE={class:"param-row"},bE={class:"param-row"},vE={class:"param-row"},IE={class:"param-row"},xE={class:"param-row"},BE={class:"button-grid"},SE={key:1,class:"pick-mode-ui"},ME={class:"form-item",style:{display:"block","margin-bottom":"15px"}},TE={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},DE=["checked"],kE={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},PE={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},FE={class:"form-item",style:{display:"block","margin-bottom":"15px"}},RE={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},OE=["checked"],LE={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},NE={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},UE={class:"list-panel"},_E={class:"list-header"},QE={class:"col-check"},HE=["checked"],GE={class:"list-body"},YE={class:"col-check"},VE=["onUpdate:modelValue"],WE={class:"col-index"},zE=["title"],jE={class:"col-main"},$E=["checked","onChange"],Hn=Ue(d.defineComponent({__name:"LeitingPosition",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close","save"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=d.computed({get:()=>i.open!==void 0?i.open:i.visible,set:O=>{s("update:visible",O),s("update:open",O)}}),r=d.inject("leitingMethods"),l=d.ref("BIM"),a=d.ref("param"),c=d.ref(""),u=d.ref([]),h=d.ref("BIM"),f=d.ref(null),p=d.ref(null),A=d.ref(null),C=()=>(!A.value&&r?.value?.getViewer&&r?.value?.getCesium&&(A.value=new oc(r.value.getViewer(),r.value.getCesium())),A.value),m=()=>{C()?.clearMarkers(),f.value=null,p.value=null},y=(O,T)=>{O==="BIM"?f.value=T:p.value=T,C()?.addMarker(O,T),ge.success(`${O==="BIM"?"BIM":"地图"}标记点已添加`)},E=()=>{C()?.registerPickHandler(O=>{y(h.value,O)})},I=()=>{C()?.destroyPickHandler()},M=()=>{if(!f.value||!p.value){ge.warning("请先选择BIM标记点和地图标记点");return}if(!c.value){ge.warning("请先选择主模型");return}const O=C();let T=0,Q=0,V=0;if(O){const{dLon:$,dLat:J,dHeight:ne}=O.calculateOffset(f.value,p.value);T=$,Q=J,V=ne}else T=p.value.longitude-f.value.longitude,Q=p.value.latitude-f.value.latitude,V=p.value.height-f.value.height;S.value.longitude+=T,S.value.latitude+=Q,S.value.height+=V,w(c.value,{longitude:S.value.longitude,latitude:S.value.latitude,height:S.value.height}),ge.success("位置已调整")};d.watch(()=>a.value,O=>{O==="pick"?E():I()}),e({addMarker:y,setModelType:O=>{(O==="BIM"||O==="OSGB")&&(l.value=O)}});const S=d.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),x=d.computed(()=>{const O=u.value.find(T=>T.modelId===c.value);return O?O.modelName:""}),g=d.computed(()=>D.value.length>0&&D.value.every(O=>O.selected)),F=()=>{o.value=!1,s("close")},D=d.computed(()=>u.value.filter(O=>O.type===l.value)),P=O=>{const T=O.target.checked;D.value.forEach(Q=>Q.selected=T)},L=()=>{if(!r?.value)return;const O=r.value,T=O.getMapTileset?O.getMapTileset():{},Q=[];if(Object.keys(T).forEach(V=>{const J=T[V].leiting||{};J.model&&Q.push({modelId:J.model.modelId,modelName:J.model.modelName,selected:!1,formData:J.model.formData||{},dbName:J.model.dbName,url:J.model.url,type:J.model.type||"BIM"})}),u.value=Q,Q.length>0){const V=O.getBIMmodelId?O.getBIMmodelId():"";V&&Q.find($=>$.modelId===V)?N(V):N(Q[0].modelId),Q.forEach($=>$.selected=!0)}},G=()=>{ge.info("拖动右下角标,可显示模型列表",void 0,2)},N=O=>{c.value=O;const T=u.value.find(Q=>Q.modelId===O);T&&T.formData&&Object.keys(S.value).forEach(Q=>{T.formData[Q]!==void 0&&(S.value[Q]=T.formData[Q])})},b=O=>r?.value?.getMapTileset?r.value.getMapTileset()[O]:null,w=(O,T)=>{const Q=b(O),V=r.value.getCesium();if(Q&&V){if(Q.leiting?.model){Q.leiting.model.formData={...Q.leiting.model.formData,...T};const $=u.value.find(J=>J.modelId===O);$&&($.formData=Q.leiting.model.formData)}dr({Cesium:V,tileset:Q})}},v=O=>{if(!c.value)return;const T=S.value[O];w(c.value,{[O]:T})},B=O=>{const T=D.value.filter(J=>J.selected);if(T.length===0){ge.warning("请先选择要调整的模型");return}const{lonlat:Q,heightDistance:V,rotation:$}=S.value;T.forEach(J=>{const ne={...J.formData};switch(O){case"north":ne.latitude+=Q;break;case"south":ne.latitude-=Q;break;case"east":ne.longitude+=Q;break;case"west":ne.longitude-=Q;break;case"up":ne.height+=V;break;case"down":ne.height-=V;break;case"rotateLeft":ne.totalRotation=(ne.totalRotation||0)-$;break;case"rotateRight":ne.totalRotation=(ne.totalRotation||0)+$;break}J.modelId===c.value&&Object.assign(S.value,ne),w(J.modelId,ne)})},R=()=>{if(!c.value){ge.warning("请先选择主模型");return}const O=b(c.value);if(!O||!r?.value?.getViewer)return;const T=r.value.getViewer(),Q=r.value.getCesium(),V=O.boundingSphere;T.camera.flyToBoundingSphere(V,{offset:new Q.HeadingPitchRange(0,Q.Math.toRadians(-90),V.radius*2),duration:1.5})},U=()=>{r?.value?.saveRegion?(r.value.saveRegion(u.value),s("save",d.unref(u))):(console.log("Save models:",u.value),ge.warning("未找到保存接口,数据已打印控制台"))};return d.watch(()=>i.visible,O=>{O?(L(),G(),a.value==="pick"&&E()):(I(),m())}),d.onMounted(()=>{i.visible&&(L(),G(),a.value==="pick"&&E())}),(O,T)=>(d.openBlock(),d.createBlock(Re,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":n.fullHeight,"onUpdate:visible":T[25]||(T[25]=Q=>o.value=Q),onClose:F,onSave:U},{default:d.withCtx(()=>[d.createElementVNode("div",uE,[d.createElementVNode("div",hE,[d.createElementVNode("div",fE,[T[26]||(T[26]=d.createElementVNode("label",null,"模型类型:",-1)),d.createElementVNode("div",pE,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="BIM"}),onClick:T[0]||(T[0]=Q=>l.value="BIM")},"BIM模型",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="OSGB"}),onClick:T[1]||(T[1]=Q=>l.value="OSGB")},"倾斜摄影",2)])]),d.createElementVNode("div",gE,[T[27]||(T[27]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",mE,[d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="param"}),onClick:T[2]||(T[2]=Q=>a.value="param")},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="pick"}),onClick:T[3]||(T[3]=Q=>a.value="pick")},"地图点选",2)])]),d.createElementVNode("div",AE,[T[28]||(T[28]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",yE,d.toDisplayString(x.value||"未选择"),1)]),T[42]||(T[42]=d.createElementVNode("div",{class:"separator"},null,-1)),a.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[T[36]||(T[36]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",CE,[T[29]||(T[29]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[4]||(T[4]=Q=>S.value.longitude=Q),onChange:T[5]||(T[5]=Q=>v("longitude")),step:"0.000001"},null,544),[[d.vModelText,S.value.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",EE,[T[30]||(T[30]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[6]||(T[6]=Q=>S.value.latitude=Q),onChange:T[7]||(T[7]=Q=>v("latitude")),step:"0.000001"},null,544),[[d.vModelText,S.value.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",wE,[T[31]||(T[31]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[8]||(T[8]=Q=>S.value.height=Q),onChange:T[9]||(T[9]=Q=>v("height")),step:"0.1"},null,544),[[d.vModelText,S.value.height,void 0,{number:!0}]])]),d.createElementVNode("div",bE,[T[32]||(T[32]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[10]||(T[10]=Q=>S.value.totalRotation=Q),onChange:T[11]||(T[11]=Q=>v("totalRotation")),step:"1"},null,544),[[d.vModelText,S.value.totalRotation,void 0,{number:!0}]])]),T[37]||(T[37]=d.createElementVNode("div",{class:"separator"},null,-1)),T[38]||(T[38]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",vE,[T[33]||(T[33]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[12]||(T[12]=Q=>S.value.lonlat=Q),step:"0.000001"},null,512),[[d.vModelText,S.value.lonlat,void 0,{number:!0}]])]),d.createElementVNode("div",IE,[T[34]||(T[34]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[13]||(T[13]=Q=>S.value.heightDistance=Q),step:"0.1"},null,512),[[d.vModelText,S.value.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",xE,[T[35]||(T[35]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[14]||(T[14]=Q=>S.value.rotation=Q),step:"1"},null,512),[[d.vModelText,S.value.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",BE,[d.createElementVNode("button",{onClick:T[15]||(T[15]=Q=>B("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:T[16]||(T[16]=Q=>B("north"))},"北移"),d.createElementVNode("button",{onClick:T[17]||(T[17]=Q=>B("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:T[18]||(T[18]=Q=>B("west"))},"西移"),d.createElementVNode("button",{onClick:T[19]||(T[19]=Q=>B("south"))},"南移"),d.createElementVNode("button",{onClick:T[20]||(T[20]=Q=>B("east"))},"东移"),d.createElementVNode("button",{onClick:T[21]||(T[21]=Q=>B("up"))},"上移"),d.createElementVNode("button",{onClick:T[22]||(T[22]=Q=>B("down"))},"下移"),d.createElementVNode("button",{onClick:R,class:"primary-btn"},"正北俯视"),d.createElementVNode("button",{onClick:U,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):a.value==="pick"?(d.openBlock(),d.createElementBlock("div",SE,[d.createElementVNode("div",ME,[d.createElementVNode("div",TE,[d.createElementVNode("div",{onClick:T[23]||(T[23]=Q=>h.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:h.value==="BIM",style:{"margin-right":"5px"}},null,8,DE),T[39]||(T[39]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),f.value?(d.openBlock(),d.createElementBlock("div",kE,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(f.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(f.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",PE,"未选择"))])]),d.createElementVNode("div",FE,[d.createElementVNode("div",RE,[d.createElementVNode("div",{onClick:T[24]||(T[24]=Q=>h.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:h.value==="MAP",style:{"margin-right":"5px"}},null,8,OE),T[40]||(T[40]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),p.value?(d.openBlock(),d.createElementBlock("div",LE,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(p.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(p.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",NE,"未选择"))])]),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:M},"调整位置"),d.createElementVNode("button",{onClick:U},"保存")]),T[41]||(T[41]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):d.createCommentVNode("",!0)]),d.createElementVNode("div",UE,[d.createElementVNode("div",_E,[d.createElementVNode("div",QE,[d.createElementVNode("input",{type:"checkbox",checked:g.value,onChange:P},null,40,HE)]),T[43]||(T[43]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),T[44]||(T[44]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),T[45]||(T[45]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",GE,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(D.value,(Q,V)=>(d.openBlock(),d.createElementBlock("div",{key:Q.modelId,class:d.normalizeClass(["list-item",{active:Q.modelId===c.value}])},[d.createElementVNode("div",YE,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":$=>Q.selected=$},null,8,VE),[[d.vModelCheckbox,Q.selected]])]),d.createElementVNode("div",WE,d.toDisplayString(V+1),1),d.createElementVNode("div",{class:"col-name",title:Q.modelName},d.toDisplayString(Q.modelName),9,zE),d.createElementVNode("div",jE,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:Q.modelId===c.value,onChange:$=>N(Q.modelId)},null,40,$E)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-0fedba59"]]);function Fi(){return Fi=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Fi.apply(null,arguments)}const KE={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},XE={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},rc={lang:Fi({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},KE),timePickerLocale:Fi({},XE)};rc.lang.ok="确定";var Ri={exports:{}},qE=Ri.exports,ac;function lc(){return ac||(ac=1,(function(n,e){(function(t,i){n.exports=i()})(qE,(function(){var t=1e3,i=6e4,s=36e5,o="millisecond",r="second",l="minute",a="hour",c="day",u="week",h="month",f="quarter",p="year",A="date",C="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var b=["th","st","nd","rd"],w=N%100;return"["+N+(b[(w-20)%10]||b[w]||b[0])+"]"}},I=function(N,b,w){var v=String(N);return!v||v.length>=b?N:""+Array(b+1-v.length).join(w)+N},M={s:I,z:function(N){var b=-N.utcOffset(),w=Math.abs(b),v=Math.floor(w/60),B=w%60;return(b<=0?"+":"-")+I(v,2,"0")+":"+I(B,2,"0")},m:function N(b,w){if(b.date()<w.date())return-N(w,b);var v=12*(w.year()-b.year())+(w.month()-b.month()),B=b.clone().add(v,h),R=w-B<0,U=b.clone().add(v+(R?-1:1),h);return+(-(v+(w-B)/(R?B-U:U-B))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:h,y:p,w:u,d:c,D:A,h:a,m:l,s:r,ms:o,Q:f}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},k="en",S={};S[k]=E;var x="$isDayjsObject",g=function(N){return N instanceof L||!(!N||!N[x])},F=function N(b,w,v){var B;if(!b)return k;if(typeof b=="string"){var R=b.toLowerCase();S[R]&&(B=R),w&&(S[R]=w,B=R);var U=b.split("-");if(!B&&U.length>1)return N(U[0])}else{var O=b.name;S[O]=b,B=O}return!v&&B&&(k=B),B||!v&&k},D=function(N,b){if(g(N))return N.clone();var w=typeof b=="object"?b:{};return w.date=N,w.args=arguments,new L(w)},P=M;P.l=F,P.i=g,P.w=function(N,b){return D(N,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var L=(function(){function N(w){this.$L=F(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[x]=!0}var b=N.prototype;return b.parse=function(w){this.$d=(function(v){var B=v.date,R=v.utc;if(B===null)return new Date(NaN);if(P.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var U=B.match(m);if(U){var O=U[2]-1||0,T=(U[7]||"0").substring(0,3);return R?new Date(Date.UTC(U[1],O,U[3]||1,U[4]||0,U[5]||0,U[6]||0,T)):new Date(U[1],O,U[3]||1,U[4]||0,U[5]||0,U[6]||0,T)}}return new Date(B)})(w),this.init()},b.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},b.$utils=function(){return P},b.isValid=function(){return this.$d.toString()!==C},b.isSame=function(w,v){var B=D(w);return this.startOf(v)<=B&&B<=this.endOf(v)},b.isAfter=function(w,v){return D(w)<this.startOf(v)},b.isBefore=function(w,v){return this.endOf(v)<D(w)},b.$g=function(w,v,B){return P.u(w)?this[v]:this.set(B,w)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(w,v){var B=this,R=!!P.u(v)||v,U=P.p(w),O=function(Y,j){var X=P.w(B.$u?Date.UTC(B.$y,j,Y):new Date(B.$y,j,Y),B);return R?X:X.endOf(c)},T=function(Y,j){return P.w(B.toDate()[Y].apply(B.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(j)),B)},Q=this.$W,V=this.$M,$=this.$D,J="set"+(this.$u?"UTC":"");switch(U){case p:return R?O(1,0):O(31,11);case h:return R?O(1,V):O(0,V+1);case u:var ne=this.$locale().weekStart||0,re=(Q<ne?Q+7:Q)-ne;return O(R?$-re:$+(6-re),V);case c:case A:return T(J+"Hours",0);case a:return T(J+"Minutes",1);case l:return T(J+"Seconds",2);case r:return T(J+"Milliseconds",3);default:return this.clone()}},b.endOf=function(w){return this.startOf(w,!1)},b.$set=function(w,v){var B,R=P.p(w),U="set"+(this.$u?"UTC":""),O=(B={},B[c]=U+"Date",B[A]=U+"Date",B[h]=U+"Month",B[p]=U+"FullYear",B[a]=U+"Hours",B[l]=U+"Minutes",B[r]=U+"Seconds",B[o]=U+"Milliseconds",B)[R],T=R===c?this.$D+(v-this.$W):v;if(R===h||R===p){var Q=this.clone().set(A,1);Q.$d[O](T),Q.init(),this.$d=Q.set(A,Math.min(this.$D,Q.daysInMonth())).$d}else O&&this.$d[O](T);return this.init(),this},b.set=function(w,v){return this.clone().$set(w,v)},b.get=function(w){return this[P.p(w)]()},b.add=function(w,v){var B,R=this;w=Number(w);var U=P.p(v),O=function(V){var $=D(R);return P.w($.date($.date()+Math.round(V*w)),R)};if(U===h)return this.set(h,this.$M+w);if(U===p)return this.set(p,this.$y+w);if(U===c)return O(1);if(U===u)return O(7);var T=(B={},B[l]=i,B[a]=s,B[r]=t,B)[U]||1,Q=this.$d.getTime()+w*T;return P.w(Q,this)},b.subtract=function(w,v){return this.add(-1*w,v)},b.format=function(w){var v=this,B=this.$locale();if(!this.isValid())return B.invalidDate||C;var R=w||"YYYY-MM-DDTHH:mm:ssZ",U=P.z(this),O=this.$H,T=this.$m,Q=this.$M,V=B.weekdays,$=B.months,J=B.meridiem,ne=function(j,X,se,oe){return j&&(j[X]||j(v,R))||se[X].slice(0,oe)},re=function(j){return P.s(O%12||12,j,"0")},Y=J||function(j,X,se){var oe=j<12?"AM":"PM";return se?oe.toLowerCase():oe};return R.replace(y,(function(j,X){return X||(function(se){switch(se){case"YY":return String(v.$y).slice(-2);case"YYYY":return P.s(v.$y,4,"0");case"M":return Q+1;case"MM":return P.s(Q+1,2,"0");case"MMM":return ne(B.monthsShort,Q,$,3);case"MMMM":return ne($,Q);case"D":return v.$D;case"DD":return P.s(v.$D,2,"0");case"d":return String(v.$W);case"dd":return ne(B.weekdaysMin,v.$W,V,2);case"ddd":return ne(B.weekdaysShort,v.$W,V,3);case"dddd":return V[v.$W];case"H":return String(O);case"HH":return P.s(O,2,"0");case"h":return re(1);case"hh":return re(2);case"a":return Y(O,T,!0);case"A":return Y(O,T,!1);case"m":return String(T);case"mm":return P.s(T,2,"0");case"s":return String(v.$s);case"ss":return P.s(v.$s,2,"0");case"SSS":return P.s(v.$ms,3,"0");case"Z":return U}return null})(j)||U.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(w,v,B){var R,U=this,O=P.p(v),T=D(w),Q=(T.utcOffset()-this.utcOffset())*i,V=this-T,$=function(){return P.m(U,T)};switch(O){case p:R=$()/12;break;case h:R=$();break;case f:R=$()/3;break;case u:R=(V-Q)/6048e5;break;case c:R=(V-Q)/864e5;break;case a:R=V/s;break;case l:R=V/i;break;case r:R=V/t;break;default:R=V}return B?R:P.a(R)},b.daysInMonth=function(){return this.endOf(h).$D},b.$locale=function(){return S[this.$L]},b.locale=function(w,v){if(!w)return this.$L;var B=this.clone(),R=F(w,v,!0);return R&&(B.$L=R),B},b.clone=function(){return P.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},N})(),G=L.prototype;return D.prototype=G,[["$ms",o],["$s",r],["$m",l],["$H",a],["$W",c],["$M",h],["$y",p],["$D",A]].forEach((function(N){G[N[1]]=function(b){return this.$g(b,N[0],N[1])}})),D.extend=function(N,b){return N.$i||(N(b,L,D),N.$i=!0),D},D.locale=F,D.isDayjs=g,D.unix=function(N){return D(1e3*N)},D.en=S[k],D.Ls=S,D.p={},D}))})(Ri)),Ri.exports}var JE=lc();const ze=tn(JE);var Oi={exports:{}},ZE=Oi.exports,cc;function ew(){return cc||(cc=1,(function(n,e){(function(t,i){n.exports=i(lc())})(ZE,(function(t){function i(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var s=i(t),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(r,l){return l==="W"?r+"周":r+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(r,l){var a=100*r+l;return a<600?"凌晨":a<900?"早上":a<1100?"上午":a<1300?"中午":a<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(Oi)),Oi.exports}ew();var Li={exports:{}},tw=Li.exports,dc;function nw(){return dc||(dc=1,(function(n,e){(function(t,i){n.exports=i()})(tw,(function(){return function(t,i,s){var o=i.prototype,r=function(h){return h&&(h.indexOf?h:h.s)},l=function(h,f,p,A,C){var m=h.name?h:h.$locale(),y=r(m[f]),E=r(m[p]),I=y||E.map((function(k){return k.slice(0,A)}));if(!C)return I;var M=m.weekStart;return I.map((function(k,S){return I[(S+(M||0))%7]}))},a=function(){return s.Ls[s.locale()]},c=function(h,f){return h.formats[f]||(function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(A,C,m){return C||m.slice(1)}))})(h.formats[f.toUpperCase()])},u=function(){var h=this;return{months:function(f){return f?f.format("MMMM"):l(h,"months")},monthsShort:function(f){return f?f.format("MMM"):l(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):l(h,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):l(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):l(h,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return c(h.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=a();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(f){return c(h,f)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return l(a(),"months")},s.monthsShort=function(){return l(a(),"monthsShort","months",3)},s.weekdays=function(h){return l(a(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return l(a(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return l(a(),"weekdaysMin","weekdays",2,h)}}}))})(Li)),Li.exports}var iw=nw();const sw=tn(iw);var Ni={exports:{}},ow=Ni.exports,uc;function rw(){return uc||(uc=1,(function(n,e){(function(t,i){n.exports=i()})(ow,(function(){return function(t,i){i.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,l=(r<o?r+7:r)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}}))})(Ni)),Ni.exports}var aw=rw();const lw=tn(aw);var Ui={exports:{}},cw=Ui.exports,hc;function dw(){return hc||(hc=1,(function(n,e){(function(t,i){n.exports=i()})(cw,(function(){var t="week",i="year";return function(s,o,r){var l=o.prototype;l.week=function(a){if(a===void 0&&(a=null),a!==null)return this.add(7*(a-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=r(this).startOf(i).add(1,i).date(c),h=r(this).endOf(t);if(u.isBefore(h))return 1}var f=r(this).startOf(i).date(c).startOf(t).subtract(1,"millisecond"),p=this.diff(f,t,!0);return p<0?r(this).startOf("week").week():Math.ceil(p)},l.weeks=function(a){return a===void 0&&(a=null),this.week(a)}}}))})(Ui)),Ui.exports}var uw=dw();const hw=tn(uw);var _i={exports:{}},fw=_i.exports,fc;function pw(){return fc||(fc=1,(function(n,e){(function(t,i){n.exports=i()})(fw,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,r=/\d\d?/,l=/\d*[^-_:/,()\s\d]+/,a={},c=function(m){return(m=+m)+(m>68?1900:2e3)},u=function(m){return function(y){this[m]=+y}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(y){if(!y||y==="Z")return 0;var E=y.match(/([+-]|\d\d)/g),I=60*E[1]+(+E[2]||0);return I===0?0:E[0]==="+"?-I:I})(m)}],f=function(m){var y=a[m];return y&&(y.indexOf?y:y.s.concat(y.f))},p=function(m,y){var E,I=a.meridiem;if(I){for(var M=1;M<=24;M+=1)if(m.indexOf(I(M,0,y))>-1){E=M>12;break}}else E=m===(y?"pm":"PM");return E},A={A:[l,function(m){this.afternoon=p(m,!1)}],a:[l,function(m){this.afternoon=p(m,!0)}],Q:[s,function(m){this.month=3*(m-1)+1}],S:[s,function(m){this.milliseconds=100*+m}],SS:[o,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[r,u("seconds")],ss:[r,u("seconds")],m:[r,u("minutes")],mm:[r,u("minutes")],H:[r,u("hours")],h:[r,u("hours")],HH:[r,u("hours")],hh:[r,u("hours")],D:[r,u("day")],DD:[o,u("day")],Do:[l,function(m){var y=a.ordinal,E=m.match(/\d+/);if(this.day=E[0],y)for(var I=1;I<=31;I+=1)y(I).replace(/\[|\]/g,"")===m&&(this.day=I)}],w:[r,u("week")],ww:[o,u("week")],M:[r,u("month")],MM:[o,u("month")],MMM:[l,function(m){var y=f("months"),E=(f("monthsShort")||y.map((function(I){return I.slice(0,3)}))).indexOf(m)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[l,function(m){var y=f("months").indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[o,function(m){this.year=c(m)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function C(m){var y,E;y=m,E=a&&a.formats;for(var I=(m=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(D,P,L){var G=L&&L.toUpperCase();return P||E[L]||t[L]||E[G].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,b,w){return b||w.slice(1)}))}))).match(i),M=I.length,k=0;k<M;k+=1){var S=I[k],x=A[S],g=x&&x[0],F=x&&x[1];I[k]=F?{regex:g,parser:F}:S.replace(/^\[|\]$/g,"")}return function(D){for(var P={},L=0,G=0;L<M;L+=1){var N=I[L];if(typeof N=="string")G+=N.length;else{var b=N.regex,w=N.parser,v=D.slice(G),B=b.exec(v)[0];w.call(P,B),D=D.replace(B,"")}}return(function(R){var U=R.afternoon;if(U!==void 0){var O=R.hours;U?O<12&&(R.hours+=12):O===12&&(R.hours=0),delete R.afternoon}})(P),P}}return function(m,y,E){E.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(c=m.parseTwoDigitYear);var I=y.prototype,M=I.parse;I.parse=function(k){var S=k.date,x=k.utc,g=k.args;this.$u=x;var F=g[1];if(typeof F=="string"){var D=g[2]===!0,P=g[3]===!0,L=D||P,G=g[2];P&&(G=g[2]),a=this.$locale(),!D&&G&&(a=E.Ls[G]),this.$d=(function(v,B,R,U){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*v);var O=C(B)(v),T=O.year,Q=O.month,V=O.day,$=O.hours,J=O.minutes,ne=O.seconds,re=O.milliseconds,Y=O.zone,j=O.week,X=new Date,se=V||(T||Q?1:X.getDate()),oe=T||X.getFullYear(),ae=0;T&&!Q||(ae=Q>0?Q-1:X.getMonth());var Ce,le=$||0,Pe=J||0,ct=ne||0,$e=re||0;return Y?new Date(Date.UTC(oe,ae,se,le,Pe,ct,$e+60*Y.offset*1e3)):R?new Date(Date.UTC(oe,ae,se,le,Pe,ct,$e)):(Ce=new Date(oe,ae,se,le,Pe,ct,$e),j&&(Ce=U(Ce).week(j).toDate()),Ce)}catch{return new Date("")}})(S,F,x,E),this.init(),G&&G!==!0&&(this.$L=this.locale(G).$L),L&&S!=this.format(F)&&(this.$d=new Date("")),a={}}else if(F instanceof Array)for(var N=F.length,b=1;b<=N;b+=1){g[1]=F[b-1];var w=E.apply(this,g);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}b===N&&(this.$d=new Date(""))}else M.call(this,k)}}}))})(_i)),_i.exports}var gw=pw();const mw=tn(gw),Aw={class:"setting-panel"},yw={class:"tabs-header"},Cw={class:"tab-content"},Ew={key:0,class:"section"},ww={class:"setting-item"},bw={class:"setting-item"},vw={class:"setting-item"},Iw={key:1,class:"section"},xw={class:"tabs-header",style:{"margin-bottom":"8px"}},Bw={key:0},Sw={class:"setting-item column"},Mw={class:"setting-item column"},Tw={class:"setting-item"},Dw={key:1},kw={class:"setting-item column"},Pw={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},Fw={class:"search-box"},Rw={key:2,class:"section"},Ow={class:"setting-item"},Lw={key:0,class:"setting-item column"},Nw={class:"sub-label"},Uw={class:"setting-item"},_w={class:"setting-item"},Qw={class:"setting-item column"},Hw={class:"setting-item column"},Gw={class:"sub-label"},Yw={class:"setting-item column"},Vw={class:"sub-label"},Ww={class:"setting-item column"},zw={class:"sub-label"},jw={class:"setting-item column"},$w={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},Kw=["onClick","title"],Xw={style:{display:"flex",gap:"8px","align-items":"center"}},qw={key:3,class:"section"},Jw={class:"setting-item"},Zw={class:"setting-item column"},Gn=Ue(d.defineComponent({__name:"LeitingSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean,default:!1},tiandituToken:{type:String,default:""},initialConfig:{type:Object,default:()=>({})}},emits:["update:visible","update:open","close"],setup(n,{emit:e}){ze.locale("zh-cn"),ze.extend(sw),ze.extend(lw),ze.extend(hw),ze.extend(mw);const t=me.Switch,i=me.Radio.Group,s=me.Radio,o=me.Input,r=me.Slider,l=me.Select,a=me.Select.Option,c=me.DatePicker,u=n,h=e,f=d.inject("leitingMethods"),p=d.computed({get:()=>u.open!==void 0?u.open:u.visible,set:b=>{h("update:visible",b),h("update:open",b)}}),A=d.ref("GIS"),C=d.reactive({globe:!1,terrain:!1,depthTest:!1}),m=d.reactive({provider:"tianditu",tianditu:{token:"c25f14fb6bd4397cf8fe45144ff768d6",layerType:"img_w",showLabel:!1},arcgis:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},baseMap:"tianditu"}),y=d.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:ze("2025-06-22 10:00"),brightness:1.5,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),E=d.reactive({collision:!1,habit:0}),I=b=>{b&&(b.globe!==void 0&&(C.globe=b.globe),b.terrain!==void 0&&(C.terrain=b.terrain),b.depthTest!==void 0&&(C.depthTest=b.depthTest),b.mapProvider!==void 0&&(m.provider=b.mapProvider),b.tiandituLayerType!==void 0&&(m.tianditu.layerType=b.tiandituLayerType),b.tiandituShowLabel!==void 0&&(m.tianditu.showLabel=b.tiandituShowLabel),b.arcgisUrl!==void 0&&(m.arcgis.url=b.arcgisUrl),b.shadows!==void 0&&(y.shadows=b.shadows),b.shadowDarkness!==void 0&&(y.shadowDarkness=b.shadowDarkness),b.environmentMap!==void 0&&(y.environmentMap=b.environmentMap),b.ambientOcclusion!==void 0&&(y.ambientOcclusion=b.ambientOcclusion),b.time!==void 0&&(typeof b.time=="number"?y.time=ze().startOf("day").add(b.time,"hour"):y.time=ze(b.time)),b.brightness!==void 0&&(y.brightness=b.brightness),b.contrast!==void 0&&(y.contrast=b.contrast),b.saturation!==void 0&&(y.saturation=b.saturation),b.backgroundColor!==void 0&&(y.backgroundColor=b.backgroundColor),b.collision!==void 0&&(E.collision=b.collision),b.mouseHabit!==void 0&&(E.habit=b.mouseHabit))};d.watch(()=>u.initialConfig,b=>{I(b)},{deep:!0,immediate:!0});const M=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],k=[{label:"全球影像地图服务(墨卡托)",value:"img_w"},{label:"全球影像地图服务(经纬度)",value:"img_c"},{label:"全球矢量地图服务(墨卡托)",value:"vec_w"},{label:"全球矢量地图服务(经纬度)",value:"vec_c"},{label:"全球地形晕渲服务(墨卡托)",value:"ter_w"},{label:"全球地形晕渲服务(经纬度)",value:"ter_c"}],S=()=>{const b=m.provider,w={};b==="tianditu"?(w.token=m.tianditu.token,w.layerType=m.tianditu.layerType,w.showAnnotation=m.tianditu.showLabel):b==="arcgis"&&(w.url=m.arcgis.url),f.value?.changeBaseMap?.(b,w)};d.watch(()=>m.provider,S),d.watch(()=>m.tianditu.layerType,S),d.watch(()=>m.tianditu.showLabel,S),d.watch(()=>m.tianditu.token,hs(S,1e3)),d.watch(()=>m.arcgis.url,hs(S,1e3)),d.onMounted(()=>{u.tiandituToken&&(m.tianditu.token=u.tiandituToken)}),d.watch(()=>C.globe,b=>f.value?.setGlobeEnvironmentVisible?.(b)),d.watch(()=>C.terrain,b=>f.value?.setTerrainEnable?.(b)),d.watch(()=>C.depthTest,b=>f.value?.setDepthTestEnable?.(b)),d.watch(()=>f?.value,b=>{if(b){if(b.getConfigure=()=>({globe:C.globe,terrain:C.terrain,depthTest:C.depthTest,mapProvider:m.provider,tiandituLayerType:m.tianditu.layerType,tiandituShowLabel:m.tianditu.showLabel,arcgisUrl:m.arcgis.url,shadows:y.shadows,shadowDarkness:y.shadowDarkness,environmentMap:y.environmentMap,ambientOcclusion:y.ambientOcclusion,time:ze.isDayjs(y.time)?y.time.format("YYYY-MM-DD HH:mm"):y.time,brightness:y.brightness,contrast:y.contrast,saturation:y.saturation,backgroundColor:y.backgroundColor,collision:E.collision,mouseHabit:E.habit}),b.setConfigure=w=>{I(w)},b.setBackgroundColor&&y.backgroundColor&&b.setBackgroundColor(y.backgroundColor),b.setGlobeEnvironmentVisible&&b.setGlobeEnvironmentVisible(C.globe),b.setShadowsEnable&&b.setShadowsEnable(y.shadows),b.setShadowDarkness&&b.setShadowDarkness(y.shadowDarkness),b.setEnvironmentMapEnable&&b.setEnvironmentMapEnable(y.environmentMap),b.setAmbientOcclusion&&b.setAmbientOcclusion(y.ambientOcclusion),b.setTime){const w=ze.isDayjs(y.time)?y.time.toDate():new Date;b.setTime(w)}b.setModelBrightness&&b.setModelBrightness(y.brightness),b.setCollisionDetection&&b.setCollisionDetection(E.collision),b.setMouseHabit&&b.setMouseHabit(E.habit),b.changeBaseMap&&m.baseMap&&b.changeBaseMap(m.baseMap,{token:m.tianditu.token,layerType:m.tianditu.layerType,showAnnotation:m.tianditu.showLabel,url:m.arcgis.url})}},{immediate:!0});const x=d.computed({get:()=>{const b=y.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(b)?b:"#ffffff"},set:b=>{y.backgroundColor=b}}),g=d.ref(""),F=d.ref(!1),D=d.ref([]);d.watch(()=>C.globe,b=>f.value?.setGlobeEnvironmentVisible?.(b)),d.watch(()=>C.terrain,b=>f.value?.setTerrainEnable?.(b)),d.watch(()=>m.baseMap,b=>{f.value?.changeBaseMap?.(b,{token:u.tiandituToken})}),d.watch(()=>y.shadows,b=>f.value?.setShadowsEnable?.(b)),d.watch(()=>y.shadowDarkness,b=>f.value?.setShadowDarkness?.(b)),d.watch(()=>y.environmentMap,b=>f.value?.setEnvironmentMapEnable?.(b)),d.watch(()=>y.ambientOcclusion,b=>f.value?.setAmbientOcclusion?.(b)),d.watch(()=>y.time,b=>{const w=ze.isDayjs(b)?b.toDate():new Date;f.value?.setTime?.(w)}),d.watch(()=>[y.brightness,y.contrast,y.saturation],([b,w,v])=>{const B=f.value;B?.setModelColorAdjustment?B.setModelColorAdjustment({brightness:b,contrast:w,saturation:v}):B?.setModelBrightness?.(b)}),d.watch(()=>y.backgroundColor,b=>{if(f.value?.setBackgroundColor)f.value.setBackgroundColor(b);else{const w=document.querySelector(".cesium-viewer");w&&(w.style.background=b)}}),d.watch(()=>E.collision,b=>f.value?.setCollisionDetection?.(b)),d.watch(()=>E.habit,b=>f.value?.setMouseHabit?.(b));const P=b=>{if(b?.pois&&Array.isArray(b.pois)&&b.pois.length>0){const w=b.pois[0],v=w.lonlat.split(/[, ]/).map(Number);if(v.length>=2&&!isNaN(v[0])&&!isNaN(v[1]))return{name:w.name,lon:v[0],lat:v[1],raw:w}}if(b?.area&&b.area.lonlat){const w=b.area,v=w.lonlat.split(/[, ]/).map(Number);if(v.length>=2&&!isNaN(v[0])&&!isNaN(v[1]))return{name:w.name,lon:v[0],lat:v[1],raw:w}}return null},G=hs(async()=>{const b=(g.value||"").trim();if(!b)return;const w=u.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";F.value=!0,D.value=[];try{if(f.value?.searchLocation){const v=await f.value.searchLocation(b,w),B=P(v);B&&(D.value=[B],ge.success(`找到:${B.name||""}`),f.value.flyTo(B.lon,B.lat,5e3))}else{const B=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:b,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(w)}`,R=await fetch(B);if(!R.ok)throw new Error(`HTTP ${R.status}`);const U=await R.json(),O=P(U);O&&(D.value=[O],ge.success(`找到:${O.name||""}`),f.value?.flyTo?.(O.lon,O.lat,5e3))}}catch(v){console.error("tianditu search error",v)}finally{F.value=!1}},800);d.watch(g,()=>{G()});const N=()=>{p.value=!1,h("close")};return d.onMounted(()=>{}),(b,w)=>(d.openBlock(),d.createBlock(Re,{visible:p.value,title:"设置","full-height":n.fullHeight,onClose:N,"onUpdate:visible":w[26]||(w[26]=v=>p.value=v)},{default:d.withCtx(()=>[d.createElementVNode("div",Aw,[d.createElementVNode("div",yw,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="GIS"}]),onClick:w[0]||(w[0]=v=>A.value="GIS")},"GIS",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="MAP"}]),onClick:w[1]||(w[1]=v=>A.value="MAP")},"地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="RENDER"}]),onClick:w[2]||(w[2]=v=>A.value="RENDER")},"渲染",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:A.value==="MOUSE"}]),onClick:w[3]||(w[3]=v=>A.value="MOUSE")},"鼠标",2)]),d.createElementVNode("div",Cw,[A.value==="GIS"?(d.openBlock(),d.createElementBlock("div",Ew,[d.createElementVNode("div",ww,[w[27]||(w[27]=d.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),d.createVNode(d.unref(t),{checked:C.globe,"onUpdate:checked":w[4]||(w[4]=v=>C.globe=v),size:"small"},null,8,["checked"])]),d.createElementVNode("div",bw,[w[28]||(w[28]=d.createElementVNode("span",null,"地形 (高程)",-1)),d.createVNode(d.unref(t),{checked:C.terrain,"onUpdate:checked":w[5]||(w[5]=v=>C.terrain=v),size:"small"},null,8,["checked"])]),d.createElementVNode("div",vw,[w[29]||(w[29]=d.createElementVNode("span",null,"地形遮挡",-1)),d.createVNode(d.unref(t),{checked:C.depthTest,"onUpdate:checked":w[6]||(w[6]=v=>C.depthTest=v),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),A.value==="MAP"?(d.openBlock(),d.createElementBlock("div",Iw,[d.createElementVNode("div",xw,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.provider==="tianditu"}]),onClick:w[7]||(w[7]=v=>m.provider="tianditu")},"天地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.provider==="arcgis"}]),onClick:w[8]||(w[8]=v=>m.provider="arcgis")},"ArcGIS",2)]),m.provider==="tianditu"?(d.openBlock(),d.createElementBlock("div",Bw,[d.createElementVNode("div",Sw,[w[30]||(w[30]=d.createElementVNode("div",{class:"sub-label"},"Token",-1)),d.createVNode(d.unref(o),{value:m.tianditu.token,"onUpdate:value":w[9]||(w[9]=v=>m.tianditu.token=v),size:"small",placeholder:"输入天地图Token"},null,8,["value"])]),d.createElementVNode("div",Mw,[w[31]||(w[31]=d.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),d.createVNode(d.unref(l),{value:m.tianditu.layerType,"onUpdate:value":w[10]||(w[10]=v=>m.tianditu.layerType=v),size:"small",style:{width:"100%"}},{default:d.withCtx(()=>[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(k,v=>d.createVNode(d.unref(a),{key:v.value,value:v.value},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(v.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),d.createElementVNode("div",Tw,[w[32]||(w[32]=d.createElementVNode("span",null,"叠加注记",-1)),d.createVNode(d.unref(t),{checked:m.tianditu.showLabel,"onUpdate:checked":w[11]||(w[11]=v=>m.tianditu.showLabel=v),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),m.provider==="arcgis"?(d.openBlock(),d.createElementBlock("div",Dw,[d.createElementVNode("div",kw,[w[33]||(w[33]=d.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),d.createVNode(d.unref(o),{value:m.arcgis.url,"onUpdate:value":w[12]||(w[12]=v=>m.arcgis.url=v),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):d.createCommentVNode("",!0),d.createElementVNode("div",Pw,[w[34]||(w[34]=d.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),d.createElementVNode("div",Fw,[d.createVNode(d.unref(o),{value:g.value,"onUpdate:value":w[13]||(w[13]=v=>g.value=v),placeholder:"输入地名搜索",size:"small","allow-clear":""},null,8,["value"])])])])):d.createCommentVNode("",!0),A.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",Rw,[d.createElementVNode("div",Ow,[w[35]||(w[35]=d.createElementVNode("span",null,"阴影",-1)),d.createVNode(d.unref(t),{checked:y.shadows,"onUpdate:checked":w[14]||(w[14]=v=>y.shadows=v),size:"small"},null,8,["checked"])]),y.shadows?(d.openBlock(),d.createElementBlock("div",Lw,[d.createElementVNode("div",Nw,"阴影暗度 ("+d.toDisplayString(y.shadowDarkness.toFixed(2))+")",1),d.createVNode(d.unref(r),{value:y.shadowDarkness,"onUpdate:value":w[15]||(w[15]=v=>y.shadowDarkness=v),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):d.createCommentVNode("",!0),d.createElementVNode("div",Uw,[w[36]||(w[36]=d.createElementVNode("span",null,"环境贴图 (HDR)",-1)),d.createVNode(d.unref(t),{checked:y.environmentMap,"onUpdate:checked":w[16]||(w[16]=v=>y.environmentMap=v),size:"small"},null,8,["checked"])]),d.createElementVNode("div",_w,[w[37]||(w[37]=d.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),d.createVNode(d.unref(t),{checked:y.ambientOcclusion,"onUpdate:checked":w[17]||(w[17]=v=>y.ambientOcclusion=v),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Qw,[w[38]||(w[38]=d.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),d.createVNode(d.unref(c),{value:y.time,"onUpdate:value":w[18]||(w[18]=v=>y.time=v),"show-time":"",locale:d.unref(rc),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),d.createElementVNode("div",Hw,[d.createElementVNode("div",Gw,"模型亮度 ("+d.toDisplayString(y.brightness.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.brightness,"onUpdate:value":w[19]||(w[19]=v=>y.brightness=v),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Yw,[d.createElementVNode("div",Vw,"模型对比度 ("+d.toDisplayString(y.contrast.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.contrast,"onUpdate:value":w[20]||(w[20]=v=>y.contrast=v),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Ww,[d.createElementVNode("div",zw,"模型饱和度 ("+d.toDisplayString(y.saturation.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:y.saturation,"onUpdate:value":w[21]||(w[21]=v=>y.saturation=v),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",jw,[w[39]||(w[39]=d.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),d.createElementVNode("div",$w,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(M,(v,B)=>d.createElementVNode("div",{key:B,style:d.normalizeStyle({background:v,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:R=>y.backgroundColor=v,title:"预设 "+(B+1)},null,12,Kw)),64))]),d.createElementVNode("div",Xw,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":w[22]||(w[22]=v=>x.value=v),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[d.vModelText,x.value]]),d.createVNode(d.unref(o),{value:y.backgroundColor,"onUpdate:value":w[23]||(w[23]=v=>y.backgroundColor=v),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):d.createCommentVNode("",!0),A.value==="MOUSE"?(d.openBlock(),d.createElementBlock("div",qw,[d.createElementVNode("div",Jw,[w[40]||(w[40]=d.createElementVNode("span",null,"碰撞检测",-1)),d.createVNode(d.unref(t),{checked:E.collision,"onUpdate:checked":w[24]||(w[24]=v=>E.collision=v),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Zw,[w[43]||(w[43]=d.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),d.createVNode(d.unref(i),{value:E.habit,"onUpdate:value":w[25]||(w[25]=v=>E.habit=v),size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(s),{value:0},{default:d.withCtx(()=>[...w[41]||(w[41]=[d.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),d.createVNode(d.unref(s),{value:1},{default:d.withCtx(()=>[...w[42]||(w[42]=[d.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):d.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-1ed17be9"]]),eb={class:"cad-layer-panel"},tb={class:"layer-list-container"},nb={class:"list-header"},ib={class:"col-check"},sb=["checked"],ob={class:"list-body"},rb={class:"col-check"},ab=["checked","onChange"],lb={class:"col-index"},cb=["title"],db={class:"col-color"},ub=["value"],hb={key:0,class:"empty-text"},fb=Ue(d.defineComponent({__name:"LeitingCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(E=>({modelId:E.modelId,modelName:E.modelName}))||[])},a=d.computed(()=>r.value.map(E=>({value:E.modelId,label:E.modelName}))),c=d.ref([]),u=d.ref([]),h=d.computed(()=>c.value.length>0&&u.value.length===c.value.length),f=({modelId:E})=>{if(c.value=[],u.value=[],s.value&&s.value.getDxfLayers){const I=s.value.getDxfLayers({modelId:E});I&&Object.keys(I).forEach((M,k)=>{I[M].length&&(c.value.push({index:k+1,layerName:M,layerColor:I[M][0].color||"#ffffff",key:M}),u.value.push(M))})}},p=E=>{o.value=E,f({modelId:E})},A=E=>{E.target.checked?u.value=c.value.map(M=>M.key):u.value=[],m()},C=(E,I)=>{I.target.checked?u.value.includes(E)||u.value.push(E):u.value=u.value.filter(k=>k!==E),m()},m=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:u.value}),s.value.getDxfLayers)){const E=s.value.getDxfLayers({modelId:o.value});if(E){const I=Object.keys(E).filter(M=>!u.value.includes(M));s.value.showDxfLayer({modelId:o.value,show:!1,layers:I})}}},y=()=>{i("update:visible",!1),i("handleCloseCardByCadCard")};return d.watch(()=>t.visible,E=>{E&&(l(),t.currentModelId?(o.value=t.currentModelId,f({modelId:t.currentModelId})):a.value.length>0&&(o.value=a.value[0]?.value,f({modelId:o.value})))}),d.watch(()=>t.currentModelId,E=>{E&&t.visible&&(o.value=E,f({modelId:E}))}),(E,I)=>(d.openBlock(),d.createBlock(Re,{visible:n.visible,title:"CAD图层","onUpdate:visible":I[3]||(I[3]=M=>E.$emit("update:visible",M)),onClose:y,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":d.withCtx(()=>[d.createElementVNode("div",{class:"header-select-container",onMousedown:I[2]||(I[2]=d.withModifiers(()=>{},["stop"]))},[I[4]||(I[4]=d.createElementVNode("span",{class:"header-label"},"图纸:",-1)),d.createVNode(d.unref(me.Select),{value:o.value,"onUpdate:value":I[0]||(I[0]=M=>o.value=M),options:a.value,onChange:I[1]||(I[1]=M=>p(M)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:d.withCtx(()=>[d.createElementVNode("div",eb,[d.createElementVNode("div",tb,[d.createElementVNode("div",nb,[d.createElementVNode("div",ib,[d.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:A},null,40,sb)]),I[5]||(I[5]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),I[6]||(I[6]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),I[7]||(I[7]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",ob,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,M=>(d.openBlock(),d.createElementBlock("div",{key:M.key,class:"list-item"},[d.createElementVNode("div",rb,[d.createElementVNode("input",{type:"checkbox",checked:u.value.includes(M.key),onChange:k=>C(M.key,k)},null,40,ab)]),d.createElementVNode("div",lb,d.toDisplayString(M.index),1),d.createElementVNode("div",{class:"col-name",title:M.layerName},d.toDisplayString(M.layerName),9,cb),d.createElementVNode("div",db,[d.createElementVNode("input",{type:"color",value:M.layerColor,disabled:""},null,8,ub)])]))),128)),c.value.length===0?(d.openBlock(),d.createElementBlock("div",hb,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),pb={class:"adjust-panel"},gb={class:"control-panel"},mb={class:"form-item"},Ab={class:"radio-group"},yb={class:"form-item"},Cb=["title"],Eb={class:"param-row"},wb=["step"],bb={class:"param-row"},vb=["step"],Ib={class:"param-row"},xb=["step"],Bb={class:"param-row"},Sb=["step"],Mb={class:"param-row"},Tb=["step"],Db={class:"param-row"},kb=["step"],Pb={class:"param-row"},Fb=["step"],Rb={class:"button-grid"},Ob={key:1,class:"pick-mode-ui"},Lb=["onClick"],Nb=["checked"],Ub={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},_b={class:"param-row"},Qb={style:{width:"40px"}},Hb=["onUpdate:modelValue"],Gb={class:"param-row"},Yb={style:{width:"40px"}},Vb=["onUpdate:modelValue"],Wb={class:"param-row"},zb={style:{width:"40px"}},jb=["onUpdate:modelValue"],$b={class:"list-panel"},Kb={class:"list-header"},Xb={class:"col-check"},qb=["checked"],Jb={class:"list-body"},Zb={class:"col-check"},ev=["onUpdate:modelValue"],tv={class:"col-index"},nv=["title"],iv={class:"col-main"},sv=["checked","onChange"],ov={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},rv=Ue(d.defineComponent({__name:"LeitingCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","handleSavingByCadCard","clearBimPointList","save"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=d.inject("leitingMethods"),r=d.ref([]),l=d.ref(""),a=d.computed(()=>r.value.length>0&&r.value.every(w=>w.selected)),c=d.ref("param"),u=d.ref("bimPoint1"),h=d.ref(null),f=d.ref("bimPoint1"),p=d.reactive({bimPoint1:{longitude:void 0,latitude:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0},bimPoint2:{longitude:void 0,latitude:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0}}),A=d.ref(1e-6),C=d.reactive({modelId:"",longitude:0,latitude:0,distance:1e-6,rotation:1,totalRotation:0,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0}),m=d.computed(()=>{const w=r.value.find(v=>v.modelId===l.value);return w?w.modelName:""}),y=()=>{s("update:visible",!1)},E=()=>(!h.value&&o?.value?.getViewer&&o?.value?.getCesium&&(h.value=new oc(o.value.getViewer(),o.value.getCesium())),h.value),I=()=>{E()?.clearMarkers(),p.bimPoint1.longitude=void 0,p.bimPoint1.latitude=void 0,p.bimPoint1.height=void 0,p.bimPoint2.longitude=void 0,p.bimPoint2.latitude=void 0,p.bimPoint2.height=void 0},M=w=>{const v=u.value,B=p[v];if(B){B.longitude=w.longitude,B.latitude=w.latitude,B.height=w.height;const R=v==="bimPoint1"?"BIM":"MAP";E()?.addMarker(R,w),ge.success(`${B.type}已添加`)}},k=()=>{E()?.registerPickHandler(w=>{M(w)})},S=()=>{E()?.destroyPickHandler()},x=w=>{c.value=w,w!=="pick"&&s("clearBimPointList")};d.watch(()=>c.value,w=>{w==="pick"?k():S()}),d.onUnmounted(()=>{S()});const g=()=>{if(!o?.value?.getDxfModels)return;const w=o.value.getDxfModels();if(Array.isArray(w)?r.value=w.map(v=>({modelId:v.modelId,modelName:v.modelName,formData:v.formData||{},selected:!1,tileset:v})):r.value=[],r.value.length>0){const v=o.value.getCadModelId?o.value.getCadModelId():"";v&&r.value.find(B=>B.modelId===v)?F(v):F(r.value[0].modelId),r.value.forEach(B=>B.selected=!0)}},F=w=>{l.value=w;const v=r.value.find(B=>B.modelId===w);v&&v.formData&&Object.keys(C).forEach(B=>{v.formData[B]!==void 0&&(C[B]=v.formData[B])})},D=(w,v)=>{if(!o?.value?.adjustingModelByCad)return;const B=r.value.find(R=>R.modelId===w);B&&B.tileset&&(B.formData={...B.formData,...v},B.tileset.formData=B.formData,o.value.adjustingModelByCad({...B.formData,tileset:B.tileset}))},P=w=>{if(!l.value)return;const v=C[w];D(l.value,{[w]:v})},L=w=>{const v=r.value.filter(O=>O.selected);if(v.length===0){ge.warning("请先选择要调整的模型");return}const{distance:B,heightDistance:R,rotation:U}=C;v.forEach(O=>{const T={...O.formData};switch(w){case"north":T.latitude+=B;break;case"south":T.latitude-=B;break;case"east":T.longitude+=B;break;case"west":T.longitude-=B;break;case"up":T.height+=R;break;case"down":T.height-=R;break;case"rotateLeft":T.totalRotation=(T.totalRotation||0)-U;break;case"rotateRight":T.totalRotation=(T.totalRotation||0)+U;break}O.modelId===l.value&&Object.assign(C,T),D(O.modelId,T)})},G=w=>{const v=w.target.checked;r.value.forEach(B=>B.selected=v)},N=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},b=()=>{const w=p.bimPoint1,v=p.bimPoint2;if(w.longitude===void 0||v.longitude===void 0){ge.warning("请先完成点选操作");return}const B=r.value.filter(Q=>Q.selected);if(B.length===0){ge.warning("请先选择要调整的模型");return}let R=0,U=0,O=0;const T=E();if(T){const{dLon:Q,dLat:V,dHeight:$}=T.calculateOffset(w,v);R=Q,U=V,O=$}else R=v.longitude-w.longitude,U=v.latitude-w.latitude,O=v.height-w.height;B.forEach(Q=>{const V={...Q.formData};V.longitude+=R,V.latitude+=U,V.height+=O,Q.modelId===l.value&&Object.assign(C,V),D(Q.modelId,V)}),ge.success("位置已调整")};return d.watch(()=>i.visible,w=>{w?g():(S(),I())}),d.onMounted(()=>{i.visible&&g()}),e({setBIMPointsList:({longitude:w,latitude:v,height:B})=>{p[f.value].longitude=w,p[f.value].latitude=v,p[f.value].height=B},addGltfOr3dTilesModelList:w=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(w,v)=>(d.openBlock(),d.createBlock(Re,{visible:i.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":v[21]||(v[21]=B=>s("update:visible",B)),onClose:y},{default:d.withCtx(()=>[d.createElementVNode("div",pb,[d.createElementVNode("div",gb,[d.createElementVNode("div",mb,[v[22]||(v[22]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",Ab,[d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="param"}),onClick:v[0]||(v[0]=B=>x("param"))},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="pick"}),onClick:v[1]||(v[1]=B=>x("pick"))},"地图点选",2)])]),d.createElementVNode("div",yb,[v[23]||(v[23]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:m.value},d.toDisplayString(m.value||"未选择"),9,Cb)]),v[35]||(v[35]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[v[31]||(v[31]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",Eb,[v[24]||(v[24]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[2]||(v[2]=B=>C.longitude=B),onChange:v[3]||(v[3]=B=>P("longitude")),step:A.value},null,40,wb),[[d.vModelText,C.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",bb,[v[25]||(v[25]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[4]||(v[4]=B=>C.latitude=B),onChange:v[5]||(v[5]=B=>P("latitude")),step:A.value},null,40,vb),[[d.vModelText,C.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",Ib,[v[26]||(v[26]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[6]||(v[6]=B=>C.height=B),onChange:v[7]||(v[7]=B=>P("height")),step:A.value},null,40,xb),[[d.vModelText,C.height,void 0,{number:!0}]])]),d.createElementVNode("div",Bb,[v[27]||(v[27]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[8]||(v[8]=B=>C.totalRotation=B),onChange:v[9]||(v[9]=B=>P("totalRotation")),step:A.value},null,40,Sb),[[d.vModelText,C.totalRotation,void 0,{number:!0}]])]),v[32]||(v[32]=d.createElementVNode("div",{class:"separator"},null,-1)),v[33]||(v[33]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",Mb,[v[28]||(v[28]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[10]||(v[10]=B=>C.distance=B),step:A.value},null,8,Tb),[[d.vModelText,C.distance,void 0,{number:!0}]])]),d.createElementVNode("div",Db,[v[29]||(v[29]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[11]||(v[11]=B=>C.heightDistance=B),step:A.value},null,8,kb),[[d.vModelText,C.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",Pb,[v[30]||(v[30]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":v[12]||(v[12]=B=>C.rotation=B),step:A.value},null,8,Fb),[[d.vModelText,C.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",Rb,[d.createElementVNode("button",{onClick:v[13]||(v[13]=B=>L("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:v[14]||(v[14]=B=>L("north"))},"北移"),d.createElementVNode("button",{onClick:v[15]||(v[15]=B=>L("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:v[16]||(v[16]=B=>L("west"))},"西移"),d.createElementVNode("button",{onClick:v[17]||(v[17]=B=>L("south"))},"南移"),d.createElementVNode("button",{onClick:v[18]||(v[18]=B=>L("east"))},"东移"),d.createElementVNode("button",{onClick:v[19]||(v[19]=B=>L("up"))},"上移"),d.createElementVNode("button",{onClick:v[20]||(v[20]=B=>L("down"))},"下移"),d.createElementVNode("button",{onClick:N,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(d.openBlock(),d.createElementBlock("div",Ob,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p,(B,R)=>(d.openBlock(),d.createElementBlock("div",{key:R,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[d.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:U=>u.value=R},[d.createElementVNode("input",{type:"radio",checked:u.value===R,style:{"margin-right":"5px"}},null,8,Nb),d.createTextVNode(" "+d.toDisplayString(B.type)+": ",1)],8,Lb),d.createElementVNode("div",Ub,[d.createElementVNode("div",_b,[d.createElementVNode("label",Qb,d.toDisplayString(B.longitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.longitude=U,readonly:"",style:{width:"100px"}},null,8,Hb),[[d.vModelText,B.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",Gb,[d.createElementVNode("label",Yb,d.toDisplayString(B.latitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.latitude=U,readonly:"",style:{width:"100px"}},null,8,Vb),[[d.vModelText,B.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",Wb,[d.createElementVNode("label",zb,d.toDisplayString(B.heightText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":U=>B.height=U,readonly:"",style:{width:"100px"}},null,8,jb),[[d.vModelText,B.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:b,class:"primary-btn"},"应用校准"),d.createElementVNode("button",{onClick:N},"保存")]),v[34]||(v[34]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),d.createElementVNode("div",$b,[d.createElementVNode("div",Kb,[d.createElementVNode("div",Xb,[d.createElementVNode("input",{type:"checkbox",checked:a.value,onChange:G},null,40,qb)]),v[36]||(v[36]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),v[37]||(v[37]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),v[38]||(v[38]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",Jb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(B,R)=>(d.openBlock(),d.createElementBlock("div",{key:B.modelId,class:d.normalizeClass(["list-item",{active:B.modelId===l.value}])},[d.createElementVNode("div",Zb,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":U=>B.selected=U},null,8,ev),[[d.vModelCheckbox,B.selected]])]),d.createElementVNode("div",tv,d.toDisplayString(R+1),1),d.createElementVNode("div",{class:"col-name",title:B.modelName},d.toDisplayString(B.modelName),9,nv),d.createElementVNode("div",iv,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:B.modelId===l.value,onChange:U=>F(B.modelId)},null,40,sv)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",ov,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-e8abd49d"]]),av={class:"annotation-content"},lv={class:"annotation-tools"},cv={class:"annotation-controls"},dv={class:"control-group",title:"颜色"},uv={class:"tool-item color-tool"},hv={class:"control-group line-width-container",title:"线宽"},fv=["onClick"],pv={class:"option-label"},gv=Ue(d.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),l=d.ref(1),a=d.ref(!1),c=d.ref(null),u=d.ref(null),h=d.ref({top:"0px",left:"0px"}),f=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],p=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,A=()=>{i("update:visible",!1)},C=x=>{o.value=x;const g=p();if(g)switch(x){case"freehandLine":g.startFreehandLine();break;case"arrow":g.startArrow();break;case"straightLine":g.startStraightLine();break;case"rectangle":g.startRectangle();break;case"ellipse":g.startEllipse();break}},m=()=>{const x=p();x&&(x.setCurrentColor(r.value),x.changeColor(r.value))},y=()=>{if(!a.value&&c.value){const x=c.value.getBoundingClientRect();h.value={top:`${x.top}px`,left:`${x.right+8}px`}}a.value=!a.value},E=x=>{l.value=x,a.value=!1;const g=p();g&&(g.setCurrentWidth(x),g.changeWidth(x))},I=()=>{const x=p();x&&x.deleteSelectedEntity()},M=()=>{const x=p();x&&x.clearAll()},k=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const x=p();x&&x.saveAnnotations()},S=x=>{const g=x.target,F=c.value&&c.value.contains(g),D=u.value&&u.value.contains(g);!F&&!D&&(a.value=!1)};return d.onMounted(()=>{document.addEventListener("click",S)}),d.onUnmounted(()=>{document.removeEventListener("click",S)}),(x,g)=>(d.openBlock(),d.createBlock(Re,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":g[6]||(g[6]=F=>i("update:visible",F)),onClose:A},{default:d.withCtx(()=>[d.createElementVNode("div",av,[d.createElementVNode("div",lv,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:g[0]||(g[0]=F=>C("freehandLine")),title:"手绘线"},[...g[7]||(g[7]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:g[1]||(g[1]=F=>C("arrow")),title:"箭头"},[...g[8]||(g[8]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:g[2]||(g[2]=F=>C("straightLine")),title:"直线"},[...g[9]||(g[9]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:g[3]||(g[3]=F=>C("rectangle")),title:"矩形"},[...g[10]||(g[10]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:g[4]||(g[4]=F=>C("ellipse")),title:"椭圆"},[...g[11]||(g[11]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),g[13]||(g[13]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",cv,[d.createElementVNode("div",dv,[d.createElementVNode("div",uv,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":g[5]||(g[5]=F=>r.value=F),onChange:m,class:"color-input-overlay"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",hv,[d.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:c,class:"tool-item",onClick:d.withModifiers(y,["stop"])},[d.createElementVNode("div",{class:"current-width-preview",style:d.normalizeStyle({height:l.value+"px",backgroundColor:"#fff"})},null,4)],512),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[a.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"line-width-dropdown",style:d.normalizeStyle(h.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(f,F=>d.createElementVNode("div",{key:F.value,class:d.normalizeClass(["line-width-option",{selected:l.value===F.value}]),onClick:d.withModifiers(D=>E(F.value),["stop"])},[d.createElementVNode("span",pv,d.toDisplayString(F.label),1),d.createElementVNode("div",{class:"line-preview",style:d.normalizeStyle({height:F.value+"px",backgroundColor:l.value===F.value?"#1890ff":"#ddd"})},null,4)],10,fv)),64))],4)):d.createCommentVNode("",!0)]))]),g[12]||(g[12]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("button",{class:"control-btn",onClick:I,title:"删除选中"}," 🗑️ "),d.createElementVNode("button",{class:"control-btn",onClick:M,title:"清空"}," ❌ "),d.createElementVNode("button",{class:"control-btn",onClick:k,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),mv={class:"measure-content"},Av={class:"measure-tools"},yv={key:0,class:"measure-results"},Cv={class:"result-row"},Ev={class:"result-value"},wv={class:"result-row"},bv={class:"result-value"},vv={class:"result-row"},Iv={class:"result-value"},xv={class:"result-row"},Bv={class:"result-value"},Sv={key:1,class:"result-row"},Mv={class:"result-value"},Tv={key:2,class:"result-row"},Dv={class:"result-value"},kv={class:"measure-controls"},Pv={class:"control-group",title:"单位"},Fv={class:"unit-display"},Rv=["onClick"],Ov=Ue(d.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(n,{emit:e}){const t=n,i=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(null),r=d.ref(null),l=d.ref("m"),a=d.ref(!1),c=d.ref(null),u=d.ref(!1),h=d.ref({}),f=d.ref(null),p=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],A=x=>{const g=l.value;return g==="mm"?`${(x*1e3).toFixed(0)}mm`:g==="cm"?`${(x*100).toFixed(1)}cm`:`${x.toFixed(2)}m`},C=x=>x>1e6?`${(x/1e6).toFixed(2)} km²`:`${x.toFixed(2)} m²`,m=()=>{if(!o.value&&s.value?.getViewer){const x=s.value.getViewer(),g=s.value.getCesium();x&&g&&(o.value=new tc({viewer:x,cesium:g}),o.value.setUnit(l.value),o.value.setSnapping(a.value),o.value.onMeasure=F=>{c.value=F})}},y=x=>{o.value||m(),r.value===x?(r.value=null,o.value?.stop()):(r.value=x,o.value?.start(x))},E=x=>{l.value=x,u.value=!1},I=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop())},M=()=>{i("update:visible",!1)},k=x=>{if(u.value){u.value=!1;return}const F=x.currentTarget.getBoundingClientRect();h.value={position:"fixed",top:`${F.top}px`,left:`${F.right+5}px`,zIndex:3e3},u.value=!0},S=x=>{u.value&&f.value&&!f.value.contains(x.target)&&(u.value=!1)};return d.onMounted(()=>{document.addEventListener("click",S),t.visible&&d.nextTick(()=>m())}),d.onUnmounted(()=>{document.removeEventListener("click",S),o.value&&o.value.destroy()}),d.watch(()=>t.visible,x=>{x?d.nextTick(()=>m()):o.value&&(o.value.stop(),r.value=null)}),d.watch(s,x=>{x&&x.getViewer&&!o.value&&t.visible&&m()}),d.watch(l,x=>{o.value&&o.value.setUnit(x)}),(x,g)=>(d.openBlock(),d.createBlock(Re,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":g[3]||(g[3]=F=>i("update:visible",F)),onClose:M},{default:d.withCtx(()=>[d.createElementVNode("div",mv,[d.createElementVNode("div",Av,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:g[0]||(g[0]=F=>y("distance")),title:"距离测量"},[...g[4]||(g[4]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:g[1]||(g[1]=F=>y("angle")),title:"角度测量"},[...g[5]||(g[5]=[d.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:g[2]||(g[2]=F=>y("area")),title:"面积测量"},[...g[6]||(g[6]=[d.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),g[15]||(g[15]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value?(d.openBlock(),d.createElementBlock("div",yv,[c.value.type==="distance"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createElementVNode("div",Cv,[g[7]||(g[7]=d.createElementVNode("span",{class:"result-label"},"总长:",-1)),d.createElementVNode("span",Ev,d.toDisplayString(A(c.value.dist)),1)]),d.createElementVNode("div",wv,[g[8]||(g[8]=d.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),d.createElementVNode("span",bv,d.toDisplayString(A(c.value.dx)),1)]),d.createElementVNode("div",vv,[g[9]||(g[9]=d.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),d.createElementVNode("span",Iv,d.toDisplayString(A(c.value.dy)),1)]),d.createElementVNode("div",xv,[g[10]||(g[10]=d.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),d.createElementVNode("span",Bv,d.toDisplayString(A(c.value.dz)),1)])],64)):d.createCommentVNode("",!0),c.value.type==="angle"?(d.openBlock(),d.createElementBlock("div",Sv,[g[11]||(g[11]=d.createElementVNode("span",{class:"result-label"},"角度:",-1)),d.createElementVNode("span",Mv,d.toDisplayString(c.value.angle.toFixed(1))+"°",1)])):d.createCommentVNode("",!0),c.value.type==="area"?(d.openBlock(),d.createElementBlock("div",Tv,[g[12]||(g[12]=d.createElementVNode("span",{class:"result-label"},"面积:",-1)),d.createElementVNode("span",Dv,d.toDisplayString(C(c.value.area)),1)])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),d.createElementVNode("div",kv,[d.createElementVNode("div",Pv,[d.createElementVNode("div",{class:"tool-item",onClick:d.withModifiers(k,["stop"])},[d.createElementVNode("div",Fv,d.toDisplayString(l.value),1)]),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[u.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:f,class:"unit-dropdown",style:d.normalizeStyle(h.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(p,F=>d.createElementVNode("div",{key:F.value,class:d.normalizeClass(["unit-option",{selected:l.value===F.value}]),onClick:d.withModifiers(D=>E(F.value),["stop"])},d.toDisplayString(F.label),11,Rv)),64))],4)):d.createCommentVNode("",!0)]))]),g[14]||(g[14]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("div",{class:"tool-item control-btn",onClick:I,title:"清空"},[...g[13]||(g[13]=[d.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-b766acb4"]]);function Lv(){const n=d.ref(!1),e=d.reactive({x:0,y:0}),t=d.ref([]),i=d.ref(null);return{visible:n,position:e,items:t,contextData:i,show:(a,c,u)=>{a instanceof MouseEvent?(a.preventDefault(),e.x=a.clientX,e.y=a.clientY):(e.x=a.x,e.y=a.y),t.value=c,i.value=u,n.value=!0},hide:()=>{n.value=!1},addItem:a=>{t.value.push(a)},removeItem:a=>{t.value=t.value.filter(c=>c.id!==a)}}}const Nv=["onClick"],Uv={class:"menu-label"},_v={key:0,class:"menu-arrow"},Qv=Ue(d.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(n,{emit:e}){const t=n,i=e,s=r=>{r.disabled||(r.action&&r.action(),i("action",r),i("update:visible",!1))},o=()=>{t.visible&&i("update:visible",!1)};return d.onMounted(()=>{document.addEventListener("click",o),document.addEventListener("contextmenu",r=>{r.target.closest(".leiting-context-menu")||o()})}),d.onUnmounted(()=>{document.removeEventListener("click",o)}),(r,l)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:"leiting-context-menu",style:d.normalizeStyle({left:n.position.x+"px",top:n.position.y+"px"}),onContextmenu:l[0]||(l[0]=d.withModifiers(()=>{},["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(n.items,a=>(d.openBlock(),d.createElementBlock("div",{key:a.id,class:d.normalizeClass(["menu-item",{"menu-divided":a.divided,"menu-disabled":a.disabled}]),onClick:c=>s(a)},[d.createElementVNode("span",Uv,d.toDisplayString(a.label),1),a.children?(d.openBlock(),d.createElementBlock("span",_v,"▶")):d.createCommentVNode("",!0)],10,Nv))),128))],36)),[[d.vShow,n.visible]])}}),[["__scopeId","data-v-f288753b"]]),Hv={class:"leiting-ui-overlay"},Qi=Ue(d.defineComponent({__name:"LeitingBIM",props:{accessToken:{},cesiumUrl:{},cesiumCssUrl:{},methods:{},viewerOptions:{},treeProps:{},showTree:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!1},playerUrl:{default:"https://leiting.chenxisoft.com/resource/person/person.glb"},playerModelName:{default:"Person"},playerModelId:{default:"player_111"},playerScale:{default:.0032},tiandituToken:{default:"c25f14fb6bd4397cf8fe45144ff768d6"},globe:{type:Boolean,default:void 0},terrain:{type:Boolean,default:void 0},depthTest:{type:Boolean,default:void 0},mapProvider:{},tiandituLayerType:{},tiandituShowLabel:{type:Boolean,default:void 0},arcgisUrl:{},shadows:{type:Boolean,default:void 0},environmentMap:{type:Boolean,default:void 0},ambientOcclusion:{type:Boolean,default:void 0},time:{},brightness:{},backgroundColor:{},collision:{type:Boolean,default:void 0},mouseHabit:{},mode:{default:"3d"},mountAll3Dtiles:{},mountAllCad:{},saveRegion:{},saveCadRegion:{},saveCadCalibration:{},selectionChange:{},searchComponent:{}},emits:["register","init","ready"],setup(n,{emit:e}){const t=d.ref(),i=d.getCurrentInstance(),s=d.ref(!1),o=d.ref(""),r=d.ref({}),l=d.ref("3d"),a=n,c={title:"构件树",treeData:[]},u=d.ref(!1),h=d.ref(!1),f=d.ref(!1),p=d.ref(!1),A=d.ref(!1),C=d.ref(!1),m=d.ref(!1),y=d.ref(!1),E=d.ref(!1),I=d.ref(!1),{visible:M,position:k,items:S,show:x,hide:g}=Lv(),F=d.ref([]),D=Y=>{F.value.push(Y)},P=Y=>{F.value=F.value.filter(j=>j.id!==Y)},L=d.ref([]),G=d.ref(""),N=d.ref(null),b=d.ref([]),w=d.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,annotation:!1}),v=(Y,j)=>{Y==="componentTree"&&(Y="tree"),Y==="componentInfo"&&(Y="info"),Y in w&&(w[Y]=j)},B=d.shallowRef({});d.provide("leitingMethods",B);const R=d.ref(a.showMenu),U=d.ref([]);d.watch(()=>a.showMenu,Y=>{R.value=Y},{immediate:!0}),d.watch(()=>a.mode,Y=>{Y&&B.value?.set2d&&B.value.set2d(Y==="2d")});const O=d.ref("dark");d.provide("leiting-theme",O);const T=d.ref([]),Q=d.computed(()=>{const Y=[];return u.value&&(Y.push("tree"),Y.push("componentTree")),h.value&&Y.push("section"),f.value&&Y.push("roam"),p.value&&(Y.push("info"),Y.push("componentInfo")),A.value&&Y.push("adjust"),C.value&&Y.push("setting"),m.value&&Y.push("cadLayer"),y.value&&Y.push("cadPosition"),E.value&&Y.push("annotation"),I.value&&(Y.push("measure"),Y.push("measurement")),Y.push(...T.value),Y}),V=d.ref(null),$=(Y,j)=>{Y==="componentTree"||Y==="tree"?u.value=j:Y==="section"?h.value=j:Y==="roam"?f.value=j:Y==="componentInfo"||Y==="info"?p.value=j:Y==="homeView"?B.value?.is2dMode?.()?B.value?.flyToTopView?.({}):B.value?.flyToTileset?.({}):Y==="adjustModel"?(A.value=j,j&&V.value&&V.value.setModelType("BIM")):Y==="osgbAdjust"?(A.value=j,j&&V.value&&V.value.setModelType("OSGB")):Y==="setting"?C.value=j:Y==="cadLayer"?m.value=j:Y==="cadPosition"?y.value=j:Y==="annotation"?E.value=j:Y==="measurement"?I.value=j:j?T.value.includes(Y)||T.value.push(Y):T.value=T.value.filter(X=>X!==Y)};d.watch(u,async Y=>{if(Y&&B.value?.loadTreeForModel&&B.value?.getMapTileset){const j=B.value.getMapTileset(),X=Object.values(j).map(async se=>{if(se.leiting&&!se.leiting.tree&&se.leiting.model?.treeUrl){const oe=se.leiting.model.modelId;try{se.leiting?.node?.batchIdEIDInfos||await B.value.loadNodeDetailsForModel(oe);const ae=await B.value.loadTreeForModel(oe);ae&&(Array.isArray(ae)?ae:[ae]).forEach(le=>{le&&!b.value.find(Pe=>Pe.id===le.id)&&(le.modelId=oe,b.value=[...b.value,le])})}catch(ae){console.warn(`Failed to lazy load tree for ${oe}`,ae)}}});await Promise.all(X)}});const J=()=>{B.value&&(B.value.getDxfModels&&(L.value=B.value.getDxfModels()||[]),B.value.getCadModelId&&(G.value=B.value.getCadModelId()||""))};d.watch(m,Y=>{Y&&J()}),d.watch(y,Y=>{Y&&(J(),N.value&&L.value.length&&N.value.addGltfOr3dTilesModelList(L.value))});const ne=e,re=Y=>{B.value&&B.value.saveCadCalibration&&B.value.saveCadCalibration(Y),B.value&&B.value.saveCadRegion&&B.value.saveCadRegion(Y)};return d.onMounted(async()=>{if(t.value)try{const Y={...xt,cesiumUrl:a.cesiumUrl||xt.cesiumUrl,cesiumCssUrl:a.cesiumCssUrl||xt.cesiumCssUrl,accessToken:a.accessToken||ns()||xt.accessToken};await ts(Y);const j=a.accessToken||ns()||xt.accessToken;j&&(Cesium.Ion.defaultAccessToken=j),s.value=!0;const X=(oe={},ae)=>{if(t.value){const{showMenu:Ce,showTree:le,globe:Pe,terrain:ct,depthTest:$e,mapProvider:vt,tiandituLayerType:it,tiandituShowLabel:dn,arcgisUrl:Ut,shadows:_t,environmentMap:Xi,ambientOcclusion:Ke,time:Oe,brightness:st,backgroundColor:dt,collision:Qt,mouseHabit:Ht,mode:It,...Be}=oe||{},Do=a.showMenu!==void 0?a.showMenu:Ce!==void 0?Ce:!0;R.value=Do;const ke=(ee,Ie,Yt)=>ee!==void 0?ee:Ie!==void 0?Ie:Yt,un=ke(a.globe,Pe,!1),hn=ke(a.terrain,ct,!1),$n=ke(a.depthTest,$e,!1),Kn=ke(a.mapProvider,vt,"tianditu"),Xn=ke(a.tiandituLayerType,it,"img_w"),qi=ke(a.tiandituShowLabel,dn,!1),qc=ke(a.arcgisUrl,Ut,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),Jc=ke(a.shadows,_t,!1),Zc=ke(a.environmentMap,Xi,!1),ed=ke(a.ambientOcclusion,Ke,!1),td=ke(a.time,Oe,void 0),nd=ke(a.brightness,st,1),Ji=a.mode||It||"3d";console.log("LeitingBIM Mode:",Ji,"Props:",a.mode,"Options:",It),l.value=Ji;const Gx=Ji==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",id=ke(a.backgroundColor,dt,Gx),sd=ke(a.collision,Qt,!1),od=ke(a.mouseHabit,Ht,0);r.value={globe:un,terrain:hn,depthTest:$n,mapProvider:Kn,tiandituLayerType:Xn,tiandituShowLabel:qi,arcgisUrl:qc,shadows:Jc,environmentMap:Zc,ambientOcclusion:ed,time:td,brightness:nd,backgroundColor:id,collision:sd,mouseHabit:od};const qn=O0({container:t.value,appContext:i?.appContext,methods:{...B.value,handleMenuAction:$,setCardFullHeight:v,onLoadingStatus:ee=>{ee?ge.loading(ee,"",t.value):ge.close()},...Be,tilesLoad3dTiles:async ee=>{let Ie=ee.leiting?.tree;const Yt=ee.leiting?.model?.modelId;if(!Ie&&u.value&&B.value?.loadTreeForModel)try{Ie=await B.value.loadTreeForModel(Yt)}catch(Zn){console.warn("Failed to lazy load tree",Zn)}Ie&&(Array.isArray(Ie)?Ie:[Ie]).forEach(Vt=>{Vt&&!b.value.find(ad=>ad.id===Vt.id)&&(Vt.modelId=Yt,b.value=[...b.value,Vt])});const{brightness:ko,contrast:Po,saturation:ut}=qn.methods.getConfigure();qn.methods.setModelColorAdjustment({brightness:ko,contrast:Po,saturation:ut}),Be.tilesLoad3dTiles?.(ee)},mountAll3Dtiles:ee=>{a.mountAll3Dtiles&&a.mountAll3Dtiles(ee),Be.mountAll3Dtiles?.(ee)},mountAllCad:ee=>{if(qn.methods.setModelBrightness){const Ie=a.brightness!==void 0?a.brightness:r.value.brightness;Ie!==void 0&&qn.methods.setModelBrightness(Ie)}a.mountAllCad&&a.mountAllCad(ee),Be.mountAllCad?.(ee)},saveRegion:ee=>{a.saveRegion&&a.saveRegion(ee),Be.saveRegion?.(ee)},saveCadRegion:ee=>{a.saveCadRegion&&a.saveCadRegion(ee),Be.saveCadRegion?.(ee)},saveCadCalibration:ee=>{a.saveCadCalibration&&a.saveCadCalibration(ee),Be.saveCadCalibration?.(ee)},selectionChange:ee=>{a.selectionChange&&a.selectionChange(ee),Be.selectionChange?.(ee)},onSearchComponent:ee=>{a.searchComponent&&a.searchComponent(ee),Be.searchComponent?.(ee)}},viewerOptions:a.viewerOptions,options:{...Be,mode:Ji,playerUrl:a.playerUrl,playerModelName:a.playerModelName,playerModelId:a.playerModelId,playerScale:a.playerScale,globe:un,terrain:hn,depthTest:$n,mapProvider:Kn,tiandituLayerType:Xn,tiandituShowLabel:qi,tiandituToken:a.tiandituToken,arcgisUrl:qc,shadows:Jc,environmentMap:Zc,ambientOcclusion:ed,time:td,brightness:nd,backgroundColor:id,collision:sd,mouseHabit:od},callbacks:{onLoading:ee=>ee?ge.loading(ee,"",t.value):ge.close(),onSuccess:ee=>ge.success(ee,"",void 0,t.value),onError:ee=>ge.error(ee,"",void 0,t.value)}}),{Cesium:Gt,viewer:fn,methods:Zi,menuEvents:Jn}=qn,ve=Zi;Jn.on("showMenu",ee=>{R.value=ee}),Jn.on("insertMenu",ee=>{U.value=ee}),Jn.on("setMenuActive",(ee,Ie)=>{$(ee,Ie)}),B.value=ve,ae&&(ae.value=ve),Jn.on("setMode",ee=>{l.value=ee}),Jn.on("deleteAllModels",()=>{b.value=[]}),new Gt.ScreenSpaceEventHandler(fn.scene.canvas).setInputAction(ee=>{if(g(),l.value==="2d")return;const Ie=fn.scene.pick(ee.position),Yt=fn.container.getBoundingClientRect(),ko=Yt.left+ee.position.x,Po=Yt.top+ee.position.y,ut=[];if(Gt.defined(Ie)&&Ie instanceof Gt.Cesium3DTileFeature){const Zn=ve.baseCompt.getFeatureId(Ie),Vt=Sn(Ie.tileset);ve.baseCompt.hasSelectedFeaturesMap[Vt]?.some(ei=>ei.batchId===Zn&&ei.rank===0)||(ve.baseCompt.clearSelection(),ve.baseCompt.toggleMultiSelect(Vt,Zn,ve.baseCompt.selectedColor)),ut.push({id:"details",label:"构件详情",action:()=>{p.value=!0}}),ut.push({id:"hide",label:"隐藏选中构件",action:()=>{const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,show:!1}));ve.baseCompt.setComponentVisibility(ti)}}),ut.push({id:"translucent",label:"半透明选中构件",action:()=>{const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,rgba:{...ht.rgba,a:.3}}));ve.baseCompt.setSelectColorUserModelCpt(ti,{rank:0})}}),ut.push({id:"isolate",label:"隔离选中构件",divided:!0,action:()=>{ve.baseCompt.setAllComponentsVisibility(!1);const ti=ve.baseCompt.getSelected().map(ht=>({elementId:ht.elementId,modelId:ht.modelId,show:!0}));ve.baseCompt.setComponentVisibility(ti)}})}ut.push({id:"showAll",label:"显示所有",action:()=>{ve.baseCompt.setAllComponentsVisibility(!0),ve.baseCompt.clearSelection()}}),ut.push(...F.value),x({x:ko,y:Po},ut)},Gt.ScreenSpaceEventType.RIGHT_CLICK),ve.insertContextMenu=D,ve.deleteContextMenu=P,ve.hideContextMenu=g;const rd=oe?.onLoaded||oe?.onloaded;rd&&rd({Cesium:Gt,viewer:fn,methods:Zi}),ne("init",{Cesium:Gt,viewer:fn,methods:Zi}),ne("ready",{Cesium:Gt,viewer:fn,methods:Zi})}};let se=!1;ne("register",(oe,ae)=>{se=!0,X(oe,ae)}),se||setTimeout(()=>{B.value.getViewer||X()},0)}catch(Y){o.value="Failed to load Cesium: "+(Y.message||Y),console.error(Y)}}),(Y,j)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-bim-container",[`theme-${O.value}`]]),onContextmenu:j[11]||(j[11]=d.withModifiers(()=>{},["prevent","stop"]))},[!s.value&&!o.value?(d.openBlock(),d.createBlock(d.unref(me.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):d.createCommentVNode("",!0),o.value?(d.openBlock(),d.createBlock(d.unref(me.Alert),{key:1,class:"error",type:"error",message:o.value,"show-icon":""},null,8,["message"])):d.createCommentVNode("",!0),d.createElementVNode("div",{ref_key:"containerRef",ref:t,class:"cesium-viewer"},[d.createElementVNode("div",Hv,[d.createVNode(Qn,{visible:p.value,"full-height":w.info,"onUpdate:visible":j[0]||(j[0]=X=>p.value=X)},null,8,["visible","full-height"]),d.createVNode(Hn,{ref_key:"LeitingPositionRef",ref:V,visible:A.value,"full-height":w.adjustModel,"onUpdate:visible":j[1]||(j[1]=X=>A.value=X)},null,8,["visible","full-height"]),d.createVNode(Gn,{visible:C.value,"full-height":w.setting,"tianditu-token":a.tiandituToken,"initial-config":r.value,"onUpdate:visible":j[2]||(j[2]=X=>C.value=X)},null,8,["visible","full-height","tianditu-token","initial-config"]),n.showTree!==!1?(d.openBlock(),d.createBlock(Pi,d.mergeProps({key:0},{...c,...n.treeProps},{visible:u.value,"full-height":w.tree,"tree-data":b.value.length>0?b.value:n.treeProps?.treeData||[],"onUpdate:visible":j[3]||(j[3]=X=>{u.value=X})}),null,16,["visible","full-height","tree-data"])):d.createCommentVNode("",!0),d.createVNode(gv,{visible:E.value,"onUpdate:visible":j[4]||(j[4]=X=>E.value=X)},null,8,["visible"]),d.createVNode(Ov,{visible:I.value,"onUpdate:visible":j[5]||(j[5]=X=>I.value=X)},null,8,["visible"]),d.createVNode(Un,{visible:h.value,"full-height":w.section,"onUpdate:visible":j[6]||(j[6]=X=>h.value=X)},null,8,["visible","full-height"]),d.createVNode(_n,{visible:f.value,"full-height":w.roam,"onUpdate:visible":j[7]||(j[7]=X=>f.value=X)},null,8,["visible","full-height"]),d.createVNode(Nn,{visible:R.value,"active-ids":Q.value,"custom-items":U.value,onAction:$,"is-2d":l.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"]),d.createVNode(fb,{visible:m.value,"current-model-id":G.value,"onUpdate:visible":j[8]||(j[8]=X=>m.value=X)},null,8,["visible","current-model-id"]),d.createVNode(rv,{ref_key:"cadPositionRef",ref:N,visible:y.value,"onUpdate:visible":j[9]||(j[9]=X=>y.value=X),onSave:re},null,8,["visible"]),d.createVNode(Qv,{visible:d.unref(M),position:d.unref(k),items:d.unref(S),"onUpdate:visible":j[10]||(j[10]=X=>M.value=X)},null,8,["visible","position","items"]),d.renderSlot(Y.$slots,"default",d.normalizeProps(d.guardReactiveProps({methods:B.value,isReady:s.value})),void 0,!0)])],512)],34))}}),[["__scopeId","data-v-fc733eb3"]]);function pc(n){const e=d.ref(),t=d.ref(n.theme||"dark"),i=d.ref(n.menuSize||"medium");d.provide("leiting-theme",t),d.provide("leiting-menu-size",i);function s(l){d.onUnmounted(()=>{e.value=null}),l(n,e)}function o(){const l=d.unref(e);return l||console.error("未获取到leiting实例!"),l}const r=new Proxy({},{get(l,a){const c=o();if(!c)return;const u=c[a];return typeof u=="function"?u.bind(c):u},set(l,a,c){const u=o();return u?(u[a]=c,!0):!1}});return[s,r]}const Gv=xt,Yv={install:(n,e)=>{if(n.component("LeitingBIM",Qi),n.component("LeitingTree",Pi),n.component("LeitingDraggableCard",Re),n.component("leiting-draggable-card",Re),n.component("LeitingMenu",Nn),n.component("leiting-menu",Nn),n.component("LeitingSection",Un),n.component("leiting-section",Un),n.component("LeitingPlayer",_n),n.component("leiting-player",_n),n.component("LeitingInfo",Qn),n.component("leiting-info",Qn),n.component("LeitingPosition",Hn),n.component("leiting-position",Hn),n.component("LeitingSetting",Gn),n.component("leiting-setting",Gn),!e)return;const t={...Gv,...e};t.cesiumUrl&&ts(t).catch(i=>{console.error("[LeitingBim] Failed to load Cesium resources:",i)}),n.config.globalProperties.$leitingBimOptions=t}};var W={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function gc(n="soft"){switch(n){case"auto":{W.session.styleMap=new Map,W.session.nodeMap=new Map;return}case"soft":{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap,W.computedStyle=new WeakMap,W.baseStyle=new Map,W.defaultStyle=new Map,W.image=new Map,W.background=new Map,W.resource=new Map,W.font=new Set;return}default:{W.session.styleMap=new Map,W.session.nodeMap=new Map,W.session.styleCache=new WeakMap;return}}}function ho(n){const e=n.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const t=e[2].trim();return t.startsWith("#")?null:t}function Vv(n){if(!n||n==="none")return"";let e=n.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(t,i)=>{const s=i.split(",").map(o=>o.trim());return s.length!==6?`matrix(${i})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(t,i)=>{const s=i.split(",").map(o=>o.trim());return s.length!==16?`matrix3d(${i})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function Hi(n){if(/%[0-9A-Fa-f]{2}/.test(n))return n;try{return encodeURI(n)}catch{return n}}function Wv(n="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:t=12}={}){const i=new Map;let s=0;function o(r,l,a){if(s>=t)return;const c=Date.now();(i.get(l)||0)>c||(i.set(l,c+e),s++,r==="warn"&&console&&console.warn?console.warn(`${n} ${a}`):console&&console.error&&console.error(`${n} ${a}`))}return{warnOnce(r,l){o("warn",r,l)},errorOnce(r,l){o("error",r,l)},reset(){i.clear(),s=0}}}var mc=Wv("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),fo=new Map,Gi=new Map;function zv(n){return/^data:|^blob:|^about:blank$/i.test(n)}function jv(n,e){try{const t=typeof location<"u"&&location.href?location.href:"http://localhost/",i=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(i||".",t),o=new URL(n,t);if(o.origin===s.origin)return!0;const r=o.searchParams;if(r&&(r.has("url")||r.has("target")))return!0}catch{}return!1}function $v(n,e){if(!e||zv(n)||jv(n,e))return!1;try{const t=typeof location<"u"&&location.href?location.href:"http://localhost/",i=new URL(n,t);return typeof location<"u"?i.origin!==location.origin:!0}catch{return!!e}}function Kv(n,e){if(!e)return n;if(e.includes("{url}"))return e.replace("{urlRaw}",Hi(n)).replace("{url}",encodeURIComponent(n));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(n)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(n)}`;if(e.endsWith("/"))return`${e}${Hi(n)}`;const t=e.includes("?")?"&":"?";return`${e}${t}url=${encodeURIComponent(n)}`}function Ac(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(String(i.result||"")),i.onerror=()=>t(new Error("read_failed")),i.readAsDataURL(n)})}function Xv(n,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,n].join("|")}async function je(n,e={}){const t=e.as??"blob",i=e.timeout??3e3,s=e.useProxy||"",o=e.errorTTL??8e3,r=e.headers||{},l=!!e.silent;if(/^data:/i.test(n))try{if(t==="text")return{ok:!0,data:String(n),status:200,url:n,fromCache:!1};if(t==="dataURL")return{ok:!0,data:String(n),status:200,url:n,fromCache:!1,mime:String(n).slice(5).split(";")[0]||""};const[,m="",y=""]=String(n).match(/^data:([^,]*),(.*)$/)||[],I=/;base64/i.test(m)?atob(y):decodeURIComponent(y),M=new Uint8Array([...I].map(S=>S.charCodeAt(0))),k=new Blob([M],{type:(m||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:n,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:n,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(n))try{const m=await fetch(n);if(!m.ok)return{ok:!1,data:null,status:m.status,url:n,fromCache:!1,reason:"http_error"};const y=await m.blob(),E=y.type||m.headers.get("content-type")||"";return t==="dataURL"?{ok:!0,data:await Ac(y),status:m.status,url:n,fromCache:!1,mime:E}:t==="text"?{ok:!0,data:await y.text(),status:m.status,url:n,fromCache:!1,mime:E}:{ok:!0,data:y,status:m.status,url:n,fromCache:!1,mime:E}}catch{return{ok:!1,data:null,status:0,url:n,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(n))return t==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:n,fromCache:!1,mime:"image/png"}:{ok:!0,data:t==="text"?"":new Blob([]),status:200,url:n,fromCache:!1};const a=Xv(n,{as:t,timeout:i,useProxy:s,errorTTL:o}),c=Gi.get(a);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&Gi.delete(a);const u=fo.get(a);if(u)return u;const h=$v(n,s)?Kv(n,s):n;let f=e.credentials;if(!f)try{const m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(n,m);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}const p=new AbortController,A=setTimeout(()=>p.abort("timeout"),i),C=(async()=>{try{const m=await fetch(h,{signal:p.signal,credentials:f,headers:r});if(!m.ok){const I={ok:!1,data:null,status:m.status,url:h,fromCache:!1,reason:"http_error"};if(o>0&&Gi.set(a,{until:Date.now()+o,result:I}),!l){const M=`${m.status} ${m.statusText||""}`.trim();mc.warnOnce(`http:${m.status}:${t}:${new URL(n,location?.href??"http://localhost/").origin}`,`HTTP error ${M} while fetching ${t} ${n}`)}return e.onError&&e.onError(I),I}if(t==="text")return{ok:!0,data:await m.text(),status:m.status,url:h,fromCache:!1};const y=await m.blob(),E=y.type||m.headers.get("content-type")||"";return t==="dataURL"?{ok:!0,data:await Ac(y),status:m.status,url:h,fromCache:!1,mime:E}:{ok:!0,data:y,status:m.status,url:h,fromCache:!1,mime:E}}catch(m){const y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.message||"").includes("timeout")?"timeout":"abort":"network",E={ok:!1,data:null,status:0,url:h,fromCache:!1,reason:y};if(!/^blob:/i.test(n)&&o>0&&Gi.set(a,{until:Date.now()+o,result:E}),!l){const I=`${y}:${t}:${new URL(n,location?.href??"http://localhost/").origin}`,M=y==="timeout"?`Timeout after ${i}ms. Consider increasing timeout or using a proxy for ${n}`:y==="abort"?`Request aborted while fetching ${t} ${n}`:`Network/CORS issue while fetching ${t} ${n}. A proxy may be required`;mc.errorOnce(I,M)}return e.onError&&e.onError(E),E}finally{clearTimeout(A),fo.delete(a)}})();return fo.set(a,C),C}function po(n,e){if(!e||!n.width||!n.height)return n;const t=document.createElement("canvas");t.width=n.width,t.height=n.height;const i=t.getContext("2d");return i.fillStyle=e,i.fillRect(0,0,t.width,t.height),i.drawImage(n,0,0),t}async function go(n,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(n)||n.trim()==="none")return n;const i=ho(n);if(!i)return n;const s=Hi(i);if(W.background.has(s)){const o=W.background.get(s);return o?`url("${o}")`:"none"}try{const o=await je(s,{as:"dataURL",useProxy:e.useProxy});return o.ok?(W.background.set(s,o.data),`url("${o.data}")`):(W.background.set(s,null),"none")}catch{return W.background.set(s,null),"none"}}var yc=new Set(["meta","script","noscript","title","link","template"]),Yi=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),qv=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function Jv(){for(let n of qv){const e=String(n).toLowerCase();yc.has(e)||Yi.has(e)||Cc(e)}}function Cc(n){if(n=String(n).toLowerCase(),Yi.has(n)){const o={};return W.defaultStyle.set(n,o),o}if(W.defaultStyle.has(n))return W.defaultStyle.get(n);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));const t=document.createElement(n);t.style.all="initial",e.appendChild(t);const i=getComputedStyle(t),s={};for(let o of i){if(Ec(o))continue;const r=i.getPropertyValue(o);s[o]=r}return e.removeChild(t),W.defaultStyle.set(n,s),s}var Zv=/(?:^|-)(animation|transition)(?:-|$)/i,eI=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,tI=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function Ec(n){const e=String(n).toLowerCase();return!!(tI.has(e)||eI.test(e)||Zv.test(e))}function mo(n,e){if(e=String(e||"").toLowerCase(),Yi.has(e))return"";const t=[],i=Cc(e);for(let[s,o]of Object.entries(n)){if(Ec(s))continue;const r=i[s];o&&o!==r&&t.push(`${s}:${o}`)}return t.sort(),t.join(";")}function nI(n){const e=new Set;return n.nodeType!==Node.ELEMENT_NODE&&n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(n.tagName&&e.add(n.tagName.toLowerCase()),typeof n.querySelectorAll=="function"&&n.querySelectorAll("*").forEach(t=>e.add(t.tagName.toLowerCase())),Array.from(e))}function iI(n){const e=new Map;for(let i of n){const s=W.defaultStyle.get(i);if(!s)continue;const o=Object.entries(s).map(([r,l])=>`${r}:${l};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(i))}let t="";for(let[i,s]of e.entries())t+=`${s.join(",")} { ${i} }
118
+ `;return t}function sI(n){const e=Array.from(new Set(n.values())).filter(Boolean).sort(),t=new Map;let i=1;for(const s of e)t.set(s,`c${i++}`);return t}function Ao(n,e=null){if(!(n instanceof Element))return window.getComputedStyle(n,e);let t=W.computedStyle.get(n);if(t||(t=new Map,W.computedStyle.set(n,t)),!t.has(e)){const i=window.getComputedStyle(n,e);t.set(e,i)}return t.get(e)}function wc(n){const e={};for(let t of n)e[t]=n.getPropertyValue(t);return e}function yo(n){const e=[];let t=0,i=0;for(let s=0;s<n.length;s++){const o=n[s];o==="("&&t++,o===")"&&t--,o===","&&t===0&&(e.push(n.slice(i,s).trim()),i=s+1)}return e.push(n.slice(i).trim()),e}function ln(n,{fast:e=!1}={}){if(e)return n();"requestIdleCallback"in window?requestIdleCallback(n,{timeout:50}):setTimeout(n,1)}function nt(){const n=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(n),t=/AppleWebKit/i.test(n)&&/Mobile/i.test(n)&&!/Safari/i.test(n),i=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(n);return e||t||i}var bc=new WeakMap,Co=new Map,Eo=0;function Yn(){Eo++}var vc=!1;function oI(n=document.documentElement){if(!vc){vc=!0;try{new MutationObserver(()=>Yn()).observe(n,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Yn()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const e=document.fonts;e&&(e.addEventListener?.("loadingdone",Yn),e.ready?.then(()=>Yn()).catch(()=>{}))}catch{}}}function rI(n,e={}){const t={},i=n.getPropertyValue("visibility");for(let s=0;s<n.length;s++){const o=n[s];let r=n.getPropertyValue(o);(o==="background-image"||o==="content")&&r.includes("url(")&&!r.includes("data:")&&(r="none"),t[o]=r}if(e.embedFonts){const s=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const o of s)if(!t[o])try{const r=n.getPropertyValue(o);r&&(t[o]=r)}catch{}}return i==="hidden"&&(t.opacity="0"),t}var Ic=new WeakMap;function aI(n){let e=Ic.get(n);return e||(e=Object.entries(n).sort((i,s)=>i[0]<s[0]?-1:i[0]>s[0]?1:0).map(([i,s])=>`${i}:${s}`).join(";"),Ic.set(n,e),e)}function lI(n,e=null,t={}){const i=bc.get(n);if(i&&i.epoch===Eo)return i.snapshot;const s=e||getComputedStyle(n),o=rI(s,t);return pI(n,s,o),bc.set(n,{epoch:Eo,snapshot:o}),o}function cI(n,e){return n&&n.session&&n.persist?n:n&&(n.styleMap||n.styleCache||n.nodeMap)?{session:n,persist:{snapshotKeyCache:Co,defaultStyle:W.defaultStyle,baseStyle:W.baseStyle,image:W.image,resource:W.resource,background:W.background,font:W.font},options:e||{}}:{session:W.session,persist:{snapshotKeyCache:Co,defaultStyle:W.defaultStyle,baseStyle:W.baseStyle,image:W.image,resource:W.resource,background:W.background,font:W.font},options:n||e||{}}}async function cn(n,e,t,i){if(n.tagName==="STYLE")return;const s=cI(t,i),o=s.options&&s.options.cache||"auto";if(o!=="disabled"&&oI(document.documentElement),o==="disabled"&&!s.session.__bumpedForDisabled&&(Yn(),Co.clear(),s.session.__bumpedForDisabled=!0),Yi.has(n.tagName?.toLowerCase())){const f=n.getAttribute?.("style");f&&e.setAttribute("style",f)}const{session:r,persist:l}=s;r.styleCache.has(n)||r.styleCache.set(n,getComputedStyle(n));const a=r.styleCache.get(n),c=lI(n,a,s.options),u=aI(c);let h=l.snapshotKeyCache.get(u);if(!h){const f=n.tagName?.toLowerCase()||"div";h=mo(c,f),l.snapshotKeyCache.set(u,h)}r.styleMap.set(e,h)}function dI(n){return n instanceof HTMLImageElement||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof HTMLIFrameElement||n instanceof SVGElement||n instanceof HTMLObjectElement||n instanceof HTMLEmbedElement}function uI(n){return n.backgroundImage&&n.backgroundImage!=="none"||n.backgroundColor&&n.backgroundColor!=="rgba(0, 0, 0, 0)"&&n.backgroundColor!=="transparent"||(parseFloat(n.borderTopWidth)||0)>0||(parseFloat(n.borderBottomWidth)||0)>0||(parseFloat(n.paddingTop)||0)>0||(parseFloat(n.paddingBottom)||0)>0?!0:(n.overflowBlock||n.overflowY||"visible")!=="visible"}function hI(n){const e=n.parentElement;if(!e)return!1;const t=getComputedStyle(e).display||"";return t.includes("flex")||t.includes("grid")}function fI(n,e){if(n.textContent&&/\S/.test(n.textContent))return!0;const t=n.firstElementChild,i=n.lastElementChild;if(t&&t.tagName==="BR"||i&&i.tagName==="BR")return!0;const s=n.scrollHeight;if(s===0)return!1;const o=parseFloat(e.paddingTop)||0,r=parseFloat(e.paddingBottom)||0;return s>o+r}function pI(n,e,t){if(n instanceof HTMLElement&&n.style&&n.style.height)return;const i=e.display||"";if(i.includes("flex")||i.includes("grid")||dI(n))return;const s=e.position;s==="absolute"||s==="fixed"||s==="sticky"||e.transform==="none"&&(uI(e)||hI(n)||fI(n,e)&&(delete t.height,delete t["block-size"]))}function gI(n,e){if(!(n instanceof Element)||!(e instanceof Element))return;const t=n.getAttribute?.("style");let i=!!(t&&t.includes("var("));if(!i&&n.attributes?.length){const r=n.attributes;for(let l=0;l<r.length;l++){const a=r[l];if(a&&typeof a.value=="string"&&a.value.includes("var(")){i=!0;break}}}if(!i)return;let s;try{s=getComputedStyle(n)}catch{return}const o=n.style;if(o&&o.length)for(let r=0;r<o.length;r++){const l=o[r],a=o.getPropertyValue(l);if(!a||!a.includes("var("))continue;const c=s.getPropertyValue(l);if(c)try{e.style.setProperty(l,c.trim(),o.getPropertyPriority(l))}catch{}}if(n.attributes?.length){const r=n.attributes;for(let l=0;l<r.length;l++){const a=r[l];if(!a||typeof a.value!="string"||!a.value.includes("var("))continue;const c=a.name;let u="";try{u=s.getPropertyValue(c)}catch{}if(u)try{e.style.setProperty(c,u.trim())}catch{}}}}function wo(n,e,t){return Promise.all(n.map(i=>new Promise(s=>{function o(){ln(r=>{(r&&typeof r.timeRemaining=="function"?r.timeRemaining()>0:!0)?e(i,s):o()},{fast:t})}o()})))}function mI(n){return n=n.trim(),!n||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(n)?n:`${n}:not([data-sd-slotted])`}function AI(n,e,t=!0){return n.split(",").map(i=>i.trim()).filter(Boolean).map(i=>{if(i.startsWith(":where(")||i.startsWith("@"))return i;const s=t?mI(i):i;return`:where(${e} ${s})`}).join(", ")}function yI(n,e){return n?(n=n.replace(/:host\(([^)]+)\)/g,(t,i)=>`:where(${e}:is(${i.trim()}))`),n=n.replace(/:host\b/g,`:where(${e})`),n=n.replace(/:host-context\(([^)]+)\)/g,(t,i)=>`:where(:where(${i.trim()}) ${e})`),n=n.replace(/::slotted\(([^)]+)\)/g,(t,i)=>`:where(${e} ${i.trim()})`),n=n.replace(/(^|})(\s*)([^@}{]+){/g,(t,i,s,o)=>{const r=AI(o,e,!0);return`${i}${s}${r}{`}),n):""}function CI(n){return n.shadowScopeSeq=(n.shadowScopeSeq||0)+1,`s${n.shadowScopeSeq}`}function EI(n){let e="";try{n.querySelectorAll("style").forEach(i=>{e+=(i.textContent||"")+`
119
119
  `});const t=n.adoptedStyleSheets||[];for(const i of t)try{if(i&&i.cssRules)for(const s of i.cssRules)e+=s.cssText+`
120
- `}catch{}}catch{}return e}function yx(n,e,t){if(!e)return;const i=document.createElement("style");i.setAttribute("data-sd",t),i.textContent=e,n.insertBefore(i,n.firstChild||null)}function Cx(n,e){try{const t=n.currentSrc||n.src||"";if(!t)return;e.setAttribute("src",t),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function Ex(n){const e=new Set;if(!n)return e;const t=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let i;for(;i=t.exec(n);)e.add(i[1]);return e}function wx(n,e){try{let i=getComputedStyle(n).getPropertyValue(e).trim();if(i)return i}catch{}try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(i)return i}catch{}return""}function bx(n,e,t){const i=[];for(const s of e){const o=wx(n,s);o&&i.push(`${s}: ${o};`)}return i.length?`${t}{${i.join("")}}
121
- `:""}function vx(n){n&&(n.nodeType===Node.ELEMENT_NODE&&n.setAttribute("data-sd-slotted",""),n.querySelectorAll&&n.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function xx(n,e=3){const t=()=>{try{return n.contentDocument||n.contentWindow?.document||null}catch{return null}};let i=t(),s=0;for(;s<e&&(!i||!i.body&&!i.documentElement);)await new Promise(o=>setTimeout(o,0)),i=t(),s++;return i&&(i.body||i.documentElement)?i:null}function Ix(n){const e=n.getBoundingClientRect();let t=0,i=0,s=0,o=0;try{const a=getComputedStyle(n);t=parseFloat(a.borderLeftWidth)||0,i=parseFloat(a.borderRightWidth)||0,s=parseFloat(a.borderTopWidth)||0,o=parseFloat(a.borderBottomWidth)||0}catch{}const r=Math.max(0,Math.round(e.width-(t+i))),l=Math.max(0,Math.round(e.height-(s+o)));return{contentWidth:r,contentHeight:l,rect:e}}function Bx(n,e,t){const i=n.createElement("style");return i.setAttribute("data-sd-iframe-pin",""),i.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${t}px !important;min-width: ${e}px !important;min-height: ${t}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(n.head||n.documentElement).appendChild(i),()=>{try{i.remove()}catch{}}}async function Sx(n,e,t){const i=await xx(n,3);if(!i)throw new Error("iframe document not accessible/ready");const{contentWidth:s,contentHeight:o,rect:r}=Ix(n),l=t?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");const a={...t,scale:1},c=Bx(i,s,o);let u;try{u=await l.toPng(i.documentElement,a)}finally{c()}u.style.display="block",u.style.width=`${s}px`,u.style.height=`${o}px`;const h=document.createElement("div");return e.nodeMap.set(h,n),cn(n,h,e,t),h.style.overflow="hidden",h.style.display="block",h.style.width||(h.style.width=`${Math.round(r.width)}px`),h.style.height||(h.style.height=`${Math.round(r.height)}px`),h.appendChild(u),h}async function Vi(n,e,t){if(!n)throw new Error("Invalid node");const i=new Set;let s=null,o=null;if(n.nodeType===Node.ELEMENT_NODE){const c=(n.localName||n.tagName||"").toLowerCase();if(n.id==="snapdom-sandbox"||n.hasAttribute("data-snapdom-sandbox")||yc.has(c))return null}if(n.nodeType===Node.TEXT_NODE||n.nodeType!==Node.ELEMENT_NODE)return n.cloneNode(!0);if(n.getAttribute("data-capture")==="exclude"){if(t.excludeMode==="hide"){const c=document.createElement("div"),u=n.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(t.excludeMode==="remove")return null}if(t.exclude&&Array.isArray(t.exclude))for(const c of t.exclude)try{if(n.matches?.(c)){if(t.excludeMode==="hide"){const u=document.createElement("div"),h=n.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${h.width}px;height:${h.height}px;visibility:hidden;`,u}else if(t.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof t.filter=="function")try{if(!t.filter(n)){if(t.filterMode==="hide"){const c=document.createElement("div"),u=n.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(t.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(n.tagName==="IFRAME"){let c=!1;try{c=!!(n.contentDocument||n.contentWindow?.document)}catch{c=!1}if(c)try{return await Sx(n,e,t)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(t.placeholders){const u=document.createElement("div");return u.style.cssText=`width:${n.offsetWidth}px;height:${n.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,cn(n,u,e,t),u}else{const u=n.getBoundingClientRect(),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,cn(n,h,e,t),h}}if(n.getAttribute("data-capture")==="placeholder"){const c=n.cloneNode(!1);e.nodeMap.set(c,n),cn(n,c,e,t);const u=document.createElement("div");return u.textContent=n.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(u),c}if(n.tagName==="CANVAS"){const c=n.toDataURL(),u=document.createElement("img");return u.src=c,u.width=n.width,u.height=n.height,e.nodeMap.set(u,n),cn(n,u,e,t),u}let r;try{if(r=n.cloneNode(!1),hx(n,r),e.nodeMap.set(r,n),n.tagName==="IMG"){Cx(n,r);try{const c=n.getBoundingClientRect();let u=Math.round(c.width||0),h=Math.round(c.height||0);if(!u||!h){const f=window.getComputedStyle(n),p=parseFloat(f.width)||0,A=parseFloat(f.height)||0,C=parseInt(n.getAttribute("width")||"",10)||0,m=parseInt(n.getAttribute("height")||"",10)||0,y=n.width||n.naturalWidth||0,E=n.height||n.naturalHeight||0;u=Math.round(u||p||C||y||0),h=Math.round(h||A||m||E||0)}u&&(r.dataset.snapdomWidth=String(u)),h&&(r.dataset.snapdomHeight=String(h))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",n,c),c}if(n instanceof HTMLTextAreaElement){const c=n.getBoundingClientRect();r.style.width=`${c.width}px`,r.style.height=`${c.height}px`}if(n instanceof HTMLInputElement&&(r.value=n.value,r.setAttribute("value",n.value),n.checked!==void 0&&(r.checked=n.checked,n.checked&&r.setAttribute("checked",""),n.indeterminate&&(r.indeterminate=n.indeterminate))),n instanceof HTMLSelectElement&&(s=n.value),n instanceof HTMLTextAreaElement&&(o=n.value),cn(n,r,e,t),n.shadowRoot){let c=function(E,x){if(E.nodeType===Node.ELEMENT_NODE&&E.tagName==="STYLE")return x(null);Vi(E,e,t).then(M=>{x(M||null)}).catch(()=>{x(null)})};try{const E=n.shadowRoot.querySelectorAll("slot");for(const x of E){let M=[];try{M=x.assignedNodes?.({flatten:!0})||x.assignedNodes?.()||[]}catch{M=x.assignedNodes?.()||[]}for(const T of M)i.add(T)}}catch{}const u=mx(e),h=`[data-sd="${u}"]`;try{r.setAttribute("data-sd",u)}catch{}const f=Ax(n.shadowRoot),p=gx(f,h),A=Ex(f),C=bx(n,A,h);yx(r,C+p,u);const m=document.createDocumentFragment(),y=await wo(Array.from(n.shadowRoot.childNodes),c,t.fast);m.append(...y.filter(E=>!!E)),r.appendChild(m)}if(n.tagName==="SLOT"){let c=function(A,C){Vi(A,e,t).then(m=>{m&&vx(m),C(m||null)}).catch(()=>{C(null)})};const u=n.assignedNodes?.({flatten:!0})||[],h=u.length>0?u:Array.from(n.childNodes),f=document.createDocumentFragment(),p=await wo(Array.from(h),c,t.fast);return f.append(...p.filter(A=>!!A)),f}function l(c,u){if(i.has(c))return u(null);Vi(c,e,t).then(h=>{u(h||null)}).catch(()=>{u(null)})}const a=await wo(Array.from(n.childNodes),l,t.fast);if(r.append(...a.filter(c=>!!c)),s!==null&&r instanceof HTMLSelectElement){r.value=s;for(const c of r.options)c.value===s?c.setAttribute("selected",""):c.removeAttribute("selected")}return o!==null&&r instanceof HTMLTextAreaElement&&(r.textContent=o),r}var Mx=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],bo=[];function Tx(n){const e=Array.isArray(n)?n:[n];for(const t of e)t instanceof RegExp?bo.push(t):typeof t=="string"?bo.push(new RegExp(t,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",t)}function lt(n){const e=typeof n=="string"?n:"",t=[...Mx,...bo];for(const i of t)if(i instanceof RegExp&&i.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Dx(n,e,t,i=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const r=document.createElement("span");r.textContent=n,r.style.position="absolute",r.style.visibility="hidden",r.style.fontFamily=`"${e}"`,r.style.fontWeight=t||"normal",r.style.fontSize=`${i}px`,r.style.lineHeight="1",r.style.whiteSpace="nowrap",r.style.padding="0",r.style.margin="0",document.body.appendChild(r);const l=r.getBoundingClientRect(),a=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(r);const u=document.createElement("canvas");u.width=Math.max(1,a*o),u.height=Math.max(1,c*o);const h=u.getContext("2d");return h.scale(o,o),h.font=t?`${t} ${i}px "${e}"`:`${i}px "${e}"`,h.textAlign="left",h.textBaseline="top",h.fillStyle=s,h.fillText(n,0,0),{dataUrl:u.toDataURL(),width:a,height:c}}var kx=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Wi(n){if(!n)return"";for(let e of n.split(",")){let t=e.trim().replace(/^['"]+|['"]+$/g,"");if(t&&!kx.has(t.toLowerCase()))return t}return""}function zi(n){const e=String(n??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;const t=parseInt(e,10);return Number.isFinite(t)?Math.min(900,Math.max(100,t)):400}function vo(n){const e=String(n??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Px(n){const e=String(n??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Fx(n){const e=String(n||"400").trim(),t=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(t){const s=zi(t[1]),o=zi(t[2]);return{min:Math.min(s,o),max:Math.max(s,o)}}const i=zi(e);return{min:i,max:i}}function Rx(n){const e=String(n||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Ox(n){const e=String(n||"100%").trim(),t=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(t){const o=parseFloat(t[1]),r=parseFloat(t[2]);return{min:Math.min(o,r),max:Math.max(o,r)}}const i=e.match(/(\d+(?:\.\d+)?)\s*%/),s=i?parseFloat(i[1]):100;return{min:s,max:s}}function Lx(n,e){if(!n)return!1;try{const t=new URL(n,location.href);if(t.origin===location.origin)return!0;const s=t.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>s.endsWith(l)))return!0;const r=(t.pathname+t.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(const l of e){const a=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(r.includes(a)||r.includes(c))return!0}return!1}catch{return!1}}function Nx(n){const e=new Set;for(const t of n||[]){const i=String(t).split("__")[0]?.trim();i&&e.add(i)}return e}function Ic(n,e){return n&&n.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(t,i,s)=>{const o=(s||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return t;let r=o;try{r=new URL(o,e||location.href).href}catch{}return`url("${r}")`})}var xo=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,ji=4;async function Ux(n,e,t){if(!n)return n;const i=new Set;function s(l,a){try{return new URL(l,a||location.href).href}catch{return l}}async function o(l,a,c=0){if(c>ji)return console.warn(`[snapDOM] @import depth exceeded (${ji}) at ${a}`),l;let u="",h=0,f;for(;f=xo.exec(l);){u+=l.slice(h,f.index),h=xo.lastIndex;const p=(f[2]||f[4]||"").trim(),A=s(p,a);if(i.has(A)){console.warn(`[snapDOM] Skipping circular @import: ${A}`);continue}i.add(A);let C="";try{const m=await je(A,{as:"text",useProxy:t,silent:!0});m.ok&&typeof m.data=="string"&&(C=m.data)}catch{}C?(C=Ic(C,A),C=await o(C,A,c+1),u+=`
120
+ `}catch{}}catch{}return e}function wI(n,e,t){if(!e)return;const i=document.createElement("style");i.setAttribute("data-sd",t),i.textContent=e,n.insertBefore(i,n.firstChild||null)}function bI(n,e){try{const t=n.currentSrc||n.src||"";if(!t)return;e.setAttribute("src",t),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function vI(n){const e=new Set;if(!n)return e;const t=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let i;for(;i=t.exec(n);)e.add(i[1]);return e}function II(n,e){try{let i=getComputedStyle(n).getPropertyValue(e).trim();if(i)return i}catch{}try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(i)return i}catch{}return""}function xI(n,e,t){const i=[];for(const s of e){const o=II(n,s);o&&i.push(`${s}: ${o};`)}return i.length?`${t}{${i.join("")}}
121
+ `:""}function BI(n){n&&(n.nodeType===Node.ELEMENT_NODE&&n.setAttribute("data-sd-slotted",""),n.querySelectorAll&&n.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function SI(n,e=3){const t=()=>{try{return n.contentDocument||n.contentWindow?.document||null}catch{return null}};let i=t(),s=0;for(;s<e&&(!i||!i.body&&!i.documentElement);)await new Promise(o=>setTimeout(o,0)),i=t(),s++;return i&&(i.body||i.documentElement)?i:null}function MI(n){const e=n.getBoundingClientRect();let t=0,i=0,s=0,o=0;try{const a=getComputedStyle(n);t=parseFloat(a.borderLeftWidth)||0,i=parseFloat(a.borderRightWidth)||0,s=parseFloat(a.borderTopWidth)||0,o=parseFloat(a.borderBottomWidth)||0}catch{}const r=Math.max(0,Math.round(e.width-(t+i))),l=Math.max(0,Math.round(e.height-(s+o)));return{contentWidth:r,contentHeight:l,rect:e}}function TI(n,e,t){const i=n.createElement("style");return i.setAttribute("data-sd-iframe-pin",""),i.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${t}px !important;min-width: ${e}px !important;min-height: ${t}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(n.head||n.documentElement).appendChild(i),()=>{try{i.remove()}catch{}}}async function DI(n,e,t){const i=await SI(n,3);if(!i)throw new Error("iframe document not accessible/ready");const{contentWidth:s,contentHeight:o,rect:r}=MI(n),l=t?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");const a={...t,scale:1},c=TI(i,s,o);let u;try{u=await l.toPng(i.documentElement,a)}finally{c()}u.style.display="block",u.style.width=`${s}px`,u.style.height=`${o}px`;const h=document.createElement("div");return e.nodeMap.set(h,n),cn(n,h,e,t),h.style.overflow="hidden",h.style.display="block",h.style.width||(h.style.width=`${Math.round(r.width)}px`),h.style.height||(h.style.height=`${Math.round(r.height)}px`),h.appendChild(u),h}async function Vi(n,e,t){if(!n)throw new Error("Invalid node");const i=new Set;let s=null,o=null;if(n.nodeType===Node.ELEMENT_NODE){const c=(n.localName||n.tagName||"").toLowerCase();if(n.id==="snapdom-sandbox"||n.hasAttribute("data-snapdom-sandbox")||yc.has(c))return null}if(n.nodeType===Node.TEXT_NODE||n.nodeType!==Node.ELEMENT_NODE)return n.cloneNode(!0);if(n.getAttribute("data-capture")==="exclude"){if(t.excludeMode==="hide"){const c=document.createElement("div"),u=n.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(t.excludeMode==="remove")return null}if(t.exclude&&Array.isArray(t.exclude))for(const c of t.exclude)try{if(n.matches?.(c)){if(t.excludeMode==="hide"){const u=document.createElement("div"),h=n.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${h.width}px;height:${h.height}px;visibility:hidden;`,u}else if(t.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof t.filter=="function")try{if(!t.filter(n)){if(t.filterMode==="hide"){const c=document.createElement("div"),u=n.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(t.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(n.tagName==="IFRAME"){let c=!1;try{c=!!(n.contentDocument||n.contentWindow?.document)}catch{c=!1}if(c)try{return await DI(n,e,t)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(t.placeholders){const u=document.createElement("div");return u.style.cssText=`width:${n.offsetWidth}px;height:${n.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,cn(n,u,e,t),u}else{const u=n.getBoundingClientRect(),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,cn(n,h,e,t),h}}if(n.getAttribute("data-capture")==="placeholder"){const c=n.cloneNode(!1);e.nodeMap.set(c,n),cn(n,c,e,t);const u=document.createElement("div");return u.textContent=n.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(u),c}if(n.tagName==="CANVAS"){const c=n.toDataURL(),u=document.createElement("img");return u.src=c,u.width=n.width,u.height=n.height,e.nodeMap.set(u,n),cn(n,u,e,t),u}let r;try{if(r=n.cloneNode(!1),gI(n,r),e.nodeMap.set(r,n),n.tagName==="IMG"){bI(n,r);try{const c=n.getBoundingClientRect();let u=Math.round(c.width||0),h=Math.round(c.height||0);if(!u||!h){const f=window.getComputedStyle(n),p=parseFloat(f.width)||0,A=parseFloat(f.height)||0,C=parseInt(n.getAttribute("width")||"",10)||0,m=parseInt(n.getAttribute("height")||"",10)||0,y=n.width||n.naturalWidth||0,E=n.height||n.naturalHeight||0;u=Math.round(u||p||C||y||0),h=Math.round(h||A||m||E||0)}u&&(r.dataset.snapdomWidth=String(u)),h&&(r.dataset.snapdomHeight=String(h))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",n,c),c}if(n instanceof HTMLTextAreaElement){const c=n.getBoundingClientRect();r.style.width=`${c.width}px`,r.style.height=`${c.height}px`}if(n instanceof HTMLInputElement&&(r.value=n.value,r.setAttribute("value",n.value),n.checked!==void 0&&(r.checked=n.checked,n.checked&&r.setAttribute("checked",""),n.indeterminate&&(r.indeterminate=n.indeterminate))),n instanceof HTMLSelectElement&&(s=n.value),n instanceof HTMLTextAreaElement&&(o=n.value),cn(n,r,e,t),n.shadowRoot){let c=function(E,I){if(E.nodeType===Node.ELEMENT_NODE&&E.tagName==="STYLE")return I(null);Vi(E,e,t).then(M=>{I(M||null)}).catch(()=>{I(null)})};try{const E=n.shadowRoot.querySelectorAll("slot");for(const I of E){let M=[];try{M=I.assignedNodes?.({flatten:!0})||I.assignedNodes?.()||[]}catch{M=I.assignedNodes?.()||[]}for(const k of M)i.add(k)}}catch{}const u=CI(e),h=`[data-sd="${u}"]`;try{r.setAttribute("data-sd",u)}catch{}const f=EI(n.shadowRoot),p=yI(f,h),A=vI(f),C=xI(n,A,h);wI(r,C+p,u);const m=document.createDocumentFragment(),y=await wo(Array.from(n.shadowRoot.childNodes),c,t.fast);m.append(...y.filter(E=>!!E)),r.appendChild(m)}if(n.tagName==="SLOT"){let c=function(A,C){Vi(A,e,t).then(m=>{m&&BI(m),C(m||null)}).catch(()=>{C(null)})};const u=n.assignedNodes?.({flatten:!0})||[],h=u.length>0?u:Array.from(n.childNodes),f=document.createDocumentFragment(),p=await wo(Array.from(h),c,t.fast);return f.append(...p.filter(A=>!!A)),f}function l(c,u){if(i.has(c))return u(null);Vi(c,e,t).then(h=>{u(h||null)}).catch(()=>{u(null)})}const a=await wo(Array.from(n.childNodes),l,t.fast);if(r.append(...a.filter(c=>!!c)),s!==null&&r instanceof HTMLSelectElement){r.value=s;for(const c of r.options)c.value===s?c.setAttribute("selected",""):c.removeAttribute("selected")}return o!==null&&r instanceof HTMLTextAreaElement&&(r.textContent=o),r}var kI=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],bo=[];function PI(n){const e=Array.isArray(n)?n:[n];for(const t of e)t instanceof RegExp?bo.push(t):typeof t=="string"?bo.push(new RegExp(t,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",t)}function lt(n){const e=typeof n=="string"?n:"",t=[...kI,...bo];for(const i of t)if(i instanceof RegExp&&i.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function FI(n,e,t,i=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const r=document.createElement("span");r.textContent=n,r.style.position="absolute",r.style.visibility="hidden",r.style.fontFamily=`"${e}"`,r.style.fontWeight=t||"normal",r.style.fontSize=`${i}px`,r.style.lineHeight="1",r.style.whiteSpace="nowrap",r.style.padding="0",r.style.margin="0",document.body.appendChild(r);const l=r.getBoundingClientRect(),a=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(r);const u=document.createElement("canvas");u.width=Math.max(1,a*o),u.height=Math.max(1,c*o);const h=u.getContext("2d");return h.scale(o,o),h.font=t?`${t} ${i}px "${e}"`:`${i}px "${e}"`,h.textAlign="left",h.textBaseline="top",h.fillStyle=s,h.fillText(n,0,0),{dataUrl:u.toDataURL(),width:a,height:c}}var RI=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Wi(n){if(!n)return"";for(let e of n.split(",")){let t=e.trim().replace(/^['"]+|['"]+$/g,"");if(t&&!RI.has(t.toLowerCase()))return t}return""}function zi(n){const e=String(n??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;const t=parseInt(e,10);return Number.isFinite(t)?Math.min(900,Math.max(100,t)):400}function vo(n){const e=String(n??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function OI(n){const e=String(n??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function LI(n){const e=String(n||"400").trim(),t=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(t){const s=zi(t[1]),o=zi(t[2]);return{min:Math.min(s,o),max:Math.max(s,o)}}const i=zi(e);return{min:i,max:i}}function NI(n){const e=String(n||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function UI(n){const e=String(n||"100%").trim(),t=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(t){const o=parseFloat(t[1]),r=parseFloat(t[2]);return{min:Math.min(o,r),max:Math.max(o,r)}}const i=e.match(/(\d+(?:\.\d+)?)\s*%/),s=i?parseFloat(i[1]):100;return{min:s,max:s}}function _I(n,e){if(!n)return!1;try{const t=new URL(n,location.href);if(t.origin===location.origin)return!0;const s=t.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>s.endsWith(l)))return!0;const r=(t.pathname+t.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(const l of e){const a=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(r.includes(a)||r.includes(c))return!0}return!1}catch{return!1}}function QI(n){const e=new Set;for(const t of n||[]){const i=String(t).split("__")[0]?.trim();i&&e.add(i)}return e}function xc(n,e){return n&&n.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(t,i,s)=>{const o=(s||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return t;let r=o;try{r=new URL(o,e||location.href).href}catch{}return`url("${r}")`})}var Io=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,ji=4;async function HI(n,e,t){if(!n)return n;const i=new Set;function s(l,a){try{return new URL(l,a||location.href).href}catch{return l}}async function o(l,a,c=0){if(c>ji)return console.warn(`[snapDOM] @import depth exceeded (${ji}) at ${a}`),l;let u="",h=0,f;for(;f=Io.exec(l);){u+=l.slice(h,f.index),h=Io.lastIndex;const p=(f[2]||f[4]||"").trim(),A=s(p,a);if(i.has(A)){console.warn(`[snapDOM] Skipping circular @import: ${A}`);continue}i.add(A);let C="";try{const m=await je(A,{as:"text",useProxy:t,silent:!0});m.ok&&typeof m.data=="string"&&(C=m.data)}catch{}C?(C=xc(C,A),C=await o(C,A,c+1),u+=`
122
122
  /* inlined: ${A} */
123
123
  ${C}
124
- `):u+=f[0]}return u+=l.slice(h),u}let r=Ic(n,e||location.href);return r=await o(r,e||location.href,0),r}var Bc=/url\((["']?)([^"')]+)\1\)/g,_x=/@font-face[^{}]*\{[^}]*\}/g;function Sc(n){if(!n)return[];const e=[],t=n.split(",").map(i=>i.trim()).filter(Boolean);for(const i of t){const s=i.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;const o=s[1],r=s[2],l=a=>{if(!a.includes("?"))return parseInt(a,16);const c=parseInt(a.replace(/\?/g,"0"),16),u=parseInt(a.replace(/\?/g,"F"),16);return[c,u]};if(r){const a=l(o),c=l(r),u=Array.isArray(a)?a[0]:a,h=Array.isArray(c)?c[1]:c;e.push([Math.min(u,h),Math.max(u,h)])}else{const a=l(o);Array.isArray(a)?e.push([a[0],a[1]]):e.push([a,a])}}return e}function Mc(n,e){if(!e.length||!n||n.size===0)return!0;for(const t of n)for(const[i,s]of e)if(t>=i&&t<=s)return!0;return!1}function Io(n,e){const t=[];if(!n)return t;for(const i of n.matchAll(Bc)){let s=(i[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}t.push(s)}}return t}async function Tc(n,e,t=""){let i=n;for(const s of n.matchAll(Bc)){const o=ho(s[0]);if(!o)continue;let r=o;if(!r.startsWith("http")&&!r.startsWith("data:"))try{r=new URL(r,e||location.href).href}catch{}if(!lt(r)){if(W.resource?.has(r)){W.font?.add(r),i=i.replace(s[0],`url(${W.resource.get(r)})`);continue}if(!W.font?.has(r))try{const l=await je(r,{as:"dataURL",useProxy:t,silent:!0});if(l.ok&&typeof l.data=="string"){const a=l.data;W.resource?.set(r,a),W.font?.add(r),i=i.replace(s[0],`url(${a})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",r)}}}return i}function Qx(n){if(!n.length)return null;const e=(l,a)=>n.some(([c,u])=>!(u<l||c>a)),t=e(0,255)||e(305,305),i=e(256,591)||e(7680,7935),s=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":s?"greek":i?"latin-ext":t?"latin":null}function Dc(n={}){const e=new Set((n.families||[]).map(s=>String(s).toLowerCase())),t=new Set((n.domains||[]).map(s=>String(s).toLowerCase())),i=new Set((n.subsets||[]).map(s=>String(s).toLowerCase()));return(s,o)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(t.size)for(const r of s.srcUrls)try{if(t.has(new URL(r).host.toLowerCase()))return!0}catch{}if(i.size){const r=Qx(o);if(r&&i.has(r))return!0}return!1}}function Hx(n){if(!n)return n;const e=/@font-face[^{}]*\{[^}]*\}/gi,t=new Set,i=[];for(const o of n.match(e)||[]){const r=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Wi(r),a=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),p=Io(f,location.href),A=p.length?p.map(m=>String(m).toLowerCase()).sort().join("|"):f.toLowerCase(),C=[String(l||"").toLowerCase(),a,c,u,h.toLowerCase(),A].join("|");t.has(C)||(t.add(C),i.push(o))}if(i.length===0)return n;let s=0;return n.replace(e,()=>i[s++]||"")}function Gx(n,e,t,i){const s=Array.from(n||[]).sort().join("|"),o=e?JSON.stringify({families:(e.families||[]).map(a=>String(a).toLowerCase()).sort(),domains:(e.domains||[]).map(a=>String(a).toLowerCase()).sort(),subsets:(e.subsets||[]).map(a=>String(a).toLowerCase()).sort()}):"",r=(t||[]).map(a=>`${(a.family||"").toLowerCase()}::${a.weight||"normal"}::${a.style||"normal"}::${a.src||""}`).sort().join("|");return`fonts-embed-css::req=${s}::ex=${o}::lf=${r}::px=${i||""}`}async function kc(n,e,t,i){let s;try{s=n.cssRules||[]}catch{return}const o=(r,l)=>{try{return new URL(r,l||location.href).href}catch{return r}};for(const r of s){if(r.type===CSSRule.IMPORT_RULE&&r.styleSheet){const l=r.href?o(r.href,e):e;if(i.depth>=ji){console.warn(`[snapDOM] CSSOM import depth exceeded (${ji}) at ${l}`);continue}if(l&&i.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&i.visitedSheets.add(l);const a={...i,depth:(i.depth||0)+1};await kc(r.styleSheet,l,t,a);continue}if(r.type===CSSRule.FONT_FACE_RULE){const l=(r.style.getPropertyValue("font-family")||"").trim(),a=Wi(l);if(!a||lt(a))continue;const c=(r.style.getPropertyValue("font-weight")||"400").trim(),u=(r.style.getPropertyValue("font-style")||"normal").trim(),h=(r.style.getPropertyValue("font-stretch")||"100%").trim(),f=(r.style.getPropertyValue("src")||"").trim(),p=(r.style.getPropertyValue("unicode-range")||"").trim();if(!i.faceMatchesRequired(a,u,c,h))continue;const A=Sc(p);if(!Mc(i.usedCodepoints,A))continue;const C={family:a,weightSpec:c,styleSpec:u,stretchSpec:h,unicodeRange:p,srcRaw:f,srcUrls:Io(f,e||location.href),href:e||location.href};if(i.simpleExcluder&&i.simpleExcluder(C,A))continue;if(/url\(/i.test(f)){const m=await Tc(f,e||location.href,i.useProxy);await t(`@font-face{font-family:${a};src:${m};font-style:${u};font-weight:${c};font-stretch:${h};${p?`unicode-range:${p};`:""}}`)}else await t(`@font-face{font-family:${a};src:${f};font-style:${u};font-weight:${c};font-stretch:${h};${p?`unicode-range:${p};`:""}}`)}}}async function Pc({required:n,usedCodepoints:e,exclude:t=void 0,localFonts:i=[],useProxy:s=""}={}){n instanceof Set||(n=new Set),e instanceof Set||(e=new Set);const o=new Map;for(const C of n){const[m,y,E,x]=String(C).split("__");if(!m)continue;const M=o.get(m)||[];M.push({w:parseInt(y,10),s:E,st:parseInt(x,10)}),o.set(m,M)}function r(C,m,y,E){if(!o.has(C))return!1;const x=o.get(C),M=Fx(y),T=Rx(m),S=Ox(E),I=M.min!==M.max,g=M.min,k=F=>T.kind==="normal"&&F==="normal"||T.kind!=="normal"&&(F==="italic"||F==="oblique");let P=!1;for(const F of x){const L=I?F.w>=M.min&&F.w<=M.max:F.w===g,G=k(vo(F.s)),O=F.st>=S.min&&F.st<=S.max;if(L&&G&&O){P=!0;break}}if(P)return!0;if(!I)for(const F of x){const L=k(vo(F.s)),G=F.st>=S.min&&F.st<=S.max;if(Math.abs(g-F.w)<=300&&L&&G)return!0}return!1}const l=Dc(t),a=Gx(n,t,i,s);if(W.resource?.has(a))return W.resource.get(a);const c=Nx(n),u=[],h=xo;for(const C of document.querySelectorAll("style")){const m=C.textContent||"";for(const y of m.matchAll(h)){const E=(y[2]||y[4]||"").trim();if(!E||lt(E))continue;document.querySelector(`link[rel="stylesheet"][href="${E}"]`)||u.push(E)}}u.length&&await Promise.all(u.map(C=>new Promise(m=>{if(document.querySelector(`link[rel="stylesheet"][href="${C}"]`))return m(null);const y=document.createElement("link");y.rel="stylesheet",y.href=C,y.setAttribute("data-snapdom","injected-import"),y.onload=()=>m(y),y.onerror=()=>m(null),document.head.appendChild(y)})));let f="";const p=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(C=>!!C.href);for(const C of p)try{if(lt(C.href))continue;let m="",y=!1;try{y=new URL(C.href,location.href).origin===location.origin}catch{}if(!y&&!Lx(C.href,c))continue;if(y){const x=Array.from(document.styleSheets).find(M=>M.href===C.href);if(x)try{const M=x.cssRules||[];m=Array.from(M).map(T=>T.cssText).join("")}catch{}}if(!m&&(m=(await je(C.href,{as:"text",useProxy:s})).data,lt(C.href)))continue;m=await Ux(m,C.href,s);let E="";for(const x of m.match(_x)||[]){const M=(x.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),T=Wi(M);if(!T||lt(T))continue;const S=(x.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),I=(x.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),g=(x.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),k=(x.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),P=(x.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),F=Io(P,C.href);if(!r(T,I,S,g))continue;const L=Sc(k);if(!Mc(e,L))continue;const G={family:T,weightSpec:S,styleSpec:I,stretchSpec:g,unicodeRange:k,srcRaw:P,srcUrls:F,href:C.href};if(t&&l(G,L))continue;const O=/url\(/i.test(P)?await Tc(x,C.href,s):x;E+=O}E.trim()&&(f+=E)}catch{console.warn("[snapDOM] Failed to process stylesheet:",C.href)}const A={requiredIndex:o,usedCodepoints:e,faceMatchesRequired:r,simpleExcluder:t?Dc(t):null,useProxy:s,visitedSheets:new Set,depth:0};for(const C of document.styleSheets)if(!(C.href&&p.some(m=>m.href===C.href)))try{const m=C.href||location.href;m&&A.visitedSheets.add(m),await kc(C,m,async y=>{f+=y},A)}catch{}try{for(const C of document.fonts||[]){if(!C||!C.family||C.status!=="loaded"||!C._snapdomSrc)continue;const m=String(C.family).replace(/^['"]+|['"]+$/g,"");if(lt(m)||!o.has(m)||t?.families&&t.families.some(E=>String(E).toLowerCase()===m.toLowerCase()))continue;let y=C._snapdomSrc;if(!String(y).startsWith("data:")){if(W.resource?.has(C._snapdomSrc))y=W.resource.get(C._snapdomSrc),W.font?.add(C._snapdomSrc);else if(!W.font?.has(C._snapdomSrc))try{const E=await je(C._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(E.ok&&typeof E.data=="string")y=E.data,W.resource?.set(C._snapdomSrc,y),W.font?.add(C._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",C._snapdomSrc);continue}}f+=`@font-face{font-family:'${m}';src:url(${y});font-style:${C.style||"normal"};font-weight:${C.weight||"normal"};}`}}catch{}for(const C of i){if(!C||typeof C!="object")continue;const m=String(C.family||"").replace(/^['"]+|['"]+$/g,"");if(!m||lt(m)||!o.has(m)||t?.families&&t.families.some(S=>String(S).toLowerCase()===m.toLowerCase()))continue;const y=C.weight!=null?String(C.weight):"normal",E=C.style!=null?String(C.style):"normal",x=C.stretchPct!=null?`${C.stretchPct}%`:"100%",M=String(C.src||"");let T=M;if(!T.startsWith("data:")){if(W.resource?.has(M))T=W.resource.get(M),W.font?.add(M);else if(!W.font?.has(M))try{const S=await je(M,{as:"dataURL",useProxy:s,silent:!0});if(S.ok&&typeof S.data=="string")T=S.data,W.resource?.set(M,T),W.font?.add(M);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",M);continue}}f+=`@font-face{font-family:'${m}';src:url(${T});font-style:${E};font-weight:${y};font-stretch:${x};}`}return f&&(f=Hx(f),W.resource?.set(a,f)),f}function Fc(n){const e=new Set;if(!n)return e;const t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,null),i=r=>{const l=Wi(r.fontFamily);if(!l)return;const a=(c,u,h)=>`${l}__${zi(c)}__${vo(u)}__${Px(h)}`;e.add(a(r.fontWeight,r.fontStyle,r.fontStretch))};i(getComputedStyle(n));const s=getComputedStyle(n,"::before");s&&s.content&&s.content!=="none"&&i(s);const o=getComputedStyle(n,"::after");for(o&&o.content&&o.content!=="none"&&i(o);t.nextNode();){const r=t.currentNode,l=getComputedStyle(r);i(l);const a=getComputedStyle(r,"::before");a&&a.content&&a.content!=="none"&&i(a);const c=getComputedStyle(r,"::after");c&&c.content&&c.content!=="none"&&i(c)}return e}function Rc(n){const e=new Set,t=s=>{if(s)for(const o of s)e.add(o.codePointAt(0))},i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;i.nextNode();){const s=i.currentNode;if(s.nodeType===Node.TEXT_NODE)t(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){const o=s;for(const r of["::before","::after"]){const a=getComputedStyle(o,r)?.getPropertyValue("content");if(!(!a||a==="none"))if(/^"/.test(a)||/^'/.test(a))t(a.slice(1,-1));else{const c=a.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(const u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function Oc(n,e=2){try{await document.fonts.ready}catch{}const t=Array.from(n||[]).filter(Boolean);if(t.length===0)return;const i=()=>{const s=document.createElement("div");s.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const o of t){const r=document.createElement("span");r.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",r.style.fontFamily=`"${o}"`,r.style.fontWeight="700",r.style.fontStyle="italic",r.style.fontSize="32px",r.style.lineHeight="1",r.style.whiteSpace="nowrap",r.style.margin="0",r.style.padding="0",s.appendChild(r)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)i(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}function Yx(n){return/\bcounter\s*\(|\bcounters\s*\(/.test(n||"")}function Vx(n){return(n||"").replace(/"([^"]*)"/g,"$1")}function Lc(n,e=!1){let t="",i=Math.max(1,n);for(;i>0;)i--,t=String.fromCharCode(97+i%26)+t,i=Math.floor(i/26);return e?t.toUpperCase():t}function Nc(n,e=!0){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let i=Math.max(1,Math.min(3999,n)),s="";for(const[o,r]of t)for(;i>=o;)s+=r,i-=o;return e?s:s.toLowerCase()}function Uc(n,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,n));case"decimal-leading-zero":return(n<10?"0":"")+String(Math.max(0,n));case"lower-alpha":return Lc(n,!1);case"upper-alpha":return Lc(n,!0);case"lower-roman":return Nc(n,!1);case"upper-roman":return Nc(n,!0);default:return String(Math.max(0,n))}}function Wx(n){const e=new WeakMap,t=n instanceof Document?n.documentElement:n,i=c=>c&&c.tagName==="LI",s=c=>{let u=0,h=c?.parentElement;if(!h)return 0;for(const f of h.children){if(f===c)break;f.tagName==="LI"&&u++}return u},o=c=>{const u=new Map;for(const[h,f]of c)u.set(h,f.slice());return u},r=(c,u,h)=>{const f=o(c);let p;try{p=h.style?.counterReset||getComputedStyle(h).counterReset}catch{}if(p&&p!=="none")for(const C of p.split(",")){const m=C.trim().split(/\s+/),y=m[0],E=Number.isFinite(Number(m[1]))?Number(m[1]):0;if(!y)continue;const x=u.get(y);if(x&&x.length){const M=x.slice();M.push(E),f.set(y,M)}else f.set(y,[E])}let A;try{A=h.style?.counterIncrement||getComputedStyle(h).counterIncrement}catch{}if(A&&A!=="none")for(const C of A.split(",")){const m=C.trim().split(/\s+/),y=m[0],E=Number.isFinite(Number(m[1]))?Number(m[1]):1;if(!y)continue;const x=f.get(y)||[];x.length===0&&x.push(0),x[x.length-1]+=E,f.set(y,x)}try{if(getComputedStyle(h).display==="list-item"&&i(h)){const m=h.parentElement;let y=1;if(m&&m.tagName==="OL"){const x=m.getAttribute("start"),M=Number.isFinite(Number(x))?Number(x):1,T=s(h),S=h.getAttribute("value");y=Number.isFinite(Number(S))?Number(S):M+T}else y=1+s(h);const E=f.get("list-item")||[];E.length===0&&E.push(0),E[E.length-1]=y,f.set("list-item",E)}}catch{}return f},l=(c,u,h)=>{const f=r(h,u,c);e.set(c,f);let p=f;for(const A of c.children)p=l(A,f,p);return f},a=new Map;return l(t,a,a),{get(c,u){const h=e.get(c)?.get(u);return h&&h.length?h[h.length-1]:0},getStack(c,u){const h=e.get(c)?.get(u);return h?h.slice():[]}}}function zx(n,e,t){if(!n||n==="none")return n;try{const i=/\b(counter|counters)\s*\(([^)]+)\)/g;let s=n.replace(i,(o,r,l)=>{const a=String(l).split(",").map(c=>c.trim());if(r==="counter"){const c=a[0]?.replace(/^["']|["']$/g,""),u=(a[1]||"decimal").toLowerCase(),h=t.get(e,c);return Uc(h,u)}else{const c=a[0]?.replace(/^["']|["']$/g,""),u=a[1]?.replace(/^["']|["']$/g,"")??"",h=(a[2]||"decimal").toLowerCase(),f=t.getStack(e,c);return f.length?f.map(A=>Uc(A,h)).join(u):""}});return Vx(s)}catch{return"- "}}var Vn=null,Wn=new WeakMap;function jx(n){return(n||"").replace(/"([^"]*)"/g,"$1")}function $x(n){if(!n)return"";const e=[],t=/"([^"]*)"/g;let i;for(;i=t.exec(n);)e.push(i[1]);return e.length?e.join(""):jx(n)}function Bo(n,e){const t=n.parentElement,i=t?Wn.get(t):null;return i?{get(s,o){const r=e.get(s,o),l=i.get(o);return typeof l=="number"?Math.max(r,l):r},getStack(s,o){const r=e.getStack(s,o);if(!r.length)return r;const l=i.get(o);if(typeof l=="number"){const a=r.slice();return a[a.length-1]=Math.max(a[a.length-1],l),a}return r}}:e}function So(n,e,t){const i=new Map;function s(a){const c=[];if(!a||a==="none")return c;for(const u of String(a).split(",")){const h=u.trim().split(/\s+/),f=h[0],p=Number.isFinite(Number(h[1]))?Number(h[1]):void 0;f&&c.push({name:f,num:p})}return c}const o=s(e?.counterReset),r=s(e?.counterIncrement);function l(a){if(i.has(a))return i.get(a).slice();let c=t.getStack(n,a);c=c.length?c.slice():[];const u=o.find(f=>f.name===a);if(u){const f=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,f]:[f]}const h=r.find(f=>f.name===a);if(h){const f=Number.isFinite(h.num)?h.num:1;c.length===0&&(c=[0]),c[c.length-1]+=f}return i.set(a,c.slice()),c}return{get(a,c){const u=l(c);return u.length?u[u.length-1]:0},getStack(a,c){return l(c)},__incs:r}}function Kx(n,e,t){let i;try{i=getComputedStyle(n,e)}catch{}const s=i?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};const o=Bo(n,t),r=So(n,i,o);let l=Yx(s)?zx(s,n,r):s;return{text:$x(l),incs:r.__incs||[]}}async function _c(n,e,t,i){if(!(n instanceof Element)||!(e instanceof Element))return;if(!Vn)try{Vn=Wx(n.ownerDocument||document)}catch{}for(const r of["::before","::after","::first-letter"])try{const l=Ao(n,r);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(r==="::first-letter"){const b=getComputedStyle(n);if(!(l.color!==b.color||l.fontSize!==b.fontSize||l.fontWeight!==b.fontWeight))continue;const R=Array.from(e.childNodes).find(re=>re.nodeType===Node.TEXT_NODE&&re.textContent?.trim().length>0);if(!R)continue;const U=R.textContent,D=U.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Q=U.slice(D?.length||0);if(!D||/[\uD800-\uDFFF]/.test(D))continue;const V=document.createElement("span");V.textContent=D,V.dataset.snapdomPseudo="::first-letter";const $=wc(l),J=mo($,"span");t.styleMap.set(V,J);const ne=document.createTextNode(Q);e.replaceChild(ne,R),e.insertBefore(V,ne);continue}const c=l.content,{text:u,incs:h}=Kx(n,r,Vn),f=l.backgroundImage,p=l.backgroundColor,A=l.fontFamily,C=parseInt(l.fontSize)||32,m=parseInt(l.fontWeight)||!1,y=l.color||"#000",E=l.borderStyle,x=parseFloat(l.borderWidth),M=l.transform,T=lt(A),S=c!=="none"&&u!=="",I=f&&f!=="none",g=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",k=E&&E!=="none"&&x>0,P=M&&M!=="none";if(!(S||I||g||k||P)){if(h&&h.length&&n.parentElement){const b=Wn.get(n.parentElement)||new Map;for(const{name:B}of h){if(!B)continue;const R=Bo(n,Vn),N=So(n,getComputedStyle(n,r),R).get(n,B);b.set(B,N)}Wn.set(n.parentElement,b)}continue}const L=document.createElement("span");L.dataset.snapdomPseudo=r,L.style.verticalAlign="middle",L.style.pointerEvents="none";const G=wc(l),O=mo(G,"span");if(t.styleMap.set(L,O),T&&u&&u.length===1){const{dataUrl:b,width:B,height:R}=await Dx(u,A,m,C,y),U=document.createElement("img");U.src=b,U.style=`height:${C}px;width:${B/R*C}px;object-fit:contain;`,L.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){const b=ho(u);if(b?.trim())try{const B=document.createElement("img"),R=await je(Hi(b),{as:"dataURL",useProxy:i.useProxy});B.src=R.data,B.style=`width:${C}px;height:auto;object-fit:contain;`,L.appendChild(B)}catch(B){console.error(`[snapdom] Error in pseudo ${r} for`,n,B)}}else!T&&S&&(L.textContent=u);if(L.style.background="none","mask"in L.style&&(L.style.mask="none"),I)try{const b=yo(f),B=await Promise.all(b.map(go));L.style.backgroundImage=B.join(", ")}catch(b){console.warn(`[snapdom] Failed to inline background-image for ${r}`,b)}g&&(L.style.backgroundColor=p);const w=L.childNodes.length>0||L.textContent?.trim()!==""||I||g||k||P;if(h&&h.length&&n.parentElement){const b=Wn.get(n.parentElement)||new Map,B=Bo(n,Vn),R=So(n,getComputedStyle(n,r),B);for(const{name:U}of h){if(!U)continue;const N=R.get(n,U);b.set(U,N)}Wn.set(n.parentElement,b)}if(!w)continue;r==="::before"?e.insertBefore(L,e.firstChild):e.appendChild(L)}catch(l){console.warn(`[snapdom] Failed to capture ${r} for`,n,l)}const s=Array.from(n.children),o=Array.from(e.children).filter(r=>!r.dataset.snapdomPseudo);for(let r=0;r<Math.min(s.length,o.length);r++)await _c(s[r],o[r],t,i)}function Xx(n){if(!n)return;const e=new Set;if(n.querySelectorAll("use").forEach(l=>{const a=l.getAttribute("xlink:href")||l.getAttribute("href");a&&a.startsWith("#")&&e.add(a.slice(1))}),!e.size)return;const t=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),i=t.filter(l=>l.tagName.toLowerCase()==="symbol"),s=t.filter(l=>l.tagName.toLowerCase()==="defs");let o=n.querySelector("svg.inline-defs-container");o||(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("aria-hidden","true"),o.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),o.classList.add("inline-defs-container"),n.insertBefore(o,n.firstChild));const r=new Set;n.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{r.add(l.id)}),e.forEach(l=>{if(r.has(l))return;const a=i.find(c=>c.id===l);if(a){o.appendChild(a.cloneNode(!0)),r.add(l);return}for(const c of s){const u=c.querySelector(`#${CSS.escape(l)}`);if(u){let h=o.querySelector("defs");h||(h=document.createElementNS("http://www.w3.org/2000/svg","defs"),o.appendChild(h)),h.appendChild(u.cloneNode(!0)),r.add(l);break}}})}function qx(n,e){if(!n||!e)return;const t=n.scrollTop||0;if(!t)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");const i=n.getBoundingClientRect(),s=n.clientHeight,o="data-snap-ph",r=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){const l=r.currentNode,a=getComputedStyle(l),c=a.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;const u=Qc(a.top),h=Qc(a.bottom);if(u==null&&h==null)continue;const f=Jx(l,n),p=Zx(e,f,o);if(!p)continue;const A=l.getBoundingClientRect(),C=A.width,m=A.height,y=A.left-i.left;if(!(C>0&&m>0)||!Number.isFinite(y))continue;const E=u!=null?u+t:t+(s-m-h);if(!Number.isFinite(E))continue;const x=Number.parseInt(a.zIndex,10),M=Number.isFinite(x),T=M?Math.max(x,1)+1:2,S=M?x-1:0,I=p.cloneNode(!1);I.setAttribute(o,"1"),I.style.position="sticky",I.style.left=`${y}px`,I.style.top=`${E}px`,I.style.width=`${C}px`,I.style.height=`${m}px`,I.style.visibility="hidden",I.style.zIndex=String(S),I.style.overflow="hidden",I.style.background="transparent",I.style.boxShadow="none",I.style.filter="none",p.parentElement?.insertBefore(I,p),p.style.position="absolute",p.style.left=`${y}px`,p.style.top=`${E}px`,p.style.bottom="auto",p.style.zIndex=String(T),p.style.pointerEvents="none"}}function Qc(n){if(!n||n==="auto")return null;const e=Number.parseFloat(n);return Number.isFinite(e)?e:null}function Jx(n,e){const t=[];for(let i=n;i&&i!==e;){const s=i.parentElement;if(!s)break;t.push(Array.prototype.indexOf.call(s.children,i)),i=s}return t.reverse()}function Zx(n,e,t){let i=n;for(let s=0;s<e.length;s++)if(i=eI(i,t)[e[s]],!i)return null;return i instanceof HTMLElement?i:null}function eI(n,e){const t=[],i=n.children;for(let s=0;s<i.length;s++){const o=i[s];o.hasAttribute(e)||t.push(o)}return t}async function tI(n,e={}){const t={styleMap:W.session.styleMap,styleCache:W.session.styleCache,nodeMap:W.session.nodeMap};let i,s="",o="";nI(n);try{Xx(n)}catch(a){console.warn("inlineExternal defs or symbol failed:",a)}try{i=await Vi(n,t,e,n)}catch(a){throw console.warn("deepClone failed:",a),a}try{await _c(n,i,t,e)}catch(a){console.warn("inlinePseudoElements failed:",a)}await rI(i);try{const a=i.querySelectorAll("style[data-sd]");for(const c of a)o+=c.textContent||"",c.remove()}catch{}const r=tx(t.styleMap);s=Array.from(r.entries()).map(([a,c])=>`.${c}{${a}}`).join(""),s=o+s;for(const[a,c]of t.styleMap.entries()){if(a.tagName==="STYLE")continue;if(a.getRootNode&&a.getRootNode()instanceof ShadowRoot){a.setAttribute("style",c.replace(/;/g,"; "));continue}const u=r.get(c);u&&a.classList.add(u);const h=a.style?.backgroundImage,f=a.dataset?.snapdomHasIcon;h&&h!=="none"&&(a.style.backgroundImage=h),f&&(a.style.verticalAlign="middle",a.style.display="inline")}for(const[a,c]of t.nodeMap.entries()){const u=c.scrollLeft,h=c.scrollTop;if((u||h)&&a instanceof HTMLElement){a.style.overflow="hidden",a.style.scrollbarWidth="none",a.style.msOverflowStyle="none";const p=document.createElement("div");for(p.style.transform=`translate(${-u}px, ${-h}px)`,p.style.willChange="transform",p.style.display="inline-block",p.style.width="100%";a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p)}}const l=i instanceof HTMLElement&&i.firstElementChild instanceof HTMLElement?i.firstElementChild:i;if(qx(n,l),n===t.nodeMap.get(i)){const a=t.styleCache.get(n)||window.getComputedStyle(n);t.styleCache.set(n,a);const c=Hv(a.transform);i.style.margin="0",i.style.top="auto",i.style.left="auto",i.style.right="auto",i.style.bottom="auto",i.style.animation="none",i.style.transition="none",i.style.willChange="auto",i.style.float="none",i.style.clear="none",i.style.transform=c||""}for(const[a,c]of t.nodeMap.entries())c.tagName==="PRE"&&(a.style.marginTop="0",a.style.marginBlockStart="0");return{clone:i,classCSS:s,styleCache:t.styleCache}}function nI(n){const e=getComputedStyle(n),t=e.outlineStyle,i=e.outlineWidth,s=e.borderStyle,o=e.borderWidth,r=t!=="none"&&parseFloat(i)>0,l=s==="none"||parseFloat(o)===0;r&&l&&(n.style.border=`${i} solid transparent`)}var zn=new Map;async function jn(n){if(W.resource?.has(n))return W.resource.get(n);if(zn.has(n))return zn.get(n);const e=(async()=>{const t=await je(n,{as:"dataURL",silent:!0});if(!t.ok||typeof t.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${n}`);return W.resource?.set(n,t.data),t.data})();zn.set(n,e);try{const t=await e;return zn.set(n,t),t}catch(t){throw zn.delete(n),t}}var iI=/\bblob:[^)"'\s]+/g;async function Hc(n){if(!n||n.indexOf("blob:")===-1)return n;const e=Array.from(new Set(n.match(iI)||[]));if(e.length===0)return n;let t=n;for(const i of e)try{const s=await jn(i);t=t.split(i).join(s)}catch{}return t}function $i(n){return typeof n=="string"&&n.startsWith("blob:")}function sI(n){return(n||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{const t=e.match(/^(\S+)(\s+.+)?$/);return t?{url:t[1],desc:t[2]||""}:null}).filter(Boolean)}function oI(n){return n.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function rI(n){if(!n)return;const e=n.querySelectorAll?n.querySelectorAll("img"):[];for(const r of e)try{const a=r.getAttribute("src")||r.currentSrc||"";if($i(a)){const u=await jn(a);r.setAttribute("src",u)}const c=r.getAttribute("srcset");if(c&&c.includes("blob:")){const u=sI(c);let h=!1;for(const f of u)if($i(f.url))try{f.url=await jn(f.url),h=!0}catch{}h&&r.setAttribute("srcset",oI(u))}}catch{}const t=n.querySelectorAll?n.querySelectorAll("image"):[];for(const r of t)try{const l="http://www.w3.org/1999/xlink",a=r.getAttribute("href")||r.getAttributeNS?.(l,"href");if($i(a)){const c=await jn(a);r.setAttribute("href",c),r.removeAttributeNS?.(l,"href")}}catch{}const i=n.querySelectorAll?n.querySelectorAll("[style*='blob:']"):[];for(const r of i)try{const l=r.getAttribute("style");if(l&&l.includes("blob:")){const a=await Hc(l);r.setAttribute("style",a)}}catch{}const s=n.querySelectorAll?n.querySelectorAll("style"):[];for(const r of s)try{const l=r.textContent||"";l.includes("blob:")&&(r.textContent=await Hc(l))}catch{}const o=["poster"];for(const r of o){const l=n.querySelectorAll?n.querySelectorAll(`[${r}^='blob:']`):[];for(const a of l)try{const c=a.getAttribute(r);$i(c)&&a.setAttribute(r,await jn(c))}catch{}}}async function aI(n,e={}){const t=Array.from(n.querySelectorAll("img")),i=async s=>{if(!s.getAttribute("src")){const u=s.currentSrc||s.src||"";u&&s.setAttribute("src",u)}s.removeAttribute("srcset"),s.removeAttribute("sizes");const o=s.src||"";if(!o)return;const r=await je(o,{as:"dataURL",useProxy:e.useProxy});if(r.ok&&typeof r.data=="string"&&r.data.startsWith("data:")){s.src=r.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}const{fallbackURL:l}=e||{};if(l)try{const u=parseInt(s.dataset?.snapdomWidth||"",10)||0,h=parseInt(s.dataset?.snapdomHeight||"",10)||0,f=parseInt(s.getAttribute("width")||"",10)||0,p=parseInt(s.getAttribute("height")||"",10)||0,A=parseFloat(s.style?.width||"")||0,C=parseFloat(s.style?.height||"")||0,m=u||A||f||s.width||void 0,y=h||C||p||s.height||void 0,E=typeof l=="function"?await l({width:m,height:y,src:o,element:s}):l;if(E){const x=await je(E,{as:"dataURL",useProxy:e.useProxy});s.src=x.data,!s.width&&m&&(s.width=m),!s.height&&y&&(s.height=y),s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}}catch{}const a=s.width||s.naturalWidth||100,c=s.height||s.naturalHeight||100;if(e.placeholders!==!1){const u=document.createElement("div");u.style.cssText=[`width:${a}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",s.replaceWith(u)}else{const u=document.createElement("div");u.style.cssText=`display:inline-block;width:${a}px;height:${c}px;visibility:hidden;`,s.replaceWith(u)}};for(let s=0;s<t.length;s+=4){const o=t.slice(s,s+4).map(i);await Promise.allSettled(o)}}async function Gc(n,e,t,i={}){const s=[[n,e]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],r=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){const[a,c]=s.shift(),u=t.get(a)||Ao(a);t.has(a)||t.set(a,u);const h=(()=>{const A=u.getPropertyValue("border-image"),C=u.getPropertyValue("border-image-source");return A&&A!=="none"||C&&C!=="none"})();for(const A of o){const C=u.getPropertyValue(A);if(!C||C==="none")continue;const m=yo(C),y=await Promise.all(m.map(E=>go(E,i)));y.some(E=>E&&E!=="none"&&!/^url\(undefined/.test(E))&&c.style.setProperty(A,y.join(", "))}for(const A of r){const C=u.getPropertyValue(A);!C||C==="initial"||c.style.setProperty(A,C)}if(h)for(const A of l){const C=u.getPropertyValue(A);!C||C==="initial"||c.style.setProperty(A,C)}const f=Array.from(a.children),p=Array.from(c.children);for(let A=0;A<Math.min(f.length,p.length);A++)s.push([f[A],p[A]])}}function lI(n){if(!n)return()=>{};const e=cI(n);if(e<=0)return()=>{};if(!hI(n))return()=>{};const t=getComputedStyle(n),i=Math.round(dI(t)*e+uI(t)),s=n.textContent??"",o=s;if(n.scrollHeight<=i+.5)return()=>{};let r=0,l=s.length,a=-1;for(;r<=l;){const c=r+l>>1;n.textContent=s.slice(0,c)+"…",n.scrollHeight<=i+.5?(a=c,r=c+1):l=c-1}return n.textContent=(a>=0?s.slice(0,a):"")+"…",()=>{n.textContent=o}}function cI(n){const e=getComputedStyle(n);let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();const i=parseInt(t,10);return Number.isFinite(i)&&i>0?i:0}function dI(n){const e=(n.lineHeight||"").trim(),t=parseFloat(n.fontSize)||16;return!e||e==="normal"?Math.round(t*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*t):e.endsWith("%")?Math.round(parseFloat(e)/100*t):Math.round(t*1.2)}function uI(n){return(parseFloat(n.paddingTop)||0)+(parseFloat(n.paddingBottom)||0)}function hI(n){return n.childElementCount>0?!1:Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function fI(n,e){if(!n||!e||!e.style)return;const t=getComputedStyle(n);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const s=(t.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=s.length?s:"none"}catch{}}async function Yc(n,e){if(!n)throw new Error("Element cannot be null or undefined");gc(e.cache);const t=e.fast,i=!!e.straighten,s=!!e.noShadows;let o,r,l,a="",c="",u,h,f=null;const p=lI(n);try{({clone:o,classCSS:r,styleCache:l}=await tI(n,e)),i&&o&&(f=pI(n,o)),s&&o&&fI(n,o)}finally{p()}await new Promise(y=>{ln(async()=>{await aI(o,e),y()},{fast:t})}),await new Promise(y=>{ln(async()=>{await Gc(n,o,l,e),y()},{fast:t})}),e.embedFonts&&await new Promise(y=>{ln(async()=>{const E=Fc(n),x=Rc(n);if(nt()){const M=new Set(Array.from(E).map(T=>String(T).split("__")[0]).filter(Boolean));await Oc(M,1)}a=await Pc({required:E,usedCodepoints:x,exclude:e.excludeFonts,useProxy:e.useProxy}),y()},{fast:t})});const A=Zv(o).sort(),C=A.join(",");W.baseStyle.has(C)?c=W.baseStyle.get(C):await new Promise(y=>{ln(()=>{c=ex(A),W.baseStyle.set(C,c),y()},{fast:t})}),await new Promise(y=>{ln(()=>{const E=getComputedStyle(n);function x(Ke){const Oe=`${Ke.filter||""} ${Ke.webkitFilter||""}`.trim();if(!Oe||Oe==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const st=Oe.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let dt=0,Qt=0,Ht=0,xt=0,Be=!1;for(const Do of st){Be=!0;const ke=Do.match(/-?\d+(?:\.\d+)?px/gi)?.map(qi=>parseFloat(qi))||[],[un=0,hn=0,$n=0]=ke,Kn=Math.abs(un)+$n,Xn=Math.abs(hn)+$n;Qt=Math.max(Qt,Kn+Math.max(un,0)),xt=Math.max(xt,Kn+Math.max(-un,0)),Ht=Math.max(Ht,Xn+Math.max(hn,0)),dt=Math.max(dt,Xn+Math.max(-hn,0))}return{bleed:{top:Math.ceil(dt),right:Math.ceil(Qt),bottom:Math.ceil(Ht),left:Math.ceil(xt)},has:Be}}const M=n.getBoundingClientRect(),T=Math.max(1,Math.ceil(n.offsetWidth||parseFloat(E.width)||M.width||1)),S=Math.max(1,Math.ceil(n.offsetHeight||parseFloat(E.height)||M.height||1)),I=(Ke,Oe=NaN)=>{const st=typeof Ke=="string"?parseFloat(Ke):Ke;return Number.isFinite(st)?st:Oe},g=I(e.width),k=I(e.height);let P=T,F=S;const L=Number.isFinite(g),G=Number.isFinite(k),O=S>0?T/S:1;L&&G?(P=Math.max(1,Math.ceil(g)),F=Math.max(1,Math.ceil(k))):L?(P=Math.max(1,Math.ceil(g)),F=Math.max(1,Math.ceil(P/(O||1)))):G?(F=Math.max(1,Math.ceil(k)),P=Math.max(1,Math.ceil(F*(O||1)))):(P=T,F=S);let v=0,w=0,b=T,B=S;if(i&&f&&Number.isFinite(f.a)){const Ke={a:f.a,b:f.b||0,c:f.c||0,d:f.d||1,e:0,f:0},Oe=Vc(T,S,Ke,0,0);v=Oe.minX,w=Oe.minY,b=Oe.maxX,B=Oe.maxY}else if(!i&&yI(n)){const Oe=E.transform&&E.transform!=="none"?E.transform:"",st=CI(n),dt=vI({baseTransform:Oe,rotate:st.rotate||"0deg",scale:st.scale,translate:st.translate}),{ox:Qt,oy:Ht}=wI(E,T,S),xt=dt.is2D?dt:new DOMMatrix(dt.toString()),Be=Vc(T,S,xt,Qt,Ht);v=Be.minX,w=Be.minY,b=Be.maxX,B=Be.maxY}const R=gI(E),U=mI(E),N=AI(E),D=x(E),Q=s?{top:0,right:0,bottom:0,left:0}:{top:R.top+U.top+N.top+D.bleed.top,right:R.right+U.right+N.right+D.bleed.right,bottom:R.bottom+U.bottom+N.bottom+D.bleed.bottom,left:R.left+U.left+N.left+D.bleed.left};v-=Q.left,w-=Q.top,b+=Q.right,B+=Q.bottom;const V=Math.max(1,Math.ceil(b-v)),$=Math.max(1,Math.ceil(B-w)),J=Math.max(1,Math.round(V*(L||G?P/T:1))),ne=Math.max(1,Math.round($*(G||L?F/S:1))),re="http://www.w3.org/2000/svg",X=(nt()?1:0)+(i?1:0),se=document.createElementNS(re,"foreignObject"),oe=Math.floor(v),ae=Math.floor(w);se.setAttribute("x",String(-(oe-X))),se.setAttribute("y",String(-(ae-X))),se.setAttribute("width",String(Math.ceil(T+X*2))),se.setAttribute("height",String(Math.ceil(S+X*2))),se.style.overflow="visible";const Ce=document.createElement("style");Ce.textContent=c+a+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,se.appendChild(Ce);const le=document.createElement("div");le.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),le.style.width=`${T}px`,le.style.height=`${S}px`,le.style.overflow="visible",o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),le.appendChild(o),se.appendChild(le);const ct=new XMLSerializer().serializeToString(se),$e=V+X*2,vt=$+X*2,it=L||G;e.meta={w0:T,h0:S,vbW:$e,vbH:vt,targetW:P,targetH:F};const dn=nt()&&it?$e:J+X*2,Ut=nt()&&it?vt:ne+X*2;h=`<svg xmlns="${re}" width="${dn}" height="${Ut}" viewBox="0 0 ${$e} ${vt}">`+ct+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,y()},{fast:t})});const m=document.getElementById("snapdom-sandbox");return m&&m.style.position==="absolute"&&m.remove(),u}function pI(n,e){if(!n||!e||!e.style)return null;const t=getComputedStyle(n);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const i=t.transform||"none";if(i==="none")try{const o=Wc(n);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const s=i.match(/^matrix\(\s*([^)]+)\)$/i);if(s){const o=s[1].split(",").map(r=>parseFloat(r.trim()));if(o.length===6&&o.every(Number.isFinite)){const[r,l,a,c]=o,u=Math.sqrt(r*r+l*l)||0;let h=0,f=0,p=0,A=0,C=0,m=0;u>0&&(h=r/u,f=l/u,p=h*a+f*c,A=a-h*p,C=c-f*p,m=Math.sqrt(A*A+C*C)||0,m>0?p=p/m:p=0);const y=u,E=0,x=p*m,M=m;try{e.style.transform=`matrix(${y}, ${E}, ${x}, ${M}, 0, 0)`}catch{}return{a:y,b:E,c:x,d:M}}}try{const o=String(i).trim();return e.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function gI(n){const e=n.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};const t=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim());let i=0,s=0,o=0,r=0;for(const l of t){const a=l.match(/-?\d+(\.\d+)?px/g)?.map(C=>parseFloat(C))||[];if(a.length<2)continue;const[c,u,h=0,f=0]=a,p=Math.abs(c)+h+f,A=Math.abs(u)+h+f;s=Math.max(s,p+Math.max(c,0)),r=Math.max(r,p+Math.max(-c,0)),o=Math.max(o,A+Math.max(u,0)),i=Math.max(i,A+Math.max(-u,0))}return{top:Math.ceil(i),right:Math.ceil(s),bottom:Math.ceil(o),left:Math.ceil(r)}}function mI(n){const e=(n.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),t=e?Math.ceil(parseFloat(e[1])||0):0;return{top:t,right:t,bottom:t,left:t}}function AI(n){if((n.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(n.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Vc(n,e,t,i,s){const o=t.a,r=t.b,l=t.c,a=t.d,c=t.e||0,u=t.f||0;function h(y,E){let x=y-i,M=E-s,T=o*x+l*M,S=r*x+a*M;return T+=i+c,S+=s+u,[T,S]}const f=[h(0,0),h(n,0),h(0,e),h(n,e)];let p=1/0,A=1/0,C=-1/0,m=-1/0;for(const[y,E]of f)y<p&&(p=y),E<A&&(A=E),y>C&&(C=y),E>m&&(m=E);return{minX:p,minY:A,maxX:C,maxY:m,width:C-p,height:m-A}}function yI(n){return EI(n)}function Wc(n){const e=getComputedStyle(n).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function CI(n){const e={rotate:"0deg",scale:null,translate:null},t=typeof n.computedStyleMap=="function"?n.computedStyleMap():null;if(t){const s=a=>{try{return typeof t.has=="function"&&!t.has(a)||typeof t.get!="function"?null:t.get(a)}catch{return null}},o=s("rotate");if(o)if(o.angle){const a=o.angle;e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit}else o.unit?e.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:e.rotate=String(o);else{const a=getComputedStyle(n);e.rotate=a.rotate&&a.rotate!=="none"?a.rotate:"0deg"}const r=s("scale");if(r){const a="x"in r&&r.x?.value!=null?r.x.value:Array.isArray(r)?r[0]?.value:Number(r)||1,c="y"in r&&r.y?.value!=null?r.y.value:Array.isArray(r)?r[1]?.value:a;e.scale=`${a} ${c}`}else{const a=getComputedStyle(n);e.scale=a.scale&&a.scale!=="none"?a.scale:null}const l=s("translate");if(l){const a="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",h="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${a}${u} ${c}${h}`}else{const a=getComputedStyle(n);e.translate=a.translate&&a.translate!=="none"?a.translate:null}return e}const i=getComputedStyle(n);return e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg",e.scale=i.scale&&i.scale!=="none"?i.scale:null,e.translate=i.translate&&i.translate!=="none"?i.translate:null,e}function EI(n){const e=getComputedStyle(n),t=e.transform||"none";if(t!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(t))return!0;const s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",o=e.scale&&e.scale!=="none"&&e.scale!=="1",r=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||o||r)}function wI(n,e,t){const i=(n.transformOrigin||"0 0").trim().split(/\s+/),[s,o]=[i[0]||"0",i[1]||"0"],r=(l,a)=>{const c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?a/2:c==="right"||c==="bottom"?a:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*a/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:r(s,e),oy:r(o,t)}}var Mo=null;function bI(){if(Mo)return Mo;const n=document.createElement("div");return n.id="snapdom-measure-slot",n.setAttribute("aria-hidden","true"),Object.assign(n.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(n),Mo=n,n}function vI(n){const e=bI(),t=document.createElement("div");t.style.transformOrigin="0 0",n.baseTransform&&(t.style.transform=n.baseTransform),n.rotate&&(t.style.rotate=n.rotate),n.scale&&(t.style.scale=n.scale),n.translate&&(t.style.translate=n.translate),e.appendChild(t);const i=Wc(t);return e.removeChild(t),i}function xI(n){if(typeof n=="string"){const e=n.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function II(n={}){const e=n.format??"png",t=xI(n.cache);return{debug:n.debug??!1,fast:n.fast??!0,scale:n.scale??1,exclude:n.exclude??[],excludeMode:n.excludeMode??"hide",filter:n.filter??null,filterMode:n.filterMode??"hide",placeholders:n.placeholders!==!1,embedFonts:n.embedFonts??!1,iconFonts:Array.isArray(n.iconFonts)?n.iconFonts:n.iconFonts?[n.iconFonts]:[],localFonts:Array.isArray(n.localFonts)?n.localFonts:[],excludeFonts:n.excludeFonts??void 0,fallbackURL:n.fallbackURL??void 0,cache:t,useProxy:typeof n.useProxy=="string"?n.useProxy:"",width:n.width??null,height:n.height??null,format:e,type:n.type??"svg",quality:n.quality??.92,dpr:n.dpr??(window.devicePixelRatio||1),backgroundColor:n.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:n.filename??"snapDOM",straighten:n.straighten??!1,noShadows:n.noShadows??!1}}function BI(n){return typeof n=="string"&&/^data:image\/svg\+xml/i.test(n)}function SI(n){const e=n.indexOf(",");return e>=0?decodeURIComponent(n.slice(e+1)):""}function MI(n){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function TI(n){let e=[],t="",i=0;for(let s=0;s<n.length;s++){const o=n[s];o==="("&&i++,o===")"&&(i=Math.max(0,i-1)),o===";"&&i===0?(e.push(t),t=""):t+=o}return t.trim()&&e.push(t),e.map(s=>s.trim()).filter(Boolean)}function DI(n){const e=[];let t="",i=0;for(let o=0;o<n.length;o++){const r=n[o];r==="("&&i++,r===")"&&(i=Math.max(0,i-1)),r===","&&i===0?(e.push(t.trim()),t=""):t+=r}t.trim()&&e.push(t.trim());const s=[];for(const o of e){if(/\binset\b/i.test(o))continue;const r=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",a="0px",c="0px"]=r;let u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," ");const h=!!u&&u!==",";s.push(`drop-shadow(${l} ${a} ${c}${h?` ${u}`:""})`)}return s.join(" ")}function zc(n){const e=TI(n);let t=null,i=null,s=null;const o=[];for(const l of e){const a=l.indexOf(":");if(a<0)continue;const c=l.slice(0,a).trim().toLowerCase(),u=l.slice(a+1).trim();c==="box-shadow"?s=u:c==="filter"?t=u:c==="-webkit-filter"?i=u:o.push([c,u])}if(s){const l=DI(s);l&&(t=t?`${t} ${l}`:l,i=i?`${i} ${l}`:l)}const r=[...o];return t&&r.push(["filter",t]),i&&r.push(["-webkit-filter",i]),r.map(([l,a])=>`${l}:${a}`).join(";")}function kI(n){return n.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,i)=>`${t}{${zc(i)}}`)}function PI(n){return n=n.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,kI(t))),n=n.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,i)=>`style=${t}${zc(i)}${t}`),n}function FI(n){if(!nt()||!BI(n))return n;try{const e=SI(n),t=PI(e);return MI(t)}catch{return n}}async function Ki(n,e){let{width:t,height:i,scale:s=1,dpr:o=1,meta:r={}}=e;n=FI(n);const l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=n,await l.decode();const a=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(r.w0)?r.w0:a,h=Number.isFinite(r.h0)?r.h0:c;let f,p;const A=Number.isFinite(t),C=Number.isFinite(i);if(A&&C)f=Math.max(1,t),p=Math.max(1,i);else if(A){const E=t/Math.max(1,u);f=t,p=Math.round(h*E)}else if(C){const E=i/Math.max(1,h);p=i,f=Math.round(u*E)}else f=a,p=c;f=Math.round(f*s),p=Math.round(p*s);const m=document.createElement("canvas");m.width=Math.ceil(f*o),m.height=Math.ceil(p*o),m.style.width=`${f}px`,m.style.height=`${p}px`;const y=m.getContext("2d");return o!==1&&y.scale(o,o),y.drawImage(l,0,0,f,p),m}async function jc(n,e){const t=await Ki(n,e),i=e.backgroundColor?po(t,e.backgroundColor):t,s=new Image;return s.src=i.toDataURL(`image/${e.format}`,e.quality),await s.decode(),s.style.width=`${i.width/e.dpr}px`,s.style.height=`${i.height/e.dpr}px`,s}async function $c(n,e){const{scale:t=1,width:i,height:s,meta:o={}}=e,r=Number.isFinite(i),l=Number.isFinite(s),a=Number.isFinite(t)&&t!==1||r||l;if(nt()&&a)return await jc(n,{...e,format:"png",quality:1,meta:o});const c=new Image;if(c.decoding="sync",c.loading="eager",c.src=n,await c.decode(),r&&l)c.style.width=`${i}px`,c.style.height=`${s}px`;else if(r){const u=Number.isFinite(o.w0)?o.w0:c.naturalWidth,h=Number.isFinite(o.h0)?o.h0:c.naturalHeight,f=i/Math.max(1,u);c.style.width=`${i}px`,c.style.height=`${Math.round(h*f)}px`}else if(l){const u=Number.isFinite(o.w0)?o.w0:c.naturalWidth,h=Number.isFinite(o.h0)?o.h0:c.naturalHeight,f=s/Math.max(1,h);c.style.height=`${s}px`,c.style.width=`${Math.round(u*f)}px`}else{const u=Math.round(c.naturalWidth*t),h=Math.round(c.naturalHeight*t);if(c.style.width=`${u}px`,c.style.height=`${h}px`,typeof n=="string"&&n.startsWith("data:image/svg+xml"))try{const p=decodeURIComponent(n.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${h}"`);n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,c.src=n}catch{}}return c}async function Kc(n,e){const t=e.type;if(t==="svg"){const o=decodeURIComponent(n.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}const i=await Ki(n,e),s=e.backgroundColor?po(i,e.backgroundColor):i;return new Promise(o=>s.toBlob(r=>o(r),`image/${t}`,e.quality))}async function RI(n,e){if(e.dpr=1,e.format==="svg"){const o=await Kc(n,{...e,type:"svg"}),r=URL.createObjectURL(o),l=document.createElement("a");l.href=r,l.download=e.filename,l.click(),URL.revokeObjectURL(r);return}const t=await Ki(n,e),i=e.backgroundColor?po(t,e.backgroundColor):t,s=document.createElement("a");s.href=i.toDataURL(`image/${e.format}`,e.quality),s.download=e.filename,s.click()}var Xc=Symbol("snapdom.internal"),To=!1;async function Ae(n,e){if(!n)throw new Error("Element cannot be null or undefined");const t=II(e);if(nt()&&(t.embedFonts===!0||LI(n)))for(let i=0;i<3;i++)try{await OI(n,e),console.log("Iteración número:",i),To=!1}catch{}return t.iconFonts&&t.iconFonts.length>0&&Tx(t.iconFonts),t.snap||(t.snap={toPng:(i,s)=>Ae.toPng(i,s),toSvg:(i,s)=>Ae.toSvg(i,s)}),Ae.capture(n,t,Xc)}Ae.capture=async(n,e,t)=>{if(t!==Xc)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const i=await Yc(n,e),s=r=>({...e,...r||{}}),o=r=>l=>{const a=s({...l||{},format:r}),c=r==="jpeg"||r==="jpg",u=a.backgroundColor==null||a.backgroundColor==="transparent";return c&&u&&(a.backgroundColor="#ffffff"),jc(i,a)};return{url:i,toRaw:()=>i,toImg:r=>$c(i,s(r)),toSvg:r=>$c(i,s(r)),toCanvas:r=>Ki(i,s(r)),toBlob:r=>Kc(i,s(r)),toPng:o("png"),toJpg:o("jpeg"),toWebp:o("webp"),download:r=>RI(i,s(r))}},Ae.toRaw=(n,e)=>Ae(n,e).then(t=>t.toRaw()),Ae.toImg=(n,e)=>Ae(n,e).then(t=>t.toImg()),Ae.toSvg=(n,e)=>Ae(n,e).then(t=>t.toSvg()),Ae.toCanvas=(n,e)=>Ae(n,e).then(t=>t.toCanvas()),Ae.toBlob=(n,e)=>Ae(n,e).then(t=>t.toBlob()),Ae.toPng=(n,e)=>Ae(n,{...e,format:"png"}).then(t=>t.toPng()),Ae.toJpg=(n,e)=>Ae(n,{...e,format:"jpeg"}).then(t=>t.toJpg()),Ae.toWebp=(n,e)=>Ae(n,{...e,format:"webp"}).then(t=>t.toWebp()),Ae.download=(n,e)=>Ae(n,e).then(t=>t.download());async function OI(n,e){if(To)return;const t={...e,fast:!0,embedFonts:!0,scale:.2};let i;try{i=await Yc(n,t)}catch{return}await new Promise(s=>{const o=new Image;o.decoding="sync",o.loading="eager",o.style.position="fixed",o.style.left=0,o.style.top=0,o.style.width="10px",o.style.height="10px",o.style.opacity="0.01",o.style.transform="translateZ(10px)",o.style.willChange="transform,opacity;",o.src=i;const r=async()=>{await new Promise(l=>setTimeout(l,100)),o&&o.parentNode&&o.parentNode.removeChild(o),To=!0,s()};document.body.appendChild(o),r()})}function LI(n){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const t=e.currentNode,i=getComputedStyle(t),s=i.backgroundImage&&i.backgroundImage!=="none",o=i.maskImage&&i.maskImage!=="none"||i.webkitMaskImage&&i.webkitMaskImage!=="none";if(s||o)return!0}return!1}async function NI(n=document,e={}){const{embedFonts:t=!0,useProxy:i=""}=e,s=e.cache??e.cacheOpt??"full";gc(s);try{await document.fonts?.ready}catch{}try{Kv()}catch{}W.session=W.session||{},W.session.styleCache||(W.session.styleCache=new WeakMap),W.image=W.image||new Map;try{await Gc(n,void 0,W.session.styleCache,{useProxy:i})}catch{}let o=[],r=[];try{n?.querySelectorAll&&(o=Array.from(n.querySelectorAll("img[src]")),r=Array.from(n.querySelectorAll("*")))}catch{}const l=[];for(const a of o){const c=a?.currentSrc||a?.src;if(c&&!W.image.has(c)){const u=Promise.resolve().then(async()=>{const h=await je(c,{as:"dataURL",useProxy:i});h?.ok&&typeof h.data=="string"&&W.image.set(c,h.data)}).catch(()=>{});l.push(u)}}for(const a of r){let c="";try{c=Ao(a).backgroundImage}catch{}if(c&&c!=="none"){const u=yo(c);for(const h of u)if(h.startsWith("url(")){const f=Promise.resolve().then(()=>go(h,{...e,useProxy:i})).catch(()=>{});l.push(f)}}}if(t)try{const a=Fc(n),c=Rc(n);if(typeof nt=="function"?nt():!!nt){const h=new Set(Array.from(a).map(f=>String(f).split("__")[0]).filter(Boolean));await Oc(h,3)}await Pc({required:a,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??i})}catch{}await Promise.allSettled(l)}const UI=Object.freeze(Object.defineProperty({__proto__:null,preCache:NI,snapdom:Ae},Symbol.toStringTag,{value:"Module"}));_.DEFAULT_CESIUM_CONFIG=It,_.LeiTingBIM=Qi,_.LeiTingDraggableCard=Re,_.LeiTingInfo=Qn,_.LeiTingMenu=Nn,_.LeiTingPlayer=_n,_.LeiTingPosition=Hn,_.LeiTingSection=Un,_.LeiTingSetting=Gn,_.LeiTingTree=Pi,_.LeitingBIM=Qi,_.LeitingDraggableCard=Re,_.LeitingInfo=Qn,_.LeitingMenu=Nn,_.LeitingPlayer=_n,_.LeitingPosition=Hn,_.LeitingSection=Un,_.LeitingSetting=Gn,_.LeitingTree=Pi,_.default=Qv,_.getAccessToken=ns,_.leitingBim=Qi,_.loadCesium=ts,_.useLeiTing=pc,_.useLeiting=pc,_.waitForCesium=ld,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
124
+ `):u+=f[0]}return u+=l.slice(h),u}let r=xc(n,e||location.href);return r=await o(r,e||location.href,0),r}var Bc=/url\((["']?)([^"')]+)\1\)/g,GI=/@font-face[^{}]*\{[^}]*\}/g;function Sc(n){if(!n)return[];const e=[],t=n.split(",").map(i=>i.trim()).filter(Boolean);for(const i of t){const s=i.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;const o=s[1],r=s[2],l=a=>{if(!a.includes("?"))return parseInt(a,16);const c=parseInt(a.replace(/\?/g,"0"),16),u=parseInt(a.replace(/\?/g,"F"),16);return[c,u]};if(r){const a=l(o),c=l(r),u=Array.isArray(a)?a[0]:a,h=Array.isArray(c)?c[1]:c;e.push([Math.min(u,h),Math.max(u,h)])}else{const a=l(o);Array.isArray(a)?e.push([a[0],a[1]]):e.push([a,a])}}return e}function Mc(n,e){if(!e.length||!n||n.size===0)return!0;for(const t of n)for(const[i,s]of e)if(t>=i&&t<=s)return!0;return!1}function xo(n,e){const t=[];if(!n)return t;for(const i of n.matchAll(Bc)){let s=(i[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}t.push(s)}}return t}async function Tc(n,e,t=""){let i=n;for(const s of n.matchAll(Bc)){const o=ho(s[0]);if(!o)continue;let r=o;if(!r.startsWith("http")&&!r.startsWith("data:"))try{r=new URL(r,e||location.href).href}catch{}if(!lt(r)){if(W.resource?.has(r)){W.font?.add(r),i=i.replace(s[0],`url(${W.resource.get(r)})`);continue}if(!W.font?.has(r))try{const l=await je(r,{as:"dataURL",useProxy:t,silent:!0});if(l.ok&&typeof l.data=="string"){const a=l.data;W.resource?.set(r,a),W.font?.add(r),i=i.replace(s[0],`url(${a})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",r)}}}return i}function YI(n){if(!n.length)return null;const e=(l,a)=>n.some(([c,u])=>!(u<l||c>a)),t=e(0,255)||e(305,305),i=e(256,591)||e(7680,7935),s=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":s?"greek":i?"latin-ext":t?"latin":null}function Dc(n={}){const e=new Set((n.families||[]).map(s=>String(s).toLowerCase())),t=new Set((n.domains||[]).map(s=>String(s).toLowerCase())),i=new Set((n.subsets||[]).map(s=>String(s).toLowerCase()));return(s,o)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(t.size)for(const r of s.srcUrls)try{if(t.has(new URL(r).host.toLowerCase()))return!0}catch{}if(i.size){const r=YI(o);if(r&&i.has(r))return!0}return!1}}function VI(n){if(!n)return n;const e=/@font-face[^{}]*\{[^}]*\}/gi,t=new Set,i=[];for(const o of n.match(e)||[]){const r=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Wi(r),a=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),p=xo(f,location.href),A=p.length?p.map(m=>String(m).toLowerCase()).sort().join("|"):f.toLowerCase(),C=[String(l||"").toLowerCase(),a,c,u,h.toLowerCase(),A].join("|");t.has(C)||(t.add(C),i.push(o))}if(i.length===0)return n;let s=0;return n.replace(e,()=>i[s++]||"")}function WI(n,e,t,i){const s=Array.from(n||[]).sort().join("|"),o=e?JSON.stringify({families:(e.families||[]).map(a=>String(a).toLowerCase()).sort(),domains:(e.domains||[]).map(a=>String(a).toLowerCase()).sort(),subsets:(e.subsets||[]).map(a=>String(a).toLowerCase()).sort()}):"",r=(t||[]).map(a=>`${(a.family||"").toLowerCase()}::${a.weight||"normal"}::${a.style||"normal"}::${a.src||""}`).sort().join("|");return`fonts-embed-css::req=${s}::ex=${o}::lf=${r}::px=${i||""}`}async function kc(n,e,t,i){let s;try{s=n.cssRules||[]}catch{return}const o=(r,l)=>{try{return new URL(r,l||location.href).href}catch{return r}};for(const r of s){if(r.type===CSSRule.IMPORT_RULE&&r.styleSheet){const l=r.href?o(r.href,e):e;if(i.depth>=ji){console.warn(`[snapDOM] CSSOM import depth exceeded (${ji}) at ${l}`);continue}if(l&&i.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&i.visitedSheets.add(l);const a={...i,depth:(i.depth||0)+1};await kc(r.styleSheet,l,t,a);continue}if(r.type===CSSRule.FONT_FACE_RULE){const l=(r.style.getPropertyValue("font-family")||"").trim(),a=Wi(l);if(!a||lt(a))continue;const c=(r.style.getPropertyValue("font-weight")||"400").trim(),u=(r.style.getPropertyValue("font-style")||"normal").trim(),h=(r.style.getPropertyValue("font-stretch")||"100%").trim(),f=(r.style.getPropertyValue("src")||"").trim(),p=(r.style.getPropertyValue("unicode-range")||"").trim();if(!i.faceMatchesRequired(a,u,c,h))continue;const A=Sc(p);if(!Mc(i.usedCodepoints,A))continue;const C={family:a,weightSpec:c,styleSpec:u,stretchSpec:h,unicodeRange:p,srcRaw:f,srcUrls:xo(f,e||location.href),href:e||location.href};if(i.simpleExcluder&&i.simpleExcluder(C,A))continue;if(/url\(/i.test(f)){const m=await Tc(f,e||location.href,i.useProxy);await t(`@font-face{font-family:${a};src:${m};font-style:${u};font-weight:${c};font-stretch:${h};${p?`unicode-range:${p};`:""}}`)}else await t(`@font-face{font-family:${a};src:${f};font-style:${u};font-weight:${c};font-stretch:${h};${p?`unicode-range:${p};`:""}}`)}}}async function Pc({required:n,usedCodepoints:e,exclude:t=void 0,localFonts:i=[],useProxy:s=""}={}){n instanceof Set||(n=new Set),e instanceof Set||(e=new Set);const o=new Map;for(const C of n){const[m,y,E,I]=String(C).split("__");if(!m)continue;const M=o.get(m)||[];M.push({w:parseInt(y,10),s:E,st:parseInt(I,10)}),o.set(m,M)}function r(C,m,y,E){if(!o.has(C))return!1;const I=o.get(C),M=LI(y),k=NI(m),S=UI(E),x=M.min!==M.max,g=M.min,F=P=>k.kind==="normal"&&P==="normal"||k.kind!=="normal"&&(P==="italic"||P==="oblique");let D=!1;for(const P of I){const L=x?P.w>=M.min&&P.w<=M.max:P.w===g,G=F(vo(P.s)),N=P.st>=S.min&&P.st<=S.max;if(L&&G&&N){D=!0;break}}if(D)return!0;if(!x)for(const P of I){const L=F(vo(P.s)),G=P.st>=S.min&&P.st<=S.max;if(Math.abs(g-P.w)<=300&&L&&G)return!0}return!1}const l=Dc(t),a=WI(n,t,i,s);if(W.resource?.has(a))return W.resource.get(a);const c=QI(n),u=[],h=Io;for(const C of document.querySelectorAll("style")){const m=C.textContent||"";for(const y of m.matchAll(h)){const E=(y[2]||y[4]||"").trim();if(!E||lt(E))continue;document.querySelector(`link[rel="stylesheet"][href="${E}"]`)||u.push(E)}}u.length&&await Promise.all(u.map(C=>new Promise(m=>{if(document.querySelector(`link[rel="stylesheet"][href="${C}"]`))return m(null);const y=document.createElement("link");y.rel="stylesheet",y.href=C,y.setAttribute("data-snapdom","injected-import"),y.onload=()=>m(y),y.onerror=()=>m(null),document.head.appendChild(y)})));let f="";const p=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(C=>!!C.href);for(const C of p)try{if(lt(C.href))continue;let m="",y=!1;try{y=new URL(C.href,location.href).origin===location.origin}catch{}if(!y&&!_I(C.href,c))continue;if(y){const I=Array.from(document.styleSheets).find(M=>M.href===C.href);if(I)try{const M=I.cssRules||[];m=Array.from(M).map(k=>k.cssText).join("")}catch{}}if(!m&&(m=(await je(C.href,{as:"text",useProxy:s})).data,lt(C.href)))continue;m=await HI(m,C.href,s);let E="";for(const I of m.match(GI)||[]){const M=(I.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),k=Wi(M);if(!k||lt(k))continue;const S=(I.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),x=(I.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),g=(I.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),F=(I.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),D=(I.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),P=xo(D,C.href);if(!r(k,x,S,g))continue;const L=Sc(F);if(!Mc(e,L))continue;const G={family:k,weightSpec:S,styleSpec:x,stretchSpec:g,unicodeRange:F,srcRaw:D,srcUrls:P,href:C.href};if(t&&l(G,L))continue;const N=/url\(/i.test(D)?await Tc(I,C.href,s):I;E+=N}E.trim()&&(f+=E)}catch{console.warn("[snapDOM] Failed to process stylesheet:",C.href)}const A={requiredIndex:o,usedCodepoints:e,faceMatchesRequired:r,simpleExcluder:t?Dc(t):null,useProxy:s,visitedSheets:new Set,depth:0};for(const C of document.styleSheets)if(!(C.href&&p.some(m=>m.href===C.href)))try{const m=C.href||location.href;m&&A.visitedSheets.add(m),await kc(C,m,async y=>{f+=y},A)}catch{}try{for(const C of document.fonts||[]){if(!C||!C.family||C.status!=="loaded"||!C._snapdomSrc)continue;const m=String(C.family).replace(/^['"]+|['"]+$/g,"");if(lt(m)||!o.has(m)||t?.families&&t.families.some(E=>String(E).toLowerCase()===m.toLowerCase()))continue;let y=C._snapdomSrc;if(!String(y).startsWith("data:")){if(W.resource?.has(C._snapdomSrc))y=W.resource.get(C._snapdomSrc),W.font?.add(C._snapdomSrc);else if(!W.font?.has(C._snapdomSrc))try{const E=await je(C._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(E.ok&&typeof E.data=="string")y=E.data,W.resource?.set(C._snapdomSrc,y),W.font?.add(C._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",C._snapdomSrc);continue}}f+=`@font-face{font-family:'${m}';src:url(${y});font-style:${C.style||"normal"};font-weight:${C.weight||"normal"};}`}}catch{}for(const C of i){if(!C||typeof C!="object")continue;const m=String(C.family||"").replace(/^['"]+|['"]+$/g,"");if(!m||lt(m)||!o.has(m)||t?.families&&t.families.some(S=>String(S).toLowerCase()===m.toLowerCase()))continue;const y=C.weight!=null?String(C.weight):"normal",E=C.style!=null?String(C.style):"normal",I=C.stretchPct!=null?`${C.stretchPct}%`:"100%",M=String(C.src||"");let k=M;if(!k.startsWith("data:")){if(W.resource?.has(M))k=W.resource.get(M),W.font?.add(M);else if(!W.font?.has(M))try{const S=await je(M,{as:"dataURL",useProxy:s,silent:!0});if(S.ok&&typeof S.data=="string")k=S.data,W.resource?.set(M,k),W.font?.add(M);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",M);continue}}f+=`@font-face{font-family:'${m}';src:url(${k});font-style:${E};font-weight:${y};font-stretch:${I};}`}return f&&(f=VI(f),W.resource?.set(a,f)),f}function Fc(n){const e=new Set;if(!n)return e;const t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,null),i=r=>{const l=Wi(r.fontFamily);if(!l)return;const a=(c,u,h)=>`${l}__${zi(c)}__${vo(u)}__${OI(h)}`;e.add(a(r.fontWeight,r.fontStyle,r.fontStretch))};i(getComputedStyle(n));const s=getComputedStyle(n,"::before");s&&s.content&&s.content!=="none"&&i(s);const o=getComputedStyle(n,"::after");for(o&&o.content&&o.content!=="none"&&i(o);t.nextNode();){const r=t.currentNode,l=getComputedStyle(r);i(l);const a=getComputedStyle(r,"::before");a&&a.content&&a.content!=="none"&&i(a);const c=getComputedStyle(r,"::after");c&&c.content&&c.content!=="none"&&i(c)}return e}function Rc(n){const e=new Set,t=s=>{if(s)for(const o of s)e.add(o.codePointAt(0))},i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;i.nextNode();){const s=i.currentNode;if(s.nodeType===Node.TEXT_NODE)t(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){const o=s;for(const r of["::before","::after"]){const a=getComputedStyle(o,r)?.getPropertyValue("content");if(!(!a||a==="none"))if(/^"/.test(a)||/^'/.test(a))t(a.slice(1,-1));else{const c=a.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(const u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function Oc(n,e=2){try{await document.fonts.ready}catch{}const t=Array.from(n||[]).filter(Boolean);if(t.length===0)return;const i=()=>{const s=document.createElement("div");s.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const o of t){const r=document.createElement("span");r.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",r.style.fontFamily=`"${o}"`,r.style.fontWeight="700",r.style.fontStyle="italic",r.style.fontSize="32px",r.style.lineHeight="1",r.style.whiteSpace="nowrap",r.style.margin="0",r.style.padding="0",s.appendChild(r)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)i(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}function zI(n){return/\bcounter\s*\(|\bcounters\s*\(/.test(n||"")}function jI(n){return(n||"").replace(/"([^"]*)"/g,"$1")}function Lc(n,e=!1){let t="",i=Math.max(1,n);for(;i>0;)i--,t=String.fromCharCode(97+i%26)+t,i=Math.floor(i/26);return e?t.toUpperCase():t}function Nc(n,e=!0){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let i=Math.max(1,Math.min(3999,n)),s="";for(const[o,r]of t)for(;i>=o;)s+=r,i-=o;return e?s:s.toLowerCase()}function Uc(n,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,n));case"decimal-leading-zero":return(n<10?"0":"")+String(Math.max(0,n));case"lower-alpha":return Lc(n,!1);case"upper-alpha":return Lc(n,!0);case"lower-roman":return Nc(n,!1);case"upper-roman":return Nc(n,!0);default:return String(Math.max(0,n))}}function $I(n){const e=new WeakMap,t=n instanceof Document?n.documentElement:n,i=c=>c&&c.tagName==="LI",s=c=>{let u=0,h=c?.parentElement;if(!h)return 0;for(const f of h.children){if(f===c)break;f.tagName==="LI"&&u++}return u},o=c=>{const u=new Map;for(const[h,f]of c)u.set(h,f.slice());return u},r=(c,u,h)=>{const f=o(c);let p;try{p=h.style?.counterReset||getComputedStyle(h).counterReset}catch{}if(p&&p!=="none")for(const C of p.split(",")){const m=C.trim().split(/\s+/),y=m[0],E=Number.isFinite(Number(m[1]))?Number(m[1]):0;if(!y)continue;const I=u.get(y);if(I&&I.length){const M=I.slice();M.push(E),f.set(y,M)}else f.set(y,[E])}let A;try{A=h.style?.counterIncrement||getComputedStyle(h).counterIncrement}catch{}if(A&&A!=="none")for(const C of A.split(",")){const m=C.trim().split(/\s+/),y=m[0],E=Number.isFinite(Number(m[1]))?Number(m[1]):1;if(!y)continue;const I=f.get(y)||[];I.length===0&&I.push(0),I[I.length-1]+=E,f.set(y,I)}try{if(getComputedStyle(h).display==="list-item"&&i(h)){const m=h.parentElement;let y=1;if(m&&m.tagName==="OL"){const I=m.getAttribute("start"),M=Number.isFinite(Number(I))?Number(I):1,k=s(h),S=h.getAttribute("value");y=Number.isFinite(Number(S))?Number(S):M+k}else y=1+s(h);const E=f.get("list-item")||[];E.length===0&&E.push(0),E[E.length-1]=y,f.set("list-item",E)}}catch{}return f},l=(c,u,h)=>{const f=r(h,u,c);e.set(c,f);let p=f;for(const A of c.children)p=l(A,f,p);return f},a=new Map;return l(t,a,a),{get(c,u){const h=e.get(c)?.get(u);return h&&h.length?h[h.length-1]:0},getStack(c,u){const h=e.get(c)?.get(u);return h?h.slice():[]}}}function KI(n,e,t){if(!n||n==="none")return n;try{const i=/\b(counter|counters)\s*\(([^)]+)\)/g;let s=n.replace(i,(o,r,l)=>{const a=String(l).split(",").map(c=>c.trim());if(r==="counter"){const c=a[0]?.replace(/^["']|["']$/g,""),u=(a[1]||"decimal").toLowerCase(),h=t.get(e,c);return Uc(h,u)}else{const c=a[0]?.replace(/^["']|["']$/g,""),u=a[1]?.replace(/^["']|["']$/g,"")??"",h=(a[2]||"decimal").toLowerCase(),f=t.getStack(e,c);return f.length?f.map(A=>Uc(A,h)).join(u):""}});return jI(s)}catch{return"- "}}var Vn=null,Wn=new WeakMap;function XI(n){return(n||"").replace(/"([^"]*)"/g,"$1")}function qI(n){if(!n)return"";const e=[],t=/"([^"]*)"/g;let i;for(;i=t.exec(n);)e.push(i[1]);return e.length?e.join(""):XI(n)}function Bo(n,e){const t=n.parentElement,i=t?Wn.get(t):null;return i?{get(s,o){const r=e.get(s,o),l=i.get(o);return typeof l=="number"?Math.max(r,l):r},getStack(s,o){const r=e.getStack(s,o);if(!r.length)return r;const l=i.get(o);if(typeof l=="number"){const a=r.slice();return a[a.length-1]=Math.max(a[a.length-1],l),a}return r}}:e}function So(n,e,t){const i=new Map;function s(a){const c=[];if(!a||a==="none")return c;for(const u of String(a).split(",")){const h=u.trim().split(/\s+/),f=h[0],p=Number.isFinite(Number(h[1]))?Number(h[1]):void 0;f&&c.push({name:f,num:p})}return c}const o=s(e?.counterReset),r=s(e?.counterIncrement);function l(a){if(i.has(a))return i.get(a).slice();let c=t.getStack(n,a);c=c.length?c.slice():[];const u=o.find(f=>f.name===a);if(u){const f=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,f]:[f]}const h=r.find(f=>f.name===a);if(h){const f=Number.isFinite(h.num)?h.num:1;c.length===0&&(c=[0]),c[c.length-1]+=f}return i.set(a,c.slice()),c}return{get(a,c){const u=l(c);return u.length?u[u.length-1]:0},getStack(a,c){return l(c)},__incs:r}}function JI(n,e,t){let i;try{i=getComputedStyle(n,e)}catch{}const s=i?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};const o=Bo(n,t),r=So(n,i,o);let l=zI(s)?KI(s,n,r):s;return{text:qI(l),incs:r.__incs||[]}}async function _c(n,e,t,i){if(!(n instanceof Element)||!(e instanceof Element))return;if(!Vn)try{Vn=$I(n.ownerDocument||document)}catch{}for(const r of["::before","::after","::first-letter"])try{const l=Ao(n,r);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(r==="::first-letter"){const v=getComputedStyle(n);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;const R=Array.from(e.childNodes).find(re=>re.nodeType===Node.TEXT_NODE&&re.textContent?.trim().length>0);if(!R)continue;const U=R.textContent,T=U.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Q=U.slice(T?.length||0);if(!T||/[\uD800-\uDFFF]/.test(T))continue;const V=document.createElement("span");V.textContent=T,V.dataset.snapdomPseudo="::first-letter";const $=wc(l),J=mo($,"span");t.styleMap.set(V,J);const ne=document.createTextNode(Q);e.replaceChild(ne,R),e.insertBefore(V,ne);continue}const c=l.content,{text:u,incs:h}=JI(n,r,Vn),f=l.backgroundImage,p=l.backgroundColor,A=l.fontFamily,C=parseInt(l.fontSize)||32,m=parseInt(l.fontWeight)||!1,y=l.color||"#000",E=l.borderStyle,I=parseFloat(l.borderWidth),M=l.transform,k=lt(A),S=c!=="none"&&u!=="",x=f&&f!=="none",g=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",F=E&&E!=="none"&&I>0,D=M&&M!=="none";if(!(S||x||g||F||D)){if(h&&h.length&&n.parentElement){const v=Wn.get(n.parentElement)||new Map;for(const{name:B}of h){if(!B)continue;const R=Bo(n,Vn),O=So(n,getComputedStyle(n,r),R).get(n,B);v.set(B,O)}Wn.set(n.parentElement,v)}continue}const L=document.createElement("span");L.dataset.snapdomPseudo=r,L.style.verticalAlign="middle",L.style.pointerEvents="none";const G=wc(l),N=mo(G,"span");if(t.styleMap.set(L,N),k&&u&&u.length===1){const{dataUrl:v,width:B,height:R}=await FI(u,A,m,C,y),U=document.createElement("img");U.src=v,U.style=`height:${C}px;width:${B/R*C}px;object-fit:contain;`,L.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){const v=ho(u);if(v?.trim())try{const B=document.createElement("img"),R=await je(Hi(v),{as:"dataURL",useProxy:i.useProxy});B.src=R.data,B.style=`width:${C}px;height:auto;object-fit:contain;`,L.appendChild(B)}catch(B){console.error(`[snapdom] Error in pseudo ${r} for`,n,B)}}else!k&&S&&(L.textContent=u);if(L.style.background="none","mask"in L.style&&(L.style.mask="none"),x)try{const v=yo(f),B=await Promise.all(v.map(go));L.style.backgroundImage=B.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${r}`,v)}g&&(L.style.backgroundColor=p);const w=L.childNodes.length>0||L.textContent?.trim()!==""||x||g||F||D;if(h&&h.length&&n.parentElement){const v=Wn.get(n.parentElement)||new Map,B=Bo(n,Vn),R=So(n,getComputedStyle(n,r),B);for(const{name:U}of h){if(!U)continue;const O=R.get(n,U);v.set(U,O)}Wn.set(n.parentElement,v)}if(!w)continue;r==="::before"?e.insertBefore(L,e.firstChild):e.appendChild(L)}catch(l){console.warn(`[snapdom] Failed to capture ${r} for`,n,l)}const s=Array.from(n.children),o=Array.from(e.children).filter(r=>!r.dataset.snapdomPseudo);for(let r=0;r<Math.min(s.length,o.length);r++)await _c(s[r],o[r],t,i)}function ZI(n){if(!n)return;const e=new Set;if(n.querySelectorAll("use").forEach(l=>{const a=l.getAttribute("xlink:href")||l.getAttribute("href");a&&a.startsWith("#")&&e.add(a.slice(1))}),!e.size)return;const t=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),i=t.filter(l=>l.tagName.toLowerCase()==="symbol"),s=t.filter(l=>l.tagName.toLowerCase()==="defs");let o=n.querySelector("svg.inline-defs-container");o||(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("aria-hidden","true"),o.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),o.classList.add("inline-defs-container"),n.insertBefore(o,n.firstChild));const r=new Set;n.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{r.add(l.id)}),e.forEach(l=>{if(r.has(l))return;const a=i.find(c=>c.id===l);if(a){o.appendChild(a.cloneNode(!0)),r.add(l);return}for(const c of s){const u=c.querySelector(`#${CSS.escape(l)}`);if(u){let h=o.querySelector("defs");h||(h=document.createElementNS("http://www.w3.org/2000/svg","defs"),o.appendChild(h)),h.appendChild(u.cloneNode(!0)),r.add(l);break}}})}function ex(n,e){if(!n||!e)return;const t=n.scrollTop||0;if(!t)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");const i=n.getBoundingClientRect(),s=n.clientHeight,o="data-snap-ph",r=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){const l=r.currentNode,a=getComputedStyle(l),c=a.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;const u=Qc(a.top),h=Qc(a.bottom);if(u==null&&h==null)continue;const f=tx(l,n),p=nx(e,f,o);if(!p)continue;const A=l.getBoundingClientRect(),C=A.width,m=A.height,y=A.left-i.left;if(!(C>0&&m>0)||!Number.isFinite(y))continue;const E=u!=null?u+t:t+(s-m-h);if(!Number.isFinite(E))continue;const I=Number.parseInt(a.zIndex,10),M=Number.isFinite(I),k=M?Math.max(I,1)+1:2,S=M?I-1:0,x=p.cloneNode(!1);x.setAttribute(o,"1"),x.style.position="sticky",x.style.left=`${y}px`,x.style.top=`${E}px`,x.style.width=`${C}px`,x.style.height=`${m}px`,x.style.visibility="hidden",x.style.zIndex=String(S),x.style.overflow="hidden",x.style.background="transparent",x.style.boxShadow="none",x.style.filter="none",p.parentElement?.insertBefore(x,p),p.style.position="absolute",p.style.left=`${y}px`,p.style.top=`${E}px`,p.style.bottom="auto",p.style.zIndex=String(k),p.style.pointerEvents="none"}}function Qc(n){if(!n||n==="auto")return null;const e=Number.parseFloat(n);return Number.isFinite(e)?e:null}function tx(n,e){const t=[];for(let i=n;i&&i!==e;){const s=i.parentElement;if(!s)break;t.push(Array.prototype.indexOf.call(s.children,i)),i=s}return t.reverse()}function nx(n,e,t){let i=n;for(let s=0;s<e.length;s++)if(i=ix(i,t)[e[s]],!i)return null;return i instanceof HTMLElement?i:null}function ix(n,e){const t=[],i=n.children;for(let s=0;s<i.length;s++){const o=i[s];o.hasAttribute(e)||t.push(o)}return t}async function sx(n,e={}){const t={styleMap:W.session.styleMap,styleCache:W.session.styleCache,nodeMap:W.session.nodeMap};let i,s="",o="";ox(n);try{ZI(n)}catch(a){console.warn("inlineExternal defs or symbol failed:",a)}try{i=await Vi(n,t,e,n)}catch(a){throw console.warn("deepClone failed:",a),a}try{await _c(n,i,t,e)}catch(a){console.warn("inlinePseudoElements failed:",a)}await cx(i);try{const a=i.querySelectorAll("style[data-sd]");for(const c of a)o+=c.textContent||"",c.remove()}catch{}const r=sI(t.styleMap);s=Array.from(r.entries()).map(([a,c])=>`.${c}{${a}}`).join(""),s=o+s;for(const[a,c]of t.styleMap.entries()){if(a.tagName==="STYLE")continue;if(a.getRootNode&&a.getRootNode()instanceof ShadowRoot){a.setAttribute("style",c.replace(/;/g,"; "));continue}const u=r.get(c);u&&a.classList.add(u);const h=a.style?.backgroundImage,f=a.dataset?.snapdomHasIcon;h&&h!=="none"&&(a.style.backgroundImage=h),f&&(a.style.verticalAlign="middle",a.style.display="inline")}for(const[a,c]of t.nodeMap.entries()){const u=c.scrollLeft,h=c.scrollTop;if((u||h)&&a instanceof HTMLElement){a.style.overflow="hidden",a.style.scrollbarWidth="none",a.style.msOverflowStyle="none";const p=document.createElement("div");for(p.style.transform=`translate(${-u}px, ${-h}px)`,p.style.willChange="transform",p.style.display="inline-block",p.style.width="100%";a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p)}}const l=i instanceof HTMLElement&&i.firstElementChild instanceof HTMLElement?i.firstElementChild:i;if(ex(n,l),n===t.nodeMap.get(i)){const a=t.styleCache.get(n)||window.getComputedStyle(n);t.styleCache.set(n,a);const c=Vv(a.transform);i.style.margin="0",i.style.top="auto",i.style.left="auto",i.style.right="auto",i.style.bottom="auto",i.style.animation="none",i.style.transition="none",i.style.willChange="auto",i.style.float="none",i.style.clear="none",i.style.transform=c||""}for(const[a,c]of t.nodeMap.entries())c.tagName==="PRE"&&(a.style.marginTop="0",a.style.marginBlockStart="0");return{clone:i,classCSS:s,styleCache:t.styleCache}}function ox(n){const e=getComputedStyle(n),t=e.outlineStyle,i=e.outlineWidth,s=e.borderStyle,o=e.borderWidth,r=t!=="none"&&parseFloat(i)>0,l=s==="none"||parseFloat(o)===0;r&&l&&(n.style.border=`${i} solid transparent`)}var zn=new Map;async function jn(n){if(W.resource?.has(n))return W.resource.get(n);if(zn.has(n))return zn.get(n);const e=(async()=>{const t=await je(n,{as:"dataURL",silent:!0});if(!t.ok||typeof t.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${n}`);return W.resource?.set(n,t.data),t.data})();zn.set(n,e);try{const t=await e;return zn.set(n,t),t}catch(t){throw zn.delete(n),t}}var rx=/\bblob:[^)"'\s]+/g;async function Hc(n){if(!n||n.indexOf("blob:")===-1)return n;const e=Array.from(new Set(n.match(rx)||[]));if(e.length===0)return n;let t=n;for(const i of e)try{const s=await jn(i);t=t.split(i).join(s)}catch{}return t}function $i(n){return typeof n=="string"&&n.startsWith("blob:")}function ax(n){return(n||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{const t=e.match(/^(\S+)(\s+.+)?$/);return t?{url:t[1],desc:t[2]||""}:null}).filter(Boolean)}function lx(n){return n.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function cx(n){if(!n)return;const e=n.querySelectorAll?n.querySelectorAll("img"):[];for(const r of e)try{const a=r.getAttribute("src")||r.currentSrc||"";if($i(a)){const u=await jn(a);r.setAttribute("src",u)}const c=r.getAttribute("srcset");if(c&&c.includes("blob:")){const u=ax(c);let h=!1;for(const f of u)if($i(f.url))try{f.url=await jn(f.url),h=!0}catch{}h&&r.setAttribute("srcset",lx(u))}}catch{}const t=n.querySelectorAll?n.querySelectorAll("image"):[];for(const r of t)try{const l="http://www.w3.org/1999/xlink",a=r.getAttribute("href")||r.getAttributeNS?.(l,"href");if($i(a)){const c=await jn(a);r.setAttribute("href",c),r.removeAttributeNS?.(l,"href")}}catch{}const i=n.querySelectorAll?n.querySelectorAll("[style*='blob:']"):[];for(const r of i)try{const l=r.getAttribute("style");if(l&&l.includes("blob:")){const a=await Hc(l);r.setAttribute("style",a)}}catch{}const s=n.querySelectorAll?n.querySelectorAll("style"):[];for(const r of s)try{const l=r.textContent||"";l.includes("blob:")&&(r.textContent=await Hc(l))}catch{}const o=["poster"];for(const r of o){const l=n.querySelectorAll?n.querySelectorAll(`[${r}^='blob:']`):[];for(const a of l)try{const c=a.getAttribute(r);$i(c)&&a.setAttribute(r,await jn(c))}catch{}}}async function dx(n,e={}){const t=Array.from(n.querySelectorAll("img")),i=async s=>{if(!s.getAttribute("src")){const u=s.currentSrc||s.src||"";u&&s.setAttribute("src",u)}s.removeAttribute("srcset"),s.removeAttribute("sizes");const o=s.src||"";if(!o)return;const r=await je(o,{as:"dataURL",useProxy:e.useProxy});if(r.ok&&typeof r.data=="string"&&r.data.startsWith("data:")){s.src=r.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}const{fallbackURL:l}=e||{};if(l)try{const u=parseInt(s.dataset?.snapdomWidth||"",10)||0,h=parseInt(s.dataset?.snapdomHeight||"",10)||0,f=parseInt(s.getAttribute("width")||"",10)||0,p=parseInt(s.getAttribute("height")||"",10)||0,A=parseFloat(s.style?.width||"")||0,C=parseFloat(s.style?.height||"")||0,m=u||A||f||s.width||void 0,y=h||C||p||s.height||void 0,E=typeof l=="function"?await l({width:m,height:y,src:o,element:s}):l;if(E){const I=await je(E,{as:"dataURL",useProxy:e.useProxy});s.src=I.data,!s.width&&m&&(s.width=m),!s.height&&y&&(s.height=y),s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}}catch{}const a=s.width||s.naturalWidth||100,c=s.height||s.naturalHeight||100;if(e.placeholders!==!1){const u=document.createElement("div");u.style.cssText=[`width:${a}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",s.replaceWith(u)}else{const u=document.createElement("div");u.style.cssText=`display:inline-block;width:${a}px;height:${c}px;visibility:hidden;`,s.replaceWith(u)}};for(let s=0;s<t.length;s+=4){const o=t.slice(s,s+4).map(i);await Promise.allSettled(o)}}async function Gc(n,e,t,i={}){const s=[[n,e]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],r=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){const[a,c]=s.shift(),u=t.get(a)||Ao(a);t.has(a)||t.set(a,u);const h=(()=>{const A=u.getPropertyValue("border-image"),C=u.getPropertyValue("border-image-source");return A&&A!=="none"||C&&C!=="none"})();for(const A of o){const C=u.getPropertyValue(A);if(!C||C==="none")continue;const m=yo(C),y=await Promise.all(m.map(E=>go(E,i)));y.some(E=>E&&E!=="none"&&!/^url\(undefined/.test(E))&&c.style.setProperty(A,y.join(", "))}for(const A of r){const C=u.getPropertyValue(A);!C||C==="initial"||c.style.setProperty(A,C)}if(h)for(const A of l){const C=u.getPropertyValue(A);!C||C==="initial"||c.style.setProperty(A,C)}const f=Array.from(a.children),p=Array.from(c.children);for(let A=0;A<Math.min(f.length,p.length);A++)s.push([f[A],p[A]])}}function ux(n){if(!n)return()=>{};const e=hx(n);if(e<=0)return()=>{};if(!gx(n))return()=>{};const t=getComputedStyle(n),i=Math.round(fx(t)*e+px(t)),s=n.textContent??"",o=s;if(n.scrollHeight<=i+.5)return()=>{};let r=0,l=s.length,a=-1;for(;r<=l;){const c=r+l>>1;n.textContent=s.slice(0,c)+"…",n.scrollHeight<=i+.5?(a=c,r=c+1):l=c-1}return n.textContent=(a>=0?s.slice(0,a):"")+"…",()=>{n.textContent=o}}function hx(n){const e=getComputedStyle(n);let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();const i=parseInt(t,10);return Number.isFinite(i)&&i>0?i:0}function fx(n){const e=(n.lineHeight||"").trim(),t=parseFloat(n.fontSize)||16;return!e||e==="normal"?Math.round(t*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*t):e.endsWith("%")?Math.round(parseFloat(e)/100*t):Math.round(t*1.2)}function px(n){return(parseFloat(n.paddingTop)||0)+(parseFloat(n.paddingBottom)||0)}function gx(n){return n.childElementCount>0?!1:Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function mx(n,e){if(!n||!e||!e.style)return;const t=getComputedStyle(n);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const s=(t.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=s.length?s:"none"}catch{}}async function Yc(n,e){if(!n)throw new Error("Element cannot be null or undefined");gc(e.cache);const t=e.fast,i=!!e.straighten,s=!!e.noShadows;let o,r,l,a="",c="",u,h,f=null;const p=ux(n);try{({clone:o,classCSS:r,styleCache:l}=await sx(n,e)),i&&o&&(f=Ax(n,o)),s&&o&&mx(n,o)}finally{p()}await new Promise(y=>{ln(async()=>{await dx(o,e),y()},{fast:t})}),await new Promise(y=>{ln(async()=>{await Gc(n,o,l,e),y()},{fast:t})}),e.embedFonts&&await new Promise(y=>{ln(async()=>{const E=Fc(n),I=Rc(n);if(nt()){const M=new Set(Array.from(E).map(k=>String(k).split("__")[0]).filter(Boolean));await Oc(M,1)}a=await Pc({required:E,usedCodepoints:I,exclude:e.excludeFonts,useProxy:e.useProxy}),y()},{fast:t})});const A=nI(o).sort(),C=A.join(",");W.baseStyle.has(C)?c=W.baseStyle.get(C):await new Promise(y=>{ln(()=>{c=iI(A),W.baseStyle.set(C,c),y()},{fast:t})}),await new Promise(y=>{ln(()=>{const E=getComputedStyle(n);function I(Ke){const Oe=`${Ke.filter||""} ${Ke.webkitFilter||""}`.trim();if(!Oe||Oe==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const st=Oe.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let dt=0,Qt=0,Ht=0,It=0,Be=!1;for(const Do of st){Be=!0;const ke=Do.match(/-?\d+(?:\.\d+)?px/gi)?.map(qi=>parseFloat(qi))||[],[un=0,hn=0,$n=0]=ke,Kn=Math.abs(un)+$n,Xn=Math.abs(hn)+$n;Qt=Math.max(Qt,Kn+Math.max(un,0)),It=Math.max(It,Kn+Math.max(-un,0)),Ht=Math.max(Ht,Xn+Math.max(hn,0)),dt=Math.max(dt,Xn+Math.max(-hn,0))}return{bleed:{top:Math.ceil(dt),right:Math.ceil(Qt),bottom:Math.ceil(Ht),left:Math.ceil(It)},has:Be}}const M=n.getBoundingClientRect(),k=Math.max(1,Math.ceil(n.offsetWidth||parseFloat(E.width)||M.width||1)),S=Math.max(1,Math.ceil(n.offsetHeight||parseFloat(E.height)||M.height||1)),x=(Ke,Oe=NaN)=>{const st=typeof Ke=="string"?parseFloat(Ke):Ke;return Number.isFinite(st)?st:Oe},g=x(e.width),F=x(e.height);let D=k,P=S;const L=Number.isFinite(g),G=Number.isFinite(F),N=S>0?k/S:1;L&&G?(D=Math.max(1,Math.ceil(g)),P=Math.max(1,Math.ceil(F))):L?(D=Math.max(1,Math.ceil(g)),P=Math.max(1,Math.ceil(D/(N||1)))):G?(P=Math.max(1,Math.ceil(F)),D=Math.max(1,Math.ceil(P*(N||1)))):(D=k,P=S);let b=0,w=0,v=k,B=S;if(i&&f&&Number.isFinite(f.a)){const Ke={a:f.a,b:f.b||0,c:f.c||0,d:f.d||1,e:0,f:0},Oe=Vc(k,S,Ke,0,0);b=Oe.minX,w=Oe.minY,v=Oe.maxX,B=Oe.maxY}else if(!i&&wx(n)){const Oe=E.transform&&E.transform!=="none"?E.transform:"",st=bx(n),dt=Bx({baseTransform:Oe,rotate:st.rotate||"0deg",scale:st.scale,translate:st.translate}),{ox:Qt,oy:Ht}=Ix(E,k,S),It=dt.is2D?dt:new DOMMatrix(dt.toString()),Be=Vc(k,S,It,Qt,Ht);b=Be.minX,w=Be.minY,v=Be.maxX,B=Be.maxY}const R=yx(E),U=Cx(E),O=Ex(E),T=I(E),Q=s?{top:0,right:0,bottom:0,left:0}:{top:R.top+U.top+O.top+T.bleed.top,right:R.right+U.right+O.right+T.bleed.right,bottom:R.bottom+U.bottom+O.bottom+T.bleed.bottom,left:R.left+U.left+O.left+T.bleed.left};b-=Q.left,w-=Q.top,v+=Q.right,B+=Q.bottom;const V=Math.max(1,Math.ceil(v-b)),$=Math.max(1,Math.ceil(B-w)),J=Math.max(1,Math.round(V*(L||G?D/k:1))),ne=Math.max(1,Math.round($*(G||L?P/S:1))),re="http://www.w3.org/2000/svg",X=(nt()?1:0)+(i?1:0),se=document.createElementNS(re,"foreignObject"),oe=Math.floor(b),ae=Math.floor(w);se.setAttribute("x",String(-(oe-X))),se.setAttribute("y",String(-(ae-X))),se.setAttribute("width",String(Math.ceil(k+X*2))),se.setAttribute("height",String(Math.ceil(S+X*2))),se.style.overflow="visible";const Ce=document.createElement("style");Ce.textContent=c+a+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,se.appendChild(Ce);const le=document.createElement("div");le.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),le.style.width=`${k}px`,le.style.height=`${S}px`,le.style.overflow="visible",o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),le.appendChild(o),se.appendChild(le);const ct=new XMLSerializer().serializeToString(se),$e=V+X*2,vt=$+X*2,it=L||G;e.meta={w0:k,h0:S,vbW:$e,vbH:vt,targetW:D,targetH:P};const dn=nt()&&it?$e:J+X*2,Ut=nt()&&it?vt:ne+X*2;h=`<svg xmlns="${re}" width="${dn}" height="${Ut}" viewBox="0 0 ${$e} ${vt}">`+ct+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,y()},{fast:t})});const m=document.getElementById("snapdom-sandbox");return m&&m.style.position==="absolute"&&m.remove(),u}function Ax(n,e){if(!n||!e||!e.style)return null;const t=getComputedStyle(n);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const i=t.transform||"none";if(i==="none")try{const o=Wc(n);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const s=i.match(/^matrix\(\s*([^)]+)\)$/i);if(s){const o=s[1].split(",").map(r=>parseFloat(r.trim()));if(o.length===6&&o.every(Number.isFinite)){const[r,l,a,c]=o,u=Math.sqrt(r*r+l*l)||0;let h=0,f=0,p=0,A=0,C=0,m=0;u>0&&(h=r/u,f=l/u,p=h*a+f*c,A=a-h*p,C=c-f*p,m=Math.sqrt(A*A+C*C)||0,m>0?p=p/m:p=0);const y=u,E=0,I=p*m,M=m;try{e.style.transform=`matrix(${y}, ${E}, ${I}, ${M}, 0, 0)`}catch{}return{a:y,b:E,c:I,d:M}}}try{const o=String(i).trim();return e.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yx(n){const e=n.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};const t=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim());let i=0,s=0,o=0,r=0;for(const l of t){const a=l.match(/-?\d+(\.\d+)?px/g)?.map(C=>parseFloat(C))||[];if(a.length<2)continue;const[c,u,h=0,f=0]=a,p=Math.abs(c)+h+f,A=Math.abs(u)+h+f;s=Math.max(s,p+Math.max(c,0)),r=Math.max(r,p+Math.max(-c,0)),o=Math.max(o,A+Math.max(u,0)),i=Math.max(i,A+Math.max(-u,0))}return{top:Math.ceil(i),right:Math.ceil(s),bottom:Math.ceil(o),left:Math.ceil(r)}}function Cx(n){const e=(n.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),t=e?Math.ceil(parseFloat(e[1])||0):0;return{top:t,right:t,bottom:t,left:t}}function Ex(n){if((n.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(n.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Vc(n,e,t,i,s){const o=t.a,r=t.b,l=t.c,a=t.d,c=t.e||0,u=t.f||0;function h(y,E){let I=y-i,M=E-s,k=o*I+l*M,S=r*I+a*M;return k+=i+c,S+=s+u,[k,S]}const f=[h(0,0),h(n,0),h(0,e),h(n,e)];let p=1/0,A=1/0,C=-1/0,m=-1/0;for(const[y,E]of f)y<p&&(p=y),E<A&&(A=E),y>C&&(C=y),E>m&&(m=E);return{minX:p,minY:A,maxX:C,maxY:m,width:C-p,height:m-A}}function wx(n){return vx(n)}function Wc(n){const e=getComputedStyle(n).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function bx(n){const e={rotate:"0deg",scale:null,translate:null},t=typeof n.computedStyleMap=="function"?n.computedStyleMap():null;if(t){const s=a=>{try{return typeof t.has=="function"&&!t.has(a)||typeof t.get!="function"?null:t.get(a)}catch{return null}},o=s("rotate");if(o)if(o.angle){const a=o.angle;e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit}else o.unit?e.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:e.rotate=String(o);else{const a=getComputedStyle(n);e.rotate=a.rotate&&a.rotate!=="none"?a.rotate:"0deg"}const r=s("scale");if(r){const a="x"in r&&r.x?.value!=null?r.x.value:Array.isArray(r)?r[0]?.value:Number(r)||1,c="y"in r&&r.y?.value!=null?r.y.value:Array.isArray(r)?r[1]?.value:a;e.scale=`${a} ${c}`}else{const a=getComputedStyle(n);e.scale=a.scale&&a.scale!=="none"?a.scale:null}const l=s("translate");if(l){const a="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",h="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${a}${u} ${c}${h}`}else{const a=getComputedStyle(n);e.translate=a.translate&&a.translate!=="none"?a.translate:null}return e}const i=getComputedStyle(n);return e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg",e.scale=i.scale&&i.scale!=="none"?i.scale:null,e.translate=i.translate&&i.translate!=="none"?i.translate:null,e}function vx(n){const e=getComputedStyle(n),t=e.transform||"none";if(t!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(t))return!0;const s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",o=e.scale&&e.scale!=="none"&&e.scale!=="1",r=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||o||r)}function Ix(n,e,t){const i=(n.transformOrigin||"0 0").trim().split(/\s+/),[s,o]=[i[0]||"0",i[1]||"0"],r=(l,a)=>{const c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?a/2:c==="right"||c==="bottom"?a:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*a/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:r(s,e),oy:r(o,t)}}var Mo=null;function xx(){if(Mo)return Mo;const n=document.createElement("div");return n.id="snapdom-measure-slot",n.setAttribute("aria-hidden","true"),Object.assign(n.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(n),Mo=n,n}function Bx(n){const e=xx(),t=document.createElement("div");t.style.transformOrigin="0 0",n.baseTransform&&(t.style.transform=n.baseTransform),n.rotate&&(t.style.rotate=n.rotate),n.scale&&(t.style.scale=n.scale),n.translate&&(t.style.translate=n.translate),e.appendChild(t);const i=Wc(t);return e.removeChild(t),i}function Sx(n){if(typeof n=="string"){const e=n.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Mx(n={}){const e=n.format??"png",t=Sx(n.cache);return{debug:n.debug??!1,fast:n.fast??!0,scale:n.scale??1,exclude:n.exclude??[],excludeMode:n.excludeMode??"hide",filter:n.filter??null,filterMode:n.filterMode??"hide",placeholders:n.placeholders!==!1,embedFonts:n.embedFonts??!1,iconFonts:Array.isArray(n.iconFonts)?n.iconFonts:n.iconFonts?[n.iconFonts]:[],localFonts:Array.isArray(n.localFonts)?n.localFonts:[],excludeFonts:n.excludeFonts??void 0,fallbackURL:n.fallbackURL??void 0,cache:t,useProxy:typeof n.useProxy=="string"?n.useProxy:"",width:n.width??null,height:n.height??null,format:e,type:n.type??"svg",quality:n.quality??.92,dpr:n.dpr??(window.devicePixelRatio||1),backgroundColor:n.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:n.filename??"snapDOM",straighten:n.straighten??!1,noShadows:n.noShadows??!1}}function Tx(n){return typeof n=="string"&&/^data:image\/svg\+xml/i.test(n)}function Dx(n){const e=n.indexOf(",");return e>=0?decodeURIComponent(n.slice(e+1)):""}function kx(n){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Px(n){let e=[],t="",i=0;for(let s=0;s<n.length;s++){const o=n[s];o==="("&&i++,o===")"&&(i=Math.max(0,i-1)),o===";"&&i===0?(e.push(t),t=""):t+=o}return t.trim()&&e.push(t),e.map(s=>s.trim()).filter(Boolean)}function Fx(n){const e=[];let t="",i=0;for(let o=0;o<n.length;o++){const r=n[o];r==="("&&i++,r===")"&&(i=Math.max(0,i-1)),r===","&&i===0?(e.push(t.trim()),t=""):t+=r}t.trim()&&e.push(t.trim());const s=[];for(const o of e){if(/\binset\b/i.test(o))continue;const r=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",a="0px",c="0px"]=r;let u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," ");const h=!!u&&u!==",";s.push(`drop-shadow(${l} ${a} ${c}${h?` ${u}`:""})`)}return s.join(" ")}function zc(n){const e=Px(n);let t=null,i=null,s=null;const o=[];for(const l of e){const a=l.indexOf(":");if(a<0)continue;const c=l.slice(0,a).trim().toLowerCase(),u=l.slice(a+1).trim();c==="box-shadow"?s=u:c==="filter"?t=u:c==="-webkit-filter"?i=u:o.push([c,u])}if(s){const l=Fx(s);l&&(t=t?`${t} ${l}`:l,i=i?`${i} ${l}`:l)}const r=[...o];return t&&r.push(["filter",t]),i&&r.push(["-webkit-filter",i]),r.map(([l,a])=>`${l}:${a}`).join(";")}function Rx(n){return n.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,i)=>`${t}{${zc(i)}}`)}function Ox(n){return n=n.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,Rx(t))),n=n.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,i)=>`style=${t}${zc(i)}${t}`),n}function Lx(n){if(!nt()||!Tx(n))return n;try{const e=Dx(n),t=Ox(e);return kx(t)}catch{return n}}async function Ki(n,e){let{width:t,height:i,scale:s=1,dpr:o=1,meta:r={}}=e;n=Lx(n);const l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=n,await l.decode();const a=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(r.w0)?r.w0:a,h=Number.isFinite(r.h0)?r.h0:c;let f,p;const A=Number.isFinite(t),C=Number.isFinite(i);if(A&&C)f=Math.max(1,t),p=Math.max(1,i);else if(A){const E=t/Math.max(1,u);f=t,p=Math.round(h*E)}else if(C){const E=i/Math.max(1,h);p=i,f=Math.round(u*E)}else f=a,p=c;f=Math.round(f*s),p=Math.round(p*s);const m=document.createElement("canvas");m.width=Math.ceil(f*o),m.height=Math.ceil(p*o),m.style.width=`${f}px`,m.style.height=`${p}px`;const y=m.getContext("2d");return o!==1&&y.scale(o,o),y.drawImage(l,0,0,f,p),m}async function jc(n,e){const t=await Ki(n,e),i=e.backgroundColor?po(t,e.backgroundColor):t,s=new Image;return s.src=i.toDataURL(`image/${e.format}`,e.quality),await s.decode(),s.style.width=`${i.width/e.dpr}px`,s.style.height=`${i.height/e.dpr}px`,s}async function $c(n,e){const{scale:t=1,width:i,height:s,meta:o={}}=e,r=Number.isFinite(i),l=Number.isFinite(s),a=Number.isFinite(t)&&t!==1||r||l;if(nt()&&a)return await jc(n,{...e,format:"png",quality:1,meta:o});const c=new Image;if(c.decoding="sync",c.loading="eager",c.src=n,await c.decode(),r&&l)c.style.width=`${i}px`,c.style.height=`${s}px`;else if(r){const u=Number.isFinite(o.w0)?o.w0:c.naturalWidth,h=Number.isFinite(o.h0)?o.h0:c.naturalHeight,f=i/Math.max(1,u);c.style.width=`${i}px`,c.style.height=`${Math.round(h*f)}px`}else if(l){const u=Number.isFinite(o.w0)?o.w0:c.naturalWidth,h=Number.isFinite(o.h0)?o.h0:c.naturalHeight,f=s/Math.max(1,h);c.style.height=`${s}px`,c.style.width=`${Math.round(u*f)}px`}else{const u=Math.round(c.naturalWidth*t),h=Math.round(c.naturalHeight*t);if(c.style.width=`${u}px`,c.style.height=`${h}px`,typeof n=="string"&&n.startsWith("data:image/svg+xml"))try{const p=decodeURIComponent(n.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${h}"`);n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,c.src=n}catch{}}return c}async function Kc(n,e){const t=e.type;if(t==="svg"){const o=decodeURIComponent(n.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}const i=await Ki(n,e),s=e.backgroundColor?po(i,e.backgroundColor):i;return new Promise(o=>s.toBlob(r=>o(r),`image/${t}`,e.quality))}async function Nx(n,e){if(e.dpr=1,e.format==="svg"){const o=await Kc(n,{...e,type:"svg"}),r=URL.createObjectURL(o),l=document.createElement("a");l.href=r,l.download=e.filename,l.click(),URL.revokeObjectURL(r);return}const t=await Ki(n,e),i=e.backgroundColor?po(t,e.backgroundColor):t,s=document.createElement("a");s.href=i.toDataURL(`image/${e.format}`,e.quality),s.download=e.filename,s.click()}var Xc=Symbol("snapdom.internal"),To=!1;async function Ae(n,e){if(!n)throw new Error("Element cannot be null or undefined");const t=Mx(e);if(nt()&&(t.embedFonts===!0||_x(n)))for(let i=0;i<3;i++)try{await Ux(n,e),console.log("Iteración número:",i),To=!1}catch{}return t.iconFonts&&t.iconFonts.length>0&&PI(t.iconFonts),t.snap||(t.snap={toPng:(i,s)=>Ae.toPng(i,s),toSvg:(i,s)=>Ae.toSvg(i,s)}),Ae.capture(n,t,Xc)}Ae.capture=async(n,e,t)=>{if(t!==Xc)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const i=await Yc(n,e),s=r=>({...e,...r||{}}),o=r=>l=>{const a=s({...l||{},format:r}),c=r==="jpeg"||r==="jpg",u=a.backgroundColor==null||a.backgroundColor==="transparent";return c&&u&&(a.backgroundColor="#ffffff"),jc(i,a)};return{url:i,toRaw:()=>i,toImg:r=>$c(i,s(r)),toSvg:r=>$c(i,s(r)),toCanvas:r=>Ki(i,s(r)),toBlob:r=>Kc(i,s(r)),toPng:o("png"),toJpg:o("jpeg"),toWebp:o("webp"),download:r=>Nx(i,s(r))}},Ae.toRaw=(n,e)=>Ae(n,e).then(t=>t.toRaw()),Ae.toImg=(n,e)=>Ae(n,e).then(t=>t.toImg()),Ae.toSvg=(n,e)=>Ae(n,e).then(t=>t.toSvg()),Ae.toCanvas=(n,e)=>Ae(n,e).then(t=>t.toCanvas()),Ae.toBlob=(n,e)=>Ae(n,e).then(t=>t.toBlob()),Ae.toPng=(n,e)=>Ae(n,{...e,format:"png"}).then(t=>t.toPng()),Ae.toJpg=(n,e)=>Ae(n,{...e,format:"jpeg"}).then(t=>t.toJpg()),Ae.toWebp=(n,e)=>Ae(n,{...e,format:"webp"}).then(t=>t.toWebp()),Ae.download=(n,e)=>Ae(n,e).then(t=>t.download());async function Ux(n,e){if(To)return;const t={...e,fast:!0,embedFonts:!0,scale:.2};let i;try{i=await Yc(n,t)}catch{return}await new Promise(s=>{const o=new Image;o.decoding="sync",o.loading="eager",o.style.position="fixed",o.style.left=0,o.style.top=0,o.style.width="10px",o.style.height="10px",o.style.opacity="0.01",o.style.transform="translateZ(10px)",o.style.willChange="transform,opacity;",o.src=i;const r=async()=>{await new Promise(l=>setTimeout(l,100)),o&&o.parentNode&&o.parentNode.removeChild(o),To=!0,s()};document.body.appendChild(o),r()})}function _x(n){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const t=e.currentNode,i=getComputedStyle(t),s=i.backgroundImage&&i.backgroundImage!=="none",o=i.maskImage&&i.maskImage!=="none"||i.webkitMaskImage&&i.webkitMaskImage!=="none";if(s||o)return!0}return!1}async function Qx(n=document,e={}){const{embedFonts:t=!0,useProxy:i=""}=e,s=e.cache??e.cacheOpt??"full";gc(s);try{await document.fonts?.ready}catch{}try{Jv()}catch{}W.session=W.session||{},W.session.styleCache||(W.session.styleCache=new WeakMap),W.image=W.image||new Map;try{await Gc(n,void 0,W.session.styleCache,{useProxy:i})}catch{}let o=[],r=[];try{n?.querySelectorAll&&(o=Array.from(n.querySelectorAll("img[src]")),r=Array.from(n.querySelectorAll("*")))}catch{}const l=[];for(const a of o){const c=a?.currentSrc||a?.src;if(c&&!W.image.has(c)){const u=Promise.resolve().then(async()=>{const h=await je(c,{as:"dataURL",useProxy:i});h?.ok&&typeof h.data=="string"&&W.image.set(c,h.data)}).catch(()=>{});l.push(u)}}for(const a of r){let c="";try{c=Ao(a).backgroundImage}catch{}if(c&&c!=="none"){const u=yo(c);for(const h of u)if(h.startsWith("url(")){const f=Promise.resolve().then(()=>go(h,{...e,useProxy:i})).catch(()=>{});l.push(f)}}}if(t)try{const a=Fc(n),c=Rc(n);if(typeof nt=="function"?nt():!!nt){const h=new Set(Array.from(a).map(f=>String(f).split("__")[0]).filter(Boolean));await Oc(h,3)}await Pc({required:a,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??i})}catch{}await Promise.allSettled(l)}const Hx=Object.freeze(Object.defineProperty({__proto__:null,preCache:Qx,snapdom:Ae},Symbol.toStringTag,{value:"Module"}));_.DEFAULT_CESIUM_CONFIG=xt,_.LeiTingBIM=Qi,_.LeiTingDraggableCard=Re,_.LeiTingInfo=Qn,_.LeiTingMenu=Nn,_.LeiTingPlayer=_n,_.LeiTingPosition=Hn,_.LeiTingSection=Un,_.LeiTingSetting=Gn,_.LeiTingTree=Pi,_.LeitingBIM=Qi,_.LeitingDraggableCard=Re,_.LeitingInfo=Qn,_.LeitingMenu=Nn,_.LeitingPlayer=_n,_.LeitingPosition=Hn,_.LeitingSection=Un,_.LeitingSetting=Gn,_.LeitingTree=Pi,_.default=Yv,_.getAccessToken=ns,_.leitingBim=Qi,_.loadCesium=ts,_.useLeiTing=pc,_.useLeiting=pc,_.waitForCesium=ld,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));