@mappedin/mappedin-js 6.0.0-rc.3 → 6.0.0-rc.4

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.
Files changed (53) hide show
  1. package/THIRD_PARTY_LICENSES.txt +18 -19
  2. package/lib/esm/{GLTFExporter-RSA32FAS.js → GLTFExporter-22SRWSNV.js} +2 -2
  3. package/lib/esm/{GLTFLoader-FLMCN6TW.js → GLTFLoader-SWPNQTFP.js} +2 -2
  4. package/lib/esm/{browser-4FMFOYKX.js → browser-GGPMSNFY.js} +2 -2
  5. package/lib/esm/chunk-3GOFR3M6.js +2 -0
  6. package/lib/esm/{chunk-UVZJOVQM.js.map → chunk-3GOFR3M6.js.map} +1 -1
  7. package/lib/esm/chunk-AFELLAS6.js +193 -0
  8. package/lib/esm/chunk-AFELLAS6.js.map +7 -0
  9. package/lib/esm/chunk-GAHPB2XK.js +1992 -0
  10. package/lib/esm/chunk-GAHPB2XK.js.map +7 -0
  11. package/lib/esm/{chunk-LTNJEB3M.js → chunk-I32KNH7E.js} +2 -2
  12. package/lib/esm/{chunk-K3PVENYC.js → chunk-MDSV6XJR.js} +2 -2
  13. package/lib/esm/{chunk-4AZZH27P.js → chunk-VWOFYLSM.js} +2 -2
  14. package/lib/esm/index.css +1 -1
  15. package/lib/esm/index.css.map +2 -2
  16. package/lib/esm/index.d.ts +28029 -39304
  17. package/lib/esm/index.js +1 -1
  18. package/lib/esm/inspector-2XETNHYZ.css +2 -0
  19. package/lib/esm/inspector-2XETNHYZ.css.map +7 -0
  20. package/lib/esm/{inspector-BHVDJXVZ.js → inspector-HQV23IML.js} +2 -2
  21. package/lib/esm/internal-MAULC22C.js +2 -0
  22. package/lib/esm/internal-MAULC22C.js.map +7 -0
  23. package/lib/esm/internal-R5XTRV7Q.css +2 -0
  24. package/lib/esm/internal-R5XTRV7Q.css.map +7 -0
  25. package/lib/esm/{outdoor-context-v5-6IFFZHAJ.js → outdoor-context-v5-5KBHPW76.js} +2 -2
  26. package/lib/esm/text3d-AXM5ZHCS.css +2 -0
  27. package/lib/esm/{text3d-ZPCG4PKJ.css.map → text3d-AXM5ZHCS.css.map} +2 -2
  28. package/lib/esm/{text3d-EKD5MTTV.js → text3d-HT6TS3WO.js} +2 -2
  29. package/lib/esm/workers/collision-worker.csp.js +1 -1
  30. package/lib/index-rn.js +195 -194
  31. package/lib/index.css +1 -1
  32. package/package.json +13 -10
  33. package/lib/esm/chunk-43XLQYI5.js +0 -193
  34. package/lib/esm/chunk-43XLQYI5.js.map +0 -7
  35. package/lib/esm/chunk-UVZJOVQM.js +0 -2
  36. package/lib/esm/chunk-WJDRJJIM.js +0 -2153
  37. package/lib/esm/chunk-WJDRJJIM.js.map +0 -7
  38. package/lib/esm/inspector-4GBSTGDH.css +0 -2
  39. package/lib/esm/inspector-4GBSTGDH.css.map +0 -7
  40. package/lib/esm/internal-3NNUFZ25.js +0 -2
  41. package/lib/esm/internal-3NNUFZ25.js.map +0 -7
  42. package/lib/esm/internal-CH27ONAB.css +0 -2
  43. package/lib/esm/internal-CH27ONAB.css.map +0 -7
  44. package/lib/esm/text3d-ZPCG4PKJ.css +0 -2
  45. /package/lib/esm/{GLTFExporter-RSA32FAS.js.map → GLTFExporter-22SRWSNV.js.map} +0 -0
  46. /package/lib/esm/{GLTFLoader-FLMCN6TW.js.map → GLTFLoader-SWPNQTFP.js.map} +0 -0
  47. /package/lib/esm/{browser-4FMFOYKX.js.map → browser-GGPMSNFY.js.map} +0 -0
  48. /package/lib/esm/{chunk-LTNJEB3M.js.map → chunk-I32KNH7E.js.map} +0 -0
  49. /package/lib/esm/{chunk-K3PVENYC.js.map → chunk-MDSV6XJR.js.map} +0 -0
  50. /package/lib/esm/{chunk-4AZZH27P.js.map → chunk-VWOFYLSM.js.map} +0 -0
  51. /package/lib/esm/{inspector-BHVDJXVZ.js.map → inspector-HQV23IML.js.map} +0 -0
  52. /package/lib/esm/{outdoor-context-v5-6IFFZHAJ.js.map → outdoor-context-v5-5KBHPW76.js.map} +0 -0
  53. /package/lib/esm/{text3d-EKD5MTTV.js.map → text3d-HT6TS3WO.js.map} +0 -0
@@ -0,0 +1,193 @@
1
+ import{i as xn,j as Ni}from"./chunk-I32KNH7E.js";import{a as Er}from"./chunk-MDSV6XJR.js";import{$ as Re,A as Ii,Ca as Mi,Da as Li,Ea as Ai,I as Se,Ja as Di,P as yn,Q as j,R as gn,T as $e,U as vn,V as fe,W as ce,Y as Ke,aa as Si,c as bi,d as _i,db as wr,e as Pi,g as Qt,la as wi,p as Ti,qa as Ei,r as Ci,z as mn,za as Oi}from"./chunk-VWOFYLSM.js";import{a as h,b as _}from"./chunk-3GOFR3M6.js";import{b as vi,c as oa,d as xi,e as c,f as Y,g as se,h as q}from"./chunk-ROCNZJLL.js";var as=vi((ur,Yt)=>{h();var bu=200,Wo="__lodash_hash_undefined__",_u=800,Pu=16,Vo=9007199254740991,Ho="[object Arguments]",Tu="[object Array]",Cu="[object AsyncFunction]",Iu="[object Boolean]",Su="[object Date]",wu="[object Error]",jo="[object Function]",Eu="[object GeneratorFunction]",Ou="[object Map]",Mu="[object Number]",Lu="[object Null]",Uo="[object Object]",Au="[object Proxy]",Du="[object RegExp]",Nu="[object Set]",ku="[object String]",Bu="[object Undefined]",Ru="[object WeakMap]",Xu="[object ArrayBuffer]",Yu="[object DataView]",Fu="[object Float32Array]",Gu="[object Float64Array]",Wu="[object Int8Array]",Vu="[object Int16Array]",Hu="[object Int32Array]",ju="[object Uint8Array]",Uu="[object Uint8ClampedArray]",zu="[object Uint16Array]",Zu="[object Uint32Array]",qu=/[\\^$.*+?()[\]{}|]/g,Ju=/^\[object .+?Constructor\]$/,$u=/^(?:0|[1-9]\d*)$/,F={};F[Fu]=F[Gu]=F[Wu]=F[Vu]=F[Hu]=F[ju]=F[Uu]=F[zu]=F[Zu]=!0;F[Ho]=F[Tu]=F[Xu]=F[Iu]=F[Yu]=F[Su]=F[wu]=F[jo]=F[Ou]=F[Mu]=F[Uo]=F[Du]=F[Nu]=F[ku]=F[Ru]=!1;var zo=typeof global=="object"&&global&&global.Object===Object&&global,Ku=typeof self=="object"&&self&&self.Object===Object&&self,pr=zo||Ku||Function("return this")(),Zo=typeof ur=="object"&&ur&&!ur.nodeType&&ur,fr=Zo&&typeof Yt=="object"&&Yt&&!Yt.nodeType&&Yt,qo=fr&&fr.exports===Zo,An=qo&&zo.process,Do=function(){try{var e=fr&&fr.require&&fr.require("util").types;return e||An&&An.binding&&An.binding("util")}catch{}}(),No=Do&&Do.isTypedArray;function Qu(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function ef(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function tf(e){return function(t){return e(t)}}function rf(e,t){return e?.[t]}function nf(e,t){return function(r){return e(t(r))}}var of=Array.prototype,sf=Function.prototype,Hr=Object.prototype,Dn=pr["__core-js_shared__"],jr=sf.toString,Ae=Hr.hasOwnProperty,ko=function(){var e=/[^.]+$/.exec(Dn&&Dn.keys&&Dn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Jo=Hr.toString,af=jr.call(Object),lf=RegExp("^"+jr.call(Ae).replace(qu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wr=qo?pr.Buffer:void 0,Bo=pr.Symbol,Ro=pr.Uint8Array,Xo=Wr?Wr.allocUnsafe:void 0,$o=nf(Object.getPrototypeOf,Object),Yo=Object.create,uf=Hr.propertyIsEnumerable,ff=of.splice,xt=Bo?Bo.toStringTag:void 0,Vr=function(){try{var e=Yn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),cf=Wr?Wr.isBuffer:void 0,Fo=Math.max,pf=Date.now,Ko=Yn(pr,"Map"),cr=Yn(Object,"create"),hf=function(){function e(){}return function(t){if(!_t(t))return{};if(Yo)return Yo(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function bt(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function df(){this.__data__=cr?cr(null):{},this.size=0}function mf(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function yf(e){var t=this.__data__;if(cr){var r=t[e];return r===Wo?void 0:r}return Ae.call(t,e)?t[e]:void 0}function gf(e){var t=this.__data__;return cr?t[e]!==void 0:Ae.call(t,e)}function vf(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=cr&&t===void 0?Wo:t,this}bt.prototype.clear=df;bt.prototype.delete=mf;bt.prototype.get=yf;bt.prototype.has=gf;bt.prototype.set=vf;function De(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function xf(){this.__data__=[],this.size=0}function bf(e){var t=this.__data__,r=Ur(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():ff.call(t,r,1),--this.size,!0}function _f(e){var t=this.__data__,r=Ur(t,e);return r<0?void 0:t[r][1]}function Pf(e){return Ur(this.__data__,e)>-1}function Tf(e,t){var r=this.__data__,n=Ur(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}De.prototype.clear=xf;De.prototype.delete=bf;De.prototype.get=_f;De.prototype.has=Pf;De.prototype.set=Tf;function Ft(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Cf(){this.size=0,this.__data__={hash:new bt,map:new(Ko||De),string:new bt}}function If(e){var t=Zr(this,e).delete(e);return this.size-=t?1:0,t}function Sf(e){return Zr(this,e).get(e)}function wf(e){return Zr(this,e).has(e)}function Ef(e,t){var r=Zr(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}Ft.prototype.clear=Cf;Ft.prototype.delete=If;Ft.prototype.get=Sf;Ft.prototype.has=wf;Ft.prototype.set=Ef;function Gt(e){var t=this.__data__=new De(e);this.size=t.size}function Of(){this.__data__=new De,this.size=0}function Mf(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Lf(e){return this.__data__.get(e)}function Af(e){return this.__data__.has(e)}function Df(e,t){var r=this.__data__;if(r instanceof De){var n=r.__data__;if(!Ko||n.length<bu-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ft(n)}return r.set(e,t),this.size=r.size,this}Gt.prototype.clear=Of;Gt.prototype.delete=Mf;Gt.prototype.get=Lf;Gt.prototype.has=Af;Gt.prototype.set=Df;function Nf(e,t){var r=Rn(e),n=!r&&Bn(e),i=!r&&!n&&rs(e),o=!r&&!n&&!i&&is(e),s=r||n||i||o,l=s?ef(e.length,String):[],u=l.length;for(var f in e)(t||Ae.call(e,f))&&!(s&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||es(f,u)))&&l.push(f);return l}function Nn(e,t,r){(r!==void 0&&!qr(e[t],r)||r===void 0&&!(t in e))&&Xn(e,t,r)}function kf(e,t,r){var n=e[t];(!(Ae.call(e,t)&&qr(n,r))||r===void 0&&!(t in e))&&Xn(e,t,r)}function Ur(e,t){for(var r=e.length;r--;)if(qr(e[r][0],t))return r;return-1}function Xn(e,t,r){t=="__proto__"&&Vr?Vr(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Bf=qf();function zr(e){return e==null?e===void 0?Bu:Lu:xt&&xt in Object(e)?Jf(e):rc(e)}function Go(e){return hr(e)&&zr(e)==Ho}function Rf(e){if(!_t(e)||ec(e))return!1;var t=Gn(e)?lf:Ju;return t.test(sc(e))}function Xf(e){return hr(e)&&ns(e.length)&&!!F[zr(e)]}function Yf(e){if(!_t(e))return tc(e);var t=ts(e),r=[];for(var n in e)n=="constructor"&&(t||!Ae.call(e,n))||r.push(n);return r}function Qo(e,t,r,n,i){e!==t&&Bf(t,function(o,s){if(i||(i=new Gt),_t(o))Ff(e,t,s,r,Qo,n,i);else{var l=n?n(kn(e,s),o,s+"",e,t,i):void 0;l===void 0&&(l=o),Nn(e,s,l)}},os)}function Ff(e,t,r,n,i,o,s){var l=kn(e,r),u=kn(t,r),f=s.get(u);if(f){Nn(e,r,f);return}var p=o?o(l,u,r+"",e,t,s):void 0,d=p===void 0;if(d){var m=Rn(u),x=!m&&rs(u),b=!m&&!x&&is(u);p=u,m||x||b?Rn(l)?p=l:ac(l)?p=Uf(l):x?(d=!1,p=Vf(u,!0)):b?(d=!1,p=jf(u,!0)):p=[]:lc(u)||Bn(u)?(p=l,Bn(l)?p=uc(l):(!_t(l)||Gn(l))&&(p=$f(u))):d=!1}d&&(s.set(u,p),i(p,u,n,o,s),s.delete(u)),Nn(e,r,p)}function Gf(e,t){return ic(nc(e,t,ss),e+"")}var Wf=Vr?function(e,t){return Vr(e,"toString",{configurable:!0,enumerable:!1,value:cc(t),writable:!0})}:ss;function Vf(e,t){if(t)return e.slice();var r=e.length,n=Xo?Xo(r):new e.constructor(r);return e.copy(n),n}function Hf(e){var t=new e.constructor(e.byteLength);return new Ro(t).set(new Ro(e)),t}function jf(e,t){var r=t?Hf(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Uf(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function zf(e,t,r,n){var i=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var l=t[o],u=n?n(r[l],e[l],l,r,e):void 0;u===void 0&&(u=e[l]),i?Xn(r,l,u):kf(r,l,u)}return r}function Zf(e){return Gf(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&Kf(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var l=r[n];l&&e(t,l,n,o)}return t})}function qf(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),l=s.length;l--;){var u=s[e?l:++i];if(r(o[u],u,o)===!1)break}return t}}function Zr(e,t){var r=e.__data__;return Qf(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Yn(e,t){var r=rf(e,t);return Rf(r)?r:void 0}function Jf(e){var t=Ae.call(e,xt),r=e[xt];try{e[xt]=void 0;var n=!0}catch{}var i=Jo.call(e);return n&&(t?e[xt]=r:delete e[xt]),i}function $f(e){return typeof e.constructor=="function"&&!ts(e)?hf($o(e)):{}}function es(e,t){var r=typeof e;return t=t??Vo,!!t&&(r=="number"||r!="symbol"&&$u.test(e))&&e>-1&&e%1==0&&e<t}function Kf(e,t,r){if(!_t(r))return!1;var n=typeof t;return(n=="number"?Fn(r)&&es(t,r.length):n=="string"&&t in r)?qr(r[t],e):!1}function Qf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ec(e){return!!ko&&ko in e}function ts(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Hr;return e===r}function tc(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}function rc(e){return Jo.call(e)}function nc(e,t,r){return t=Fo(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=Fo(n.length-t,0),s=Array(o);++i<o;)s[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=r(s),Qu(e,this,l)}}function kn(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var ic=oc(Wf);function oc(e){var t=0,r=0;return function(){var n=pf(),i=Pu-(n-r);if(r=n,i>0){if(++t>=_u)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function sc(e){if(e!=null){try{return jr.call(e)}catch{}try{return e+""}catch{}}return""}function qr(e,t){return e===t||e!==e&&t!==t}var Bn=Go(function(){return arguments}())?Go:function(e){return hr(e)&&Ae.call(e,"callee")&&!uf.call(e,"callee")},Rn=Array.isArray;function Fn(e){return e!=null&&ns(e.length)&&!Gn(e)}function ac(e){return hr(e)&&Fn(e)}var rs=cf||pc;function Gn(e){if(!_t(e))return!1;var t=zr(e);return t==jo||t==Eu||t==Cu||t==Au}function ns(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vo}function _t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function hr(e){return e!=null&&typeof e=="object"}function lc(e){if(!hr(e)||zr(e)!=Uo)return!1;var t=$o(e);if(t===null)return!0;var r=Ae.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&jr.call(r)==af}var is=No?tf(No):Xf;function uc(e){return zf(e,os(e))}function os(e){return Fn(e)?Nf(e,!0):Yf(e)}var fc=Zf(function(e,t,r){Qo(e,t,r)});function cc(e){return function(){return e}}function ss(e){return e}function pc(){return!1}Yt.exports=fc});var Ns=vi((Ox,br)=>{"use strict";h();var Lc=!1,Tt=!1,ws=!0,Es=!1,a={},Os=!1;typeof br<"u"&&br.exports?(br.exports=a,Os=!0):typeof document<"u"?window.ClipperLib=a:self.ClipperLib=a;var rn;Os?(Z="chrome",rn="Netscape"):(Z=navigator.userAgent.toString().toLowerCase(),rn=navigator.appName);var Z,R={};Z.indexOf("chrome")!=-1&&Z.indexOf("chromium")==-1?R.chrome=1:R.chrome=0;Z.indexOf("chromium")!=-1?R.chromium=1:R.chromium=0;Z.indexOf("safari")!=-1&&Z.indexOf("chrome")==-1&&Z.indexOf("chromium")==-1?R.safari=1:R.safari=0;Z.indexOf("firefox")!=-1?R.firefox=1:R.firefox=0;Z.indexOf("firefox/17")!=-1?R.firefox17=1:R.firefox17=0;Z.indexOf("firefox/15")!=-1?R.firefox15=1:R.firefox15=0;Z.indexOf("firefox/3")!=-1?R.firefox3=1:R.firefox3=0;Z.indexOf("opera")!=-1?R.opera=1:R.opera=0;Z.indexOf("msie 10")!=-1?R.msie10=1:R.msie10=0;Z.indexOf("msie 9")!=-1?R.msie9=1:R.msie9=0;Z.indexOf("msie 8")!=-1?R.msie8=1:R.msie8=0;Z.indexOf("msie 7")!=-1?R.msie7=1:R.msie7=0;Z.indexOf("msie ")!=-1?R.msie=1:R.msie=0;a.biginteger_used=null;var ze,Ac=0xdeadbeefcafe,Is=(Ac&16777215)==15715070;function g(e,t,r){a.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function X(){return new g(null)}function Dc(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function Nc(e,t,r,n,i,o){for(var s=t&32767,l=t>>15;--o>=0;){var u=this[e]&32767,f=this[e++]>>15,p=l*u+f*s;u=s*u+((p&32767)<<15)+r[n]+(i&1073741823),i=(u>>>30)+(p>>>15)+l*f+(i>>>30),r[n++]=u&1073741823}return i}function kc(e,t,r,n,i,o){for(var s=t&16383,l=t>>14;--o>=0;){var u=this[e]&16383,f=this[e++]>>14,p=l*u+f*s;u=s*u+((p&16383)<<14)+r[n]+i,i=(u>>28)+(p>>14)+l*f,r[n++]=u&268435455}return i}Is&&rn=="Microsoft Internet Explorer"?(g.prototype.am=Nc,ze=30):Is&&rn!="Netscape"?(g.prototype.am=Dc,ze=26):(g.prototype.am=kc,ze=28);g.prototype.DB=ze;g.prototype.DM=(1<<ze)-1;g.prototype.DV=1<<ze;var Jn=52;g.prototype.FV=Math.pow(2,Jn);g.prototype.F1=Jn-ze;g.prototype.F2=2*ze-Jn;var Bc="0123456789abcdefghijklmnopqrstuvwxyz",on=new Array,Ut,me;Ut=48;for(me=0;me<=9;++me)on[Ut++]=me;Ut=97;for(me=10;me<36;++me)on[Ut++]=me;Ut=65;for(me=10;me<36;++me)on[Ut++]=me;function Ss(e){return Bc.charAt(e)}function Ms(e,t){var r=on[e.charCodeAt(t)];return r??-1}function Rc(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function Xc(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Ue(e){var t=X();return t.fromInt(e),t}function Yc(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var s=r==8?e[n]&255:Ms(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&g.ZERO.subTo(this,this)}function Fc(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function Gc(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,i=!1,o="",s=this.t,l=this.DB-s*this.DB%t;if(s-- >0)for(l<this.DB&&(n=this[s]>>l)>0&&(i=!0,o=Ss(n));s>=0;)l<t?(n=(this[s]&(1<<l)-1)<<t-l,n|=this[--s]>>(l+=this.DB-t)):(n=this[s]>>(l-=t)&r,l<=0&&(l+=this.DB,--s)),n>0&&(i=!0),i&&(o+=Ss(n));return i?o:"0"}function Wc(){var e=X();return g.ZERO.subTo(this,e),e}function Vc(){return this.s<0?this.negate():this}function Hc(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function sn(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function jc(){return this.t<=0?0:this.DB*(this.t-1)+sn(this[this.t-1]^this.s&this.DM)}function Uc(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function zc(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function Zc(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(e/this.DB),s=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>n|s,s=(this[l]&i)<<r;for(l=o-1;l>=0;--l)t[l]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function qc(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&o)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}function Jc(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function $c(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i<n.t;++i)t[i+r.t]=r.am(0,n[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&g.ZERO.subTo(t,t)}function Kc(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function Qc(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=X());var o=X(),s=this.s,l=e.s,u=this.DB-sn(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,p=o[f-1];if(p!=0){var d=p*(1<<this.F1)+(f>1?o[f-2]>>this.F2:0),m=this.FV/d,x=(1<<this.F1)/d,b=1<<this.F2,C=r.t,w=C-f,M=t??X();for(o.dlShiftTo(w,M),r.compareTo(M)>=0&&(r[r.t++]=1,r.subTo(M,r)),g.ONE.dlShiftTo(f,M),M.subTo(o,o);o.t<f;)o[o.t++]=0;for(;--w>=0;){var N=r[--C]==p?this.DM:Math.floor(r[C]*m+(r[C-1]+b)*x);if((r[C]+=o.am(0,N,r,w,0,f))<N)for(o.dlShiftTo(w,M),r.subTo(M,r);r[C]<--N;)r.subTo(M,r)}t!=null&&(r.drShiftTo(f,t),s!=l&&g.ZERO.subTo(t,t)),r.t=f,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&g.ZERO.subTo(r,r)}}}function ep(e){var t=X();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(g.ZERO)>0&&e.subTo(t,t),t}function Ct(e){this.m=e}function tp(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function rp(e){return e}function np(e){e.divRemTo(this.m,null,e)}function ip(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function op(e,t){e.squareTo(t),this.reduce(t)}Ct.prototype.convert=tp;Ct.prototype.revert=rp;Ct.prototype.reduce=np;Ct.prototype.mulTo=ip;Ct.prototype.sqrTo=op;function sp(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function It(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function ap(e){var t=X();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(g.ZERO)>0&&this.m.subTo(t,t),t}function lp(e){var t=X();return e.copyTo(t),this.reduce(t),t}function up(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function fp(e,t){e.squareTo(t),this.reduce(t)}function cp(e,t,r){e.multiplyTo(t,r),this.reduce(r)}It.prototype.convert=ap;It.prototype.revert=lp;It.prototype.reduce=up;It.prototype.mulTo=cp;It.prototype.sqrTo=fp;function pp(){return(this.t>0?this[0]&1:this.s)==0}function hp(e,t){if(e>4294967295||e<1)return g.ONE;var r=X(),n=X(),i=t.convert(this),o=sn(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function dp(e,t){var r;return e<256||t.isEven()?r=new Ct(t):r=new It(t),this.exp(e,r)}g.prototype.copyTo=Rc;g.prototype.fromInt=Xc;g.prototype.fromString=Yc;g.prototype.clamp=Fc;g.prototype.dlShiftTo=Uc;g.prototype.drShiftTo=zc;g.prototype.lShiftTo=Zc;g.prototype.rShiftTo=qc;g.prototype.subTo=Jc;g.prototype.multiplyTo=$c;g.prototype.squareTo=Kc;g.prototype.divRemTo=Qc;g.prototype.invDigit=sp;g.prototype.isEven=pp;g.prototype.exp=hp;g.prototype.toString=Gc;g.prototype.negate=Wc;g.prototype.abs=Vc;g.prototype.compareTo=Hc;g.prototype.bitLength=jc;g.prototype.mod=ep;g.prototype.modPowInt=dp;g.ZERO=Ue(0);g.ONE=Ue(1);function mp(){var e=X();return this.copyTo(e),e}function yp(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function gp(){return this.t==0?this.s:this[0]<<24>>24}function vp(){return this.t==0?this.s:this[0]<<16>>16}function xp(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function bp(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function _p(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Ue(r),i=X(),o=X(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s}function Pp(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,s=0,l=0;l<e.length;++l){var u=Ms(e,l);if(u<0){e.charAt(l)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&g.ZERO.subTo(this,this)}function Tp(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(g.ONE.shiftLeft(e-1),$n,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(g.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function Cp(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(n&128)!=0&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function Ip(e){return this.compareTo(e)==0}function Sp(e){return this.compareTo(e)<0?this:e}function wp(e){return this.compareTo(e)>0?this:e}function Ep(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function Op(e,t){return e&t}function Mp(e){var t=X();return this.bitwiseTo(e,Op,t),t}function $n(e,t){return e|t}function Lp(e){var t=X();return this.bitwiseTo(e,$n,t),t}function Ls(e,t){return e^t}function Ap(e){var t=X();return this.bitwiseTo(e,Ls,t),t}function As(e,t){return e&~t}function Dp(e){var t=X();return this.bitwiseTo(e,As,t),t}function Np(){for(var e=X(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function kp(e){var t=X();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Bp(e){var t=X();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Rp(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function Xp(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+Rp(this[e]);return this.s<0?this.t*this.DB:-1}function Yp(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Fp(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Yp(this[r]^t);return e}function Gp(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function Wp(e,t){var r=g.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function Vp(e){return this.changeBit(e,$n)}function Hp(e){return this.changeBit(e,As)}function jp(e){return this.changeBit(e,Ls)}function Up(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function zp(e){var t=X();return this.addTo(e,t),t}function Zp(e){var t=X();return this.subTo(e,t),t}function qp(e){var t=X();return this.multiplyTo(e,t),t}function Jp(){var e=X();return this.squareTo(e),e}function $p(e){var t=X();return this.divRemTo(e,t,null),t}function Kp(e){var t=X();return this.divRemTo(e,null,t),t}function Qp(e){var t=X(),r=X();return this.divRemTo(e,t,r),new Array(t,r)}function eh(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function th(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function _r(){}function Ds(e){return e}function rh(e,t,r){e.multiplyTo(t,r)}function nh(e,t){e.squareTo(t)}_r.prototype.convert=Ds;_r.prototype.revert=Ds;_r.prototype.mulTo=rh;_r.prototype.sqrTo=nh;function ih(e){return this.exp(e,new _r)}function oh(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function sh(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function zt(e){this.r2=X(),this.q3=X(),g.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function ah(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=X();return e.copyTo(t),this.reduce(t),t}function lh(e){return e}function uh(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function fh(e,t){e.squareTo(t),this.reduce(t)}function ch(e,t,r){e.multiplyTo(t,r),this.reduce(r)}zt.prototype.convert=ah;zt.prototype.revert=lh;zt.prototype.reduce=uh;zt.prototype.mulTo=ch;zt.prototype.sqrTo=fh;function ph(e,t){var r=e.bitLength(),n,i=Ue(1),o;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?o=new Ct(t):t.isEven()?o=new zt(t):o=new It(t);var s=new Array,l=3,u=n-1,f=(1<<n)-1;if(s[1]=o.convert(this),n>1){var p=X();for(o.sqrTo(s[1],p);l<=f;)s[l]=X(),o.mulTo(p,s[l-2],s[l]),l+=2}var d=e.t-1,m,x=!0,b=X(),C;for(r=sn(e[d])-1;d>=0;){for(r>=u?m=e[d]>>r-u&f:(m=(e[d]&(1<<r+1)-1)<<u-r,d>0&&(m|=e[d-1]>>this.DB+r-u)),l=n;(m&1)==0;)m>>=1,--l;if((r-=l)<0&&(r+=this.DB,--d),x)s[m].copyTo(i),x=!1;else{for(;l>1;)o.sqrTo(i,b),o.sqrTo(b,i),l-=2;l>0?o.sqrTo(i,b):(C=i,i=b,b=C),o.mulTo(b,s[m],i)}for(;d>=0&&(e[d]&1<<r)==0;)o.sqrTo(i,b),C=i,i=b,b=C,--r<0&&(r=this.DB-1,--d)}return o.revert(i)}function hh(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function dh(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function mh(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return g.ZERO;for(var r=e.clone(),n=this.clone(),i=Ue(1),o=Ue(0),s=Ue(0),l=Ue(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),o.subTo(l,o)):(n.subTo(r,n),t&&s.subTo(i,s),l.subTo(o,l))}if(n.compareTo(g.ONE)!=0)return g.ZERO;if(l.compareTo(e)>=0)return l.subtract(e);if(l.signum()<0)l.addTo(e,l);else return l;return l.signum()<0?l.add(e):l}var ee=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],yh=(1<<26)/ee[ee.length-1];function gh(e){var t,r=this.abs();if(r.t==1&&r[0]<=ee[ee.length-1]){for(t=0;t<ee.length;++t)if(r[0]==ee[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<ee.length;){for(var n=ee[t],i=t+1;i<ee.length&&n<yh;)n*=ee[i++];for(n=r.modInt(n);t<i;)if(n%ee[t++]==0)return!1}return r.millerRabin(e)}function vh(e){var t=this.subtract(g.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>ee.length&&(e=ee.length);for(var i=X(),o=0;o<e;++o){i.fromInt(ee[Math.floor(Math.random()*ee.length)]);var s=i.modPow(n,this);if(s.compareTo(g.ONE)!=0&&s.compareTo(t)!=0){for(var l=1;l++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(g.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}g.prototype.chunkSize=xp;g.prototype.toRadix=_p;g.prototype.fromRadix=Pp;g.prototype.fromNumber=Tp;g.prototype.bitwiseTo=Ep;g.prototype.changeBit=Wp;g.prototype.addTo=Up;g.prototype.dMultiply=eh;g.prototype.dAddOffset=th;g.prototype.multiplyLowerTo=oh;g.prototype.multiplyUpperTo=sh;g.prototype.modInt=dh;g.prototype.millerRabin=vh;g.prototype.clone=mp;g.prototype.intValue=yp;g.prototype.byteValue=gp;g.prototype.shortValue=vp;g.prototype.signum=bp;g.prototype.toByteArray=Cp;g.prototype.equals=Ip;g.prototype.min=Sp;g.prototype.max=wp;g.prototype.and=Mp;g.prototype.or=Lp;g.prototype.xor=Ap;g.prototype.andNot=Dp;g.prototype.not=Np;g.prototype.shiftLeft=kp;g.prototype.shiftRight=Bp;g.prototype.getLowestSetBit=Xp;g.prototype.bitCount=Fp;g.prototype.testBit=Gp;g.prototype.setBit=Vp;g.prototype.clearBit=Hp;g.prototype.flipBit=jp;g.prototype.add=zp;g.prototype.subtract=Zp;g.prototype.multiply=qp;g.prototype.divide=$p;g.prototype.remainder=Kp;g.prototype.divideAndRemainder=Qp;g.prototype.modPow=ph;g.prototype.modInverse=mh;g.prototype.pow=ih;g.prototype.gcd=hh;g.prototype.isProbablePrime=gh;g.prototype.square=Jp;var k=g;k.prototype.IsNegative=function(){return this.compareTo(k.ZERO)==-1};k.op_Equality=function(e,t){return e.compareTo(t)==0};k.op_Inequality=function(e,t){return e.compareTo(t)!=0};k.op_GreaterThan=function(e,t){return e.compareTo(t)>0};k.op_LessThan=function(e,t){return e.compareTo(t)<0};k.op_Addition=function(e,t){return new k(e).add(new k(t))};k.op_Subtraction=function(e,t){return new k(e).subtract(new k(t))};k.Int128Mul=function(e,t){return new k(e).multiply(new k(t))};k.op_Division=function(e,t){return e.divide(t)};k.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof nn>"u"&&(nn=function(e,t){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in t.prototype)(typeof e.prototype[r]>"u"||e.prototype[r]==Object.prototype[r])&&(e.prototype[r]=t.prototype[r]);for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}else{for(var n=Object.getOwnPropertyNames(t.prototype),i=0;i<n.length;i++)typeof Object.getOwnPropertyDescriptor(e.prototype,n[i])>"u"&&Object.defineProperty(e.prototype,n[i],Object.getOwnPropertyDescriptor(t.prototype,n[i]));for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}});var nn;a.Path=function(){return[]};a.Paths=function(){return[]};a.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};a.DoublePoint0=function(){this.X=0,this.Y=0};a.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};a.DoublePoint2=function(e,t){this.X=e,this.Y=t};a.PolyNode=function(){this.m_Parent=null,this.m_polygon=new a.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};a.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};a.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};a.PolyNode.prototype.Contour=function(){return this.m_polygon};a.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};a.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};a.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};a.PolyNode.prototype.Childs=function(){return this.m_Childs};a.PolyNode.prototype.Parent=function(){return this.m_Parent};a.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};a.PolyTree=function(){this.m_AllPolys=[],a.PolyNode.call(this)};a.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};a.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};a.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};nn(a.PolyTree,a.PolyNode);a.Math_Abs_Int64=a.Math_Abs_Int32=a.Math_Abs_Double=function(e){return Math.abs(e)};a.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};R.msie||R.opera||R.safari?a.Cast_Int32=function(e){return e|0}:a.Cast_Int32=function(e){return~~e};R.chrome?a.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:R.firefox&&typeof Number.toInteger=="function"?a.Cast_Int64=function(e){return Number.toInteger(e)}:R.msie7||R.msie8?a.Cast_Int64=function(e){return parseInt(e,10)}:R.msie?a.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:a.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};a.Clear=function(e){e.length=0};a.PI=3.141592653589793;a.PI2=2*3.141592653589793;a.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,Tt)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof a.DoublePoint){var r=e[0];this.X=a.Clipper.Round(r.X),this.Y=a.Clipper.Round(r.Y),this.Z=0}else{var n=e[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof a.DoublePoint){var r=e[0];this.X=a.Clipper.Round(r.X),this.Y=a.Clipper.Round(r.Y)}else{var n=e[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};a.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};a.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};Tt?(a.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},a.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},a.IntPoint1dp=function(e){this.X=a.Clipper.Round(e.X),this.Y=a.Clipper.Round(e.Y),this.Z=0},a.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},a.IntPoint3=function(e,t,r){this.X=e,this.Y=t,this.Z=r}):(a.IntPoint0=function(){this.X=0,this.Y=0},a.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},a.IntPoint1dp=function(e){this.X=a.Clipper.Round(e.X),this.Y=a.Clipper.Round(e.Y)},a.IntPoint2=function(e,t){this.X=e,this.Y=t});a.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};a.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};a.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};a.IntRect4=function(e,t,r,n){this.left=e,this.top=t,this.right=r,this.bottom=n};a.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};a.PolyType={ptSubject:0,ptClip:1};a.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};a.JoinType={jtSquare:0,jtRound:1,jtMiter:2};a.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};Es&&(a.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});a.EdgeSide={esLeft:0,esRight:1};a.Direction={dRightToLeft:0,dLeftToRight:1};a.TEdge=function(){this.Bot=new a.IntPoint,this.Curr=new a.IntPoint,this.Top=new a.IntPoint,this.Delta=new a.IntPoint,this.Dx=0,this.PolyTyp=a.PolyType.ptSubject,this.Side=a.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};a.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new a.IntPoint};a.MyIntersectNodeSort=function(){};a.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};a.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};a.Scanbeam=function(){this.Y=0,this.Next=null};a.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};a.OutPt=function(){this.Idx=0,this.Pt=new a.IntPoint,this.Next=null,this.Prev=null};a.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new a.IntPoint};a.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};a.ClipperBase.horizontal=-9007199254740992;a.ClipperBase.Skip=-2;a.ClipperBase.Unassigned=-1;a.ClipperBase.tolerance=1e-20;Lc?(a.ClipperBase.loRange=46340,a.ClipperBase.hiRange=46340):(a.ClipperBase.loRange=47453132,a.ClipperBase.hiRange=0xfffffffffffff);a.ClipperBase.near_zero=function(e){return e>-a.ClipperBase.tolerance&&e<a.ClipperBase.tolerance};a.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};a.ClipperBase.prototype.PointIsVertex=function(e,t){var r=t;do{if(a.IntPoint.op_Equality(r.Pt,e))return!0;r=r.Next}while(r!=t);return!1};a.ClipperBase.prototype.PointOnLineSegment=function(e,t,r,n){return n?e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&k.op_Equality(k.Int128Mul(e.X-t.X,r.Y-t.Y),k.Int128Mul(r.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&(e.X-t.X)*(r.Y-t.Y)==(r.X-t.X)*(e.Y-t.Y)};a.ClipperBase.prototype.PointOnPolygon=function(e,t,r){for(var n=t;;){if(this.PointOnLineSegment(e,n.Pt,n.Next.Pt,r))return!0;if(n=n.Next,n==t)break}return!1};a.ClipperBase.prototype.SlopesEqual=a.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,r,n,i,o,s,l,u;return t==3?(r=e[0],n=e[1],u=e[2],u?k.op_Equality(k.Int128Mul(r.Delta.Y,n.Delta.X),k.Int128Mul(r.Delta.X,n.Delta.Y)):a.Cast_Int64(r.Delta.Y*n.Delta.X)==a.Cast_Int64(r.Delta.X*n.Delta.Y)):t==4?(i=e[0],o=e[1],s=e[2],u=e[3],u?k.op_Equality(k.Int128Mul(i.Y-o.Y,o.X-s.X),k.Int128Mul(i.X-o.X,o.Y-s.Y)):a.Cast_Int64((i.Y-o.Y)*(o.X-s.X))-a.Cast_Int64((i.X-o.X)*(o.Y-s.Y))===0):(i=e[0],o=e[1],s=e[2],l=e[3],u=e[4],u?k.op_Equality(k.Int128Mul(i.Y-o.Y,s.X-l.X),k.Int128Mul(i.X-o.X,s.Y-l.Y)):a.Cast_Int64((i.Y-o.Y)*(s.X-l.X))-a.Cast_Int64((i.X-o.X)*(s.Y-l.Y))===0)};a.ClipperBase.SlopesEqual3=function(e,t,r){return r?k.op_Equality(k.Int128Mul(e.Delta.Y,t.Delta.X),k.Int128Mul(e.Delta.X,t.Delta.Y)):a.Cast_Int64(e.Delta.Y*t.Delta.X)==a.Cast_Int64(e.Delta.X*t.Delta.Y)};a.ClipperBase.SlopesEqual4=function(e,t,r,n){return n?k.op_Equality(k.Int128Mul(e.Y-t.Y,t.X-r.X),k.Int128Mul(e.X-t.X,t.Y-r.Y)):a.Cast_Int64((e.Y-t.Y)*(t.X-r.X))-a.Cast_Int64((e.X-t.X)*(t.Y-r.Y))===0};a.ClipperBase.SlopesEqual5=function(e,t,r,n,i){return i?k.op_Equality(k.Int128Mul(e.Y-t.Y,r.X-n.X),k.Int128Mul(e.X-t.X,r.Y-n.Y)):a.Cast_Int64((e.Y-t.Y)*(r.X-n.X))-a.Cast_Int64((e.X-t.X)*(r.Y-n.Y))===0};a.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var r=0,n=this.m_edges[e].length;r<n;++r)this.m_edges[e][r]=null;a.Clear(this.m_edges[e])}a.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};a.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};a.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>a.ClipperBase.hiRange||e.Y>a.ClipperBase.hiRange||-e.X>a.ClipperBase.hiRange||-e.Y>a.ClipperBase.hiRange)&&a.Error("Coordinate outside allowed range in RangeTest()."):(e.X>a.ClipperBase.loRange||e.Y>a.ClipperBase.loRange||-e.X>a.ClipperBase.loRange||-e.Y>a.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};a.ClipperBase.prototype.InitEdge=function(e,t,r,n){e.Next=t,e.Prev=r,e.Curr.X=n.X,e.Curr.Y=n.Y,e.OutIdx=-1};a.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};a.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;a.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||a.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=a.ClipperBase.horizontal&&e.Prev.Dx!=a.ClipperBase.horizontal)break;for(;e.Prev.Dx==a.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==a.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};a.ClipperBase.prototype.ProcessBound=function(e,t){var r=e,n=e,i,o;if(e.Dx==a.ClipperBase.horizontal&&(t?o=e.Prev.Bot.X:o=e.Next.Bot.X,e.Bot.X!=o&&this.ReverseHorizontal(e)),n.OutIdx!=a.ClipperBase.Skip)if(t){for(;n.Top.Y==n.Next.Bot.Y&&n.Next.OutIdx!=a.ClipperBase.Skip;)n=n.Next;if(n.Dx==a.ClipperBase.horizontal&&n.Next.OutIdx!=a.ClipperBase.Skip){for(i=n;i.Prev.Dx==a.ClipperBase.horizontal;)i=i.Prev;i.Prev.Top.X==n.Next.Top.X?t||(n=i.Prev):i.Prev.Top.X>n.Next.Top.X&&(n=i.Prev)}for(;e!=n;)e.NextInLML=e.Next,e.Dx==a.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==a.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),n=n.Next}else{for(;n.Top.Y==n.Prev.Bot.Y&&n.Prev.OutIdx!=a.ClipperBase.Skip;)n=n.Prev;if(n.Dx==a.ClipperBase.horizontal&&n.Prev.OutIdx!=a.ClipperBase.Skip){for(i=n;i.Next.Dx==a.ClipperBase.horizontal;)i=i.Next;i.Next.Top.X==n.Prev.Top.X?t||(n=i.Next):i.Next.Top.X>n.Prev.Top.X&&(n=i.Next)}for(;e!=n;)e.NextInLML=e.Prev,e.Dx==a.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==a.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),n=n.Prev}if(n.OutIdx==a.ClipperBase.Skip){if(e=n,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=n&&e.Dx==a.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=n&&e.Dx==a.ClipperBase.horizontal;)e=e.Next}if(e==n)t?n=e.Next:n=e.Prev;else{t?e=n.Next:e=n.Prev;var s=new a.LocalMinima;s.Next=null,s.Y=e.Bot.Y,s.LeftBound=null,s.RightBound=e,s.RightBound.WindDelta=0,n=this.ProcessBound(s.RightBound,t),this.InsertLocalMinima(s)}}return n};a.ClipperBase.prototype.AddPath=function(e,t,r){ws?!r&&t==a.PolyType.ptClip&&a.Error("AddPath: Open paths must be subject."):r||a.Error("AddPath: Open paths have been disabled.");var n=e.length-1;if(r)for(;n>0&&a.IntPoint.op_Equality(e[n],e[0]);)--n;for(;n>0&&a.IntPoint.op_Equality(e[n],e[n-1]);)--n;if(r&&n<2||!r&&n<1)return!1;for(var i=new Array,o=0;o<=n;o++)i.push(new a.TEdge);var s=!0;i[1].Curr.X=e[1].X,i[1].Curr.Y=e[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(e[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(e[n],l),this.m_UseFullRange=l.Value,this.InitEdge(i[0],i[1],i[n],e[0]),this.InitEdge(i[n],i[0],i[n-1],e[n]);for(var o=n-1;o>=1;--o)l.Value=this.m_UseFullRange,this.RangeTest(e[o],l),this.m_UseFullRange=l.Value,this.InitEdge(i[o],i[o+1],i[o-1],e[o]);for(var u=i[0],f=u,p=u;;){if(a.IntPoint.op_Equality(f.Curr,f.Next.Curr)){if(f==f.Next)break;f==u&&(u=f.Next),f=this.RemoveEdge(f),p=f;continue}if(f.Prev==f.Next)break;if(r&&a.ClipperBase.SlopesEqual(f.Prev.Curr,f.Curr,f.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(f.Prev.Curr,f.Curr,f.Next.Curr))){f==u&&(u=f.Next),f=this.RemoveEdge(f),f=f.Prev,p=f;continue}if(f=f.Next,f==p)break}if(!r&&f==f.Next||r&&f.Prev==f.Next)return!1;r||(this.m_HasOpenPaths=!0,u.Prev.OutIdx=a.ClipperBase.Skip);var d=u;f=u;do this.InitEdge2(f,t),f=f.Next,s&&f.Curr.Y!=u.Curr.Y&&(s=!1);while(f!=u);if(s){if(r)return!1;f.Prev.OutIdx=a.ClipperBase.Skip,f.Prev.Bot.X<f.Prev.Top.X&&this.ReverseHorizontal(f.Prev);var m=new a.LocalMinima;for(m.Next=null,m.Y=f.Bot.Y,m.LeftBound=null,m.RightBound=f,m.RightBound.Side=a.EdgeSide.esRight,m.RightBound.WindDelta=0;f.Next.OutIdx!=a.ClipperBase.Skip;)f.NextInLML=f.Next,f.Bot.X!=f.Prev.Top.X&&this.ReverseHorizontal(f),f=f.Next;return this.InsertLocalMinima(m),this.m_edges.push(i),!0}this.m_edges.push(i);for(var x,b=null;f=this.FindNextLocMin(f),f!=b;){b==null&&(b=f);var m=new a.LocalMinima;m.Next=null,m.Y=f.Bot.Y,f.Dx<f.Prev.Dx?(m.LeftBound=f.Prev,m.RightBound=f,x=!1):(m.LeftBound=f,m.RightBound=f.Prev,x=!0),m.LeftBound.Side=a.EdgeSide.esLeft,m.RightBound.Side=a.EdgeSide.esRight,r?m.LeftBound.Next==m.RightBound?m.LeftBound.WindDelta=-1:m.LeftBound.WindDelta=1:m.LeftBound.WindDelta=0,m.RightBound.WindDelta=-m.LeftBound.WindDelta,f=this.ProcessBound(m.LeftBound,x);var C=this.ProcessBound(m.RightBound,!x);m.LeftBound.OutIdx==a.ClipperBase.Skip?m.LeftBound=null:m.RightBound.OutIdx==a.ClipperBase.Skip&&(m.RightBound=null),this.InsertLocalMinima(m),x||(f=C)}return!0};a.ClipperBase.prototype.AddPaths=function(e,t,r){for(var n=!1,i=0,o=e.length;i<o;++i)this.AddPath(e[i],t,r)&&(n=!0);return n};a.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,r){return a.IntPoint.op_Equality(e,r)||a.IntPoint.op_Equality(e,t)||a.IntPoint.op_Equality(r,t)?!1:e.X!=r.X?t.X>e.X==t.X<r.X:t.Y>e.Y==t.Y<r.Y};a.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};a.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=a.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};a.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};a.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};a.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,Tt&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};a.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=a.EdgeSide.esLeft,t.OutIdx=a.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=a.EdgeSide.esRight,t.OutIdx=a.ClipperBase.Unassigned),e=e.Next}};a.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=a.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=a.PolyFillType.pftEvenOdd,this.m_SubjFillType=a.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,a.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=a.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,Tt&&(this.ZFillFunction=null)};a.Clipper.ioReverseSolution=1;a.Clipper.ioStrictlySimple=2;a.Clipper.ioPreserveCollinear=4;a.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),a.ClipperBase.prototype.Clear.call(this))};a.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};a.Clipper.prototype.Reset=function(){a.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};a.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new a.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new a.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var r=this.m_Scanbeam;r.Next!==null&&e<=r.Next.Y;)r=r.Next;if(e==r.Y)return;var t=new a.Scanbeam;t.Y=e,t.Next=r.Next,r.Next=t}};a.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,r=e[1]instanceof a.PolyTree;if(t==4&&!r){var n=e[0],i=e[1],o=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&a.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,a.Clear(i),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(i)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==4&&r){var n=e[0],u=e[1],o=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var l=this.ExecuteInternal();l&&this.BuildResult2(u)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==2&&!r){var n=e[0],i=e[1];return this.Execute(n,i,a.PolyFillType.pftEvenOdd,a.PolyFillType.pftEvenOdd)}else if(t==2&&r){var n=e[0],u=e[1];return this.Execute(n,u,a.PolyFillType.pftEvenOdd,a.PolyFillType.pftEvenOdd)}};a.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};a.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),a.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts===null||i.IsOpen||(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)}this.JoinCommonEdges();for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts!==null&&!i.IsOpen&&this.FixupOutPolygon(i)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{a.Clear(this.m_Joins),a.Clear(this.m_GhostJoins)}};a.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};a.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);a.Clear(this.m_PolyOuts)};a.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};a.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};a.Clipper.prototype.AddJoin=function(e,t,r){var n=new a.Join;n.OutPt1=e,n.OutPt2=t,n.OffPt.X=r.X,n.OffPt.Y=r.Y,this.m_Joins.push(n)};a.Clipper.prototype.AddGhostJoin=function(e,t){var r=new a.Join;r.OutPt1=e,r.OffPt.X=t.X,r.OffPt.Y=t.Y,this.m_GhostJoins.push(r)};Tt&&(a.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});a.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var n=null;if(t===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(n=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(n=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(r,t),this.SetWindingCount(t),r.WindCnt=t.WindCnt,r.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(n=this.AddLocalMinPoly(t,r,t.Bot)),this.InsertScanbeam(t.Top.Y)),r!=null&&(a.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(t==null||r==null)){if(n!==null&&a.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var i=0,o=this.m_GhostJoins.length;i<o;i++){var s=this.m_GhostJoins[i];this.HorzSegmentsOverlap(s.OutPt1.Pt,s.OffPt,r.Bot,r.Top)&&this.AddJoin(s.OutPt1,n,s.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&a.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(n,l,t.Top)}if(t.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&a.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(n,l,r.Top)}var u=t.NextInAEL;if(u!==null)for(;u!=r;)this.IntersectEdges(r,u,t.Curr,!1),u=u.NextInAEL}}}};a.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};a.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<a.Clipper.TopX(e,t.Top.Y):e.Top.X>a.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};a.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==a.PolyType.ptSubject?this.m_SubjFillType==a.PolyFillType.pftEvenOdd:this.m_ClipFillType==a.PolyFillType.pftEvenOdd};a.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==a.PolyType.ptSubject?this.m_ClipFillType==a.PolyFillType.pftEvenOdd:this.m_SubjFillType==a.PolyFillType.pftEvenOdd};a.Clipper.prototype.IsContributing=function(e){var t,r;switch(e.PolyTyp==a.PolyType.ptSubject?(t=this.m_SubjFillType,r=this.m_ClipFillType):(t=this.m_ClipFillType,r=this.m_SubjFillType),t){case a.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case a.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case a.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case a.ClipType.ctIntersection:switch(r){case a.PolyFillType.pftEvenOdd:case a.PolyFillType.pftNonZero:return e.WindCnt2!==0;case a.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case a.ClipType.ctUnion:switch(r){case a.PolyFillType.pftEvenOdd:case a.PolyFillType.pftNonZero:return e.WindCnt2===0;case a.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case a.ClipType.ctDifference:if(e.PolyTyp==a.PolyType.ptSubject)switch(r){case a.PolyFillType.pftEvenOdd:case a.PolyFillType.pftNonZero:return e.WindCnt2===0;case a.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(r){case a.PolyFillType.pftEvenOdd:case a.PolyFillType.pftNonZero:return e.WindCnt2!==0;case a.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case a.ClipType.ctXor:if(e.WindDelta===0)switch(r){case a.PolyFillType.pftEvenOdd:case a.PolyFillType.pftNonZero:return e.WindCnt2===0;case a.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};a.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=a.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var r=!0,n=t.PrevInAEL;n!==null;)n.PolyTyp==t.PolyTyp&&n.WindDelta!==0&&(r=!r),n=n.PrevInAEL;e.WindCnt=r?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};a.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};a.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};a.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var n=e.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var n=t.PrevInAEL;n!==null&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else{var r=e.NextInAEL,n=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=r,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=n,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};a.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var n=e.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else{var r=e.NextInSEL,n=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=r,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=n,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};a.Clipper.prototype.AddLocalMaxPoly=function(e,t,r){this.AddOutPt(e,r),t.WindDelta==0&&this.AddOutPt(t,r),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};a.Clipper.prototype.AddLocalMinPoly=function(e,t,r){var n,i,o;if(a.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(n=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,e.Side=a.EdgeSide.esLeft,t.Side=a.EdgeSide.esRight,i=e,i.PrevInAEL==t?o=t.PrevInAEL:o=i.PrevInAEL):(n=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,e.Side=a.EdgeSide.esRight,t.Side=a.EdgeSide.esLeft,i=t,i.PrevInAEL==e?o=e.PrevInAEL:o=i.PrevInAEL),o!==null&&o.OutIdx>=0&&a.Clipper.TopX(o,r.Y)==a.Clipper.TopX(i,r.Y)&&a.ClipperBase.SlopesEqual(i,o,this.m_UseFullRange)&&i.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,r);this.AddJoin(n,s,i.Top)}return n};a.Clipper.prototype.CreateOutRec=function(){var e=new a.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};a.Clipper.prototype.AddOutPt=function(e,t){var r=e.Side==a.EdgeSide.esLeft;if(e.OutIdx<0){var n=this.CreateOutRec();n.IsOpen=e.WindDelta===0;var i=new a.OutPt;return n.Pts=i,i.Idx=n.Idx,i.Pt.X=t.X,i.Pt.Y=t.Y,i.Next=i,i.Prev=i,n.IsOpen||this.SetHoleState(e,n),Tt&&(a.IntPoint.op_Equality(t,e.Bot)?(i.Pt.X=e.Bot.X,i.Pt.Y=e.Bot.Y,i.Pt.Z=e.Bot.Z):a.IntPoint.op_Equality(t,e.Top)?(i.Pt.X=e.Top.X,i.Pt.Y=e.Top.Y,i.Pt.Z=e.Top.Z):this.SetZ(i.Pt,e)),e.OutIdx=n.Idx,i}else{var n=this.m_PolyOuts[e.OutIdx],o=n.Pts;if(r&&a.IntPoint.op_Equality(t,o.Pt))return o;if(!r&&a.IntPoint.op_Equality(t,o.Prev.Pt))return o.Prev;var i=new a.OutPt;return i.Idx=n.Idx,i.Pt.X=t.X,i.Pt.Y=t.Y,i.Next=o,i.Prev=o.Prev,i.Prev.Next=i,o.Prev=i,r&&(n.Pts=i),Tt&&(a.IntPoint.op_Equality(t,e.Bot)?(i.Pt.X=e.Bot.X,i.Pt.Y=e.Bot.Y,i.Pt.Z=e.Bot.Z):a.IntPoint.op_Equality(t,e.Top)?(i.Pt.X=e.Top.X,i.Pt.Y=e.Top.Y,i.Pt.Z=e.Top.Z):this.SetZ(i.Pt,e)),i}};a.Clipper.prototype.SwapPoints=function(e,t){var r=new a.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=r.X,t.Value.Y=r.Y};a.Clipper.prototype.HorzSegmentsOverlap=function(e,t,r,n){return e.X>r.X==e.X<n.X||t.X>r.X==t.X<n.X||r.X>e.X==r.X<t.X||n.X>e.X==n.X<t.X||e.X==r.X&&t.X==n.X?!0:e.X==n.X&&t.X==r.X};a.Clipper.prototype.InsertPolyPtBetween=function(e,t,r){var n=new a.OutPt;return n.Pt.X=r.X,n.Pt.Y=r.Y,t==e.Next?(e.Next=n,t.Prev=n,n.Next=t,n.Prev=e):(t.Next=n,e.Prev=n,n.Next=e,n.Prev=t),n};a.Clipper.prototype.SetHoleState=function(e,t){for(var r=!1,n=e.PrevInAEL;n!==null;)n.OutIdx>=0&&n.WindDelta!=0&&(r=!r,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[n.OutIdx])),n=n.PrevInAEL;r&&(t.IsHole=!0)};a.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?a.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};a.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var r=e.Prev;a.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var n=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;a.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var i=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=t.Prev;a.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var o=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;a.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var s=Math.abs(this.GetDx(t.Pt,r.Pt));return n>=o&&n>=s||i>=o&&i>=s};a.Clipper.prototype.GetBottomPt=function(e){for(var t=null,r=e.Next;r!=e;)r.Pt.Y>e.Pt.Y?(e=r,t=null):r.Pt.Y==e.Pt.Y&&r.Pt.X<=e.Pt.X&&(r.Pt.X<e.Pt.X?(t=null,e=r):r.Next!=e&&r.Prev!=e&&(t=r)),r=r.Next;if(t!==null)for(;t!=r;)for(this.FirstIsBottomPt(r,t)||(e=t),t=t.Next;a.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};a.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var r=e.BottomPt,n=t.BottomPt;return r.Pt.Y>n.Pt.Y?e:r.Pt.Y<n.Pt.Y?t:r.Pt.X<n.Pt.X?e:r.Pt.X>n.Pt.X||r.Next==r?t:n.Next==n||this.FirstIsBottomPt(r,n)?e:t};a.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};a.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};a.Clipper.prototype.AppendPolygon=function(e,t){var r=this.m_PolyOuts[e.OutIdx],n=this.m_PolyOuts[t.OutIdx],i;this.Param1RightOfParam2(r,n)?i=n:this.Param1RightOfParam2(n,r)?i=r:i=this.GetLowermostRec(r,n);var o=r.Pts,s=o.Prev,l=n.Pts,u=l.Prev,f;e.Side==a.EdgeSide.esLeft?(t.Side==a.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,s.Next=u,u.Prev=s,r.Pts=u):(u.Next=o,o.Prev=u,l.Prev=s,s.Next=l,r.Pts=l),f=a.EdgeSide.esLeft):(t.Side==a.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=u,u.Prev=s,l.Next=o,o.Prev=l):(s.Next=l,l.Prev=s,o.Prev=u,u.Next=o),f=a.EdgeSide.esRight),r.BottomPt=null,i==n&&(n.FirstLeft!=r&&(r.FirstLeft=n.FirstLeft),r.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=r;var p=e.OutIdx,d=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var m=this.m_ActiveEdges;m!==null;){if(m.OutIdx==d){m.OutIdx=p,m.Side=f;break}m=m.NextInAEL}n.Idx=r.Idx};a.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,r;t=e;do r=t.Next,t.Next=t.Prev,t.Prev=r,t=r;while(t!=e)}};a.Clipper.SwapSides=function(e,t){var r=e.Side;e.Side=t.Side,t.Side=r};a.Clipper.SwapPolyIndexes=function(e,t){var r=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=r};a.Clipper.prototype.IntersectEdges=function(e,t,r,n){var i=!n&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,o=!n&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,s=e.OutIdx>=0,l=t.OutIdx>=0;if(ws&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(i||o)&&s&&l&&this.AddLocalMaxPoly(e,t,r):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==a.ClipType.ctUnion?e.WindDelta===0?l&&(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):s&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=a.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=a.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1))),i&&(e.OutIdx<0?this.DeleteFromAEL(e):a.Error("Error intersecting polylines")),o&&(t.OutIdx<0?this.DeleteFromAEL(t):a.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var u=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=u}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var f,p,d,m;e.PolyTyp==a.PolyType.ptSubject?(f=this.m_SubjFillType,d=this.m_ClipFillType):(f=this.m_ClipFillType,d=this.m_SubjFillType),t.PolyTyp==a.PolyType.ptSubject?(p=this.m_SubjFillType,m=this.m_ClipFillType):(p=this.m_ClipFillType,m=this.m_SubjFillType);var x,b;switch(f){case a.PolyFillType.pftPositive:x=e.WindCnt;break;case a.PolyFillType.pftNegative:x=-e.WindCnt;break;default:x=Math.abs(e.WindCnt);break}switch(p){case a.PolyFillType.pftPositive:b=t.WindCnt;break;case a.PolyFillType.pftNegative:b=-t.WindCnt;break;default:b=Math.abs(t.WindCnt);break}if(s&&l)i||o||x!==0&&x!=1||b!==0&&b!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=a.ClipType.ctXor?this.AddLocalMaxPoly(e,t,r):(this.AddOutPt(e,r),this.AddOutPt(t,r),a.Clipper.SwapSides(e,t),a.Clipper.SwapPolyIndexes(e,t));else if(s)(b===0||b==1)&&(this.AddOutPt(e,r),a.Clipper.SwapSides(e,t),a.Clipper.SwapPolyIndexes(e,t));else if(l)(x===0||x==1)&&(this.AddOutPt(t,r),a.Clipper.SwapSides(e,t),a.Clipper.SwapPolyIndexes(e,t));else if((x===0||x==1)&&(b===0||b==1)&&!i&&!o){var C,w;switch(d){case a.PolyFillType.pftPositive:C=e.WindCnt2;break;case a.PolyFillType.pftNegative:C=-e.WindCnt2;break;default:C=Math.abs(e.WindCnt2);break}switch(m){case a.PolyFillType.pftPositive:w=t.WindCnt2;break;case a.PolyFillType.pftNegative:w=-t.WindCnt2;break;default:w=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,r);else if(x==1&&b==1)switch(this.m_ClipType){case a.ClipType.ctIntersection:C>0&&w>0&&this.AddLocalMinPoly(e,t,r);break;case a.ClipType.ctUnion:C<=0&&w<=0&&this.AddLocalMinPoly(e,t,r);break;case a.ClipType.ctDifference:(e.PolyTyp==a.PolyType.ptClip&&C>0&&w>0||e.PolyTyp==a.PolyType.ptSubject&&C<=0&&w<=0)&&this.AddLocalMinPoly(e,t,r);break;case a.ClipType.ctXor:this.AddLocalMinPoly(e,t,r);break}else a.Clipper.SwapSides(e,t)}i!=o&&(i&&e.OutIdx>=0||o&&t.OutIdx>=0)&&(a.Clipper.SwapSides(e,t),a.Clipper.SwapPolyIndexes(e,t)),i&&this.DeleteFromAEL(e),o&&this.DeleteFromAEL(t)};a.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,r=e.NextInAEL;t===null&&r===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};a.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,r=e.NextInSEL;t===null&&r===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};a.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&a.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,r=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,r!==null&&(r.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=r,a.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};a.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};a.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=a.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=a.Direction.dRightToLeft)};a.Clipper.prototype.PrepareHorzJoins=function(e,t){var r=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=a.EdgeSide.esLeft&&(r=r.Prev),t&&(a.IntPoint.op_Equality(r.Pt,e.Top)?this.AddGhostJoin(r,e.Bot):this.AddGhostJoin(r,e.Top))};a.Clipper.prototype.ProcessHorizontal=function(e,t){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,r);for(var n=r.Dir,i=r.Left,o=r.Right,s=e,l=null;s.NextInLML!==null&&a.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var u=e==s,f=this.GetNextInAEL(e,n);f!==null&&!(f.Curr.X==e.Top.X&&e.NextInLML!==null&&f.Dx<e.NextInLML.Dx);){var p=this.GetNextInAEL(f,n);if(n==a.Direction.dLeftToRight&&f.Curr.X<=o||n==a.Direction.dRightToLeft&&f.Curr.X>=i){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),f==l&&u){n==a.Direction.dLeftToRight?this.IntersectEdges(e,f,f.Top,!1):this.IntersectEdges(f,e,f.Top,!1),l.OutIdx>=0&&a.Error("ProcessHorizontal error");return}else if(n==a.Direction.dLeftToRight){var d=new a.IntPoint(f.Curr.X,e.Curr.Y);this.IntersectEdges(e,f,d,!0)}else{var d=new a.IntPoint(f.Curr.X,e.Curr.Y);this.IntersectEdges(f,e,d,!0)}this.SwapPositionsInAEL(e,f)}else if(n==a.Direction.dLeftToRight&&f.Curr.X>=o||n==a.Direction.dRightToLeft&&f.Curr.X<=i)break;f=p}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&a.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var r={Dir:n,Left:i,Right:o};this.GetHorzDirection(e,r),n=r.Dir,i=r.Left,o=r.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var m=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var x=e.PrevInAEL,p=e.NextInAEL;if(x!==null&&x.Curr.X==e.Bot.X&&x.Curr.Y==e.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&a.ClipperBase.SlopesEqual(e,x,this.m_UseFullRange)){var b=this.AddOutPt(x,e.Bot);this.AddJoin(m,b,e.Top)}else if(p!==null&&p.Curr.X==e.Bot.X&&p.Curr.Y==e.Bot.Y&&p.WindDelta!==0&&p.OutIdx>=0&&p.Curr.Y>p.Top.Y&&a.ClipperBase.SlopesEqual(e,p,this.m_UseFullRange)){var b=this.AddOutPt(p,e.Bot);this.AddJoin(m,b,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else l!==null?l.OutIdx>=0?(n==a.Direction.dLeftToRight?this.IntersectEdges(e,l,e.Top,!1):this.IntersectEdges(l,e,e.Top,!1),l.OutIdx>=0&&a.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(l)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};a.Clipper.prototype.GetNextInAEL=function(e,t){return t==a.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};a.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};a.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};a.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};a.Clipper.prototype.GetMaximaPair=function(e){var t=null;return a.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:a.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!a.ClipperBase.IsHorizontal(t))?null:t};a.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,a.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};a.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=a.Clipper.TopX(r,t),r=r.NextInAEL;for(var n=!0;n&&this.m_SortedEdges!==null;){for(n=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var i=r.NextInSEL,o=new a.IntPoint;if(r.Curr.X>i.Curr.X){!this.IntersectPoint(r,i,o)&&r.Curr.X>i.Curr.X+1&&a.Error("Intersection error"),o.Y>e&&(o.Y=e,Math.abs(r.Dx)>Math.abs(i.Dx)?o.X=a.Clipper.TopX(i,e):o.X=a.Clipper.TopX(r,e));var s=new a.IntersectNode;s.Edge1=r,s.Edge2=i,s.Pt.X=o.X,s.Pt.Y=o.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(r,i),n=!0}else r=i}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};a.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};a.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};a.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var r=t+1;r<e&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==e)return!1;var n=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[r],this.m_IntersectList[r]=n}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};a.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var r=this.m_IntersectList[e];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var xh=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},bh=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},_h=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},Ph=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};R.msie?a.Clipper.Round=xh:R.chromium?a.Clipper.Round=_h:R.safari?a.Clipper.Round=Ph:a.Clipper.Round=bh;a.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+a.Clipper.Round(e.Dx*(t-e.Bot.Y))};a.Clipper.prototype.IntersectPoint=function(e,t,r){r.X=0,r.Y=0;var n,i;if(a.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(r.X=t.Bot.X,r.Y=t.Bot.Y):(r.X=e.Bot.X,r.Y=e.Bot.Y),!1;if(e.Delta.X===0)r.X=e.Bot.X,a.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(i=t.Bot.Y-t.Bot.X/t.Dx,r.Y=a.Clipper.Round(r.X/t.Dx+i));else if(t.Delta.X===0)r.X=t.Bot.X,a.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=a.Clipper.Round(r.X/e.Dx+n));else{n=e.Bot.X-e.Bot.Y*e.Dx,i=t.Bot.X-t.Bot.Y*t.Dx;var o=(i-n)/(e.Dx-t.Dx);r.Y=a.Clipper.Round(o),Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=a.Clipper.Round(e.Dx*o+n):r.X=a.Clipper.Round(t.Dx*o+i)}if(r.Y<e.Top.Y||r.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return r.Y=e.Top.Y,r.X=a.Clipper.TopX(t,e.Top.Y),r.X<e.Top.X;r.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=a.Clipper.TopX(e,r.Y):r.X=a.Clipper.TopX(t,r.Y)}return!0};a.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var r=this.IsMaxima(t,e);if(r){var n=this.GetMaximaPair(t);r=n===null||!a.ClipperBase.IsHorizontal(n)}if(r){var i=t.PrevInAEL;this.DoMaxima(t),i===null?t=this.m_ActiveEdges:t=i.NextInAEL}else{if(this.IsIntermediate(t,e)&&a.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=a.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var i=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&i!==null&&i.OutIdx>=0&&i.Curr.X==t.Curr.X&&i.WindDelta!==0){var o=this.AddOutPt(i,t.Curr),s=this.AddOutPt(t,t.Curr);this.AddJoin(o,s,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var o=null;t.OutIdx>=0&&(o=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var i=t.PrevInAEL,l=t.NextInAEL;if(i!==null&&i.Curr.X==t.Bot.X&&i.Curr.Y==t.Bot.Y&&o!==null&&i.OutIdx>=0&&i.Curr.Y>i.Top.Y&&a.ClipperBase.SlopesEqual(t,i,this.m_UseFullRange)&&t.WindDelta!==0&&i.WindDelta!==0){var s=this.AddOutPt(i,t.Bot);this.AddJoin(o,s,t.Top)}else if(l!==null&&l.Curr.X==t.Bot.X&&l.Curr.Y==t.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&a.ClipperBase.SlopesEqual(t,l,this.m_UseFullRange)&&t.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,t.Bot);this.AddJoin(o,s,t.Top)}}t=t.NextInAEL}};a.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var r=e.NextInAEL,n=!0;r!==null&&r!=t;)this.IntersectEdges(e,r,e.Top,!0),this.SwapPositionsInAEL(e,r),r=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):n&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):a.Error("DoMaxima error")};a.Clipper.ReversePaths=function(e){for(var t=0,r=e.length;t<r;t++)e[t].reverse()};a.Clipper.Orientation=function(e){return a.Clipper.Area(e)>=0};a.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,r=e;do t++,r=r.Next;while(r!=e);return t};a.Clipper.prototype.BuildResult=function(e){a.Clear(e);for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];if(n.Pts!==null){var i=n.Pts.Prev,o=this.PointCount(i);if(!(o<2)){for(var s=new Array(o),l=0;l<o;l++)s[l]=i.Pt,i=i.Prev;e.push(s)}}}};a.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t],i=this.PointCount(n.Pts);if(!(n.IsOpen&&i<2||!n.IsOpen&&i<3)){this.FixHoleLinkage(n);var o=new a.PolyNode;e.m_AllPolys.push(o),n.PolyNode=o,o.m_polygon.length=i;for(var s=n.Pts.Prev,l=0;l<i;l++)o.m_polygon[l]=s.Pt,s=s.Prev}}for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];n.PolyNode!==null&&(n.IsOpen?(n.PolyNode.IsOpen=!0,e.AddChild(n.PolyNode)):n.FirstLeft!==null&&n.FirstLeft.PolyNode!=null?n.FirstLeft.PolyNode.AddChild(n.PolyNode):e.AddChild(n.PolyNode))}};a.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var r=e.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),e.Pts=null;return}if(a.IntPoint.op_Equality(r.Pt,r.Next.Pt)||a.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||a.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){t=null;var n=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,n=null}else{if(r==t)break;t===null&&(t=r),r=r.Next}}e.Pts=r};a.Clipper.prototype.DupOutPt=function(e,t){var r=new a.OutPt;return r.Pt.X=e.Pt.X,r.Pt.Y=e.Pt.Y,r.Idx=e.Idx,t?(r.Next=e.Next,r.Prev=e,e.Next.Prev=r,e.Next=r):(r.Prev=e.Prev,r.Next=e,e.Prev.Next=r,e.Prev=r),r};a.Clipper.prototype.GetOverlap=function(e,t,r,n,i){return e<t?r<n?(i.Left=Math.max(e,r),i.Right=Math.min(t,n)):(i.Left=Math.max(e,n),i.Right=Math.min(t,r)):r<n?(i.Left=Math.max(t,r),i.Right=Math.min(e,n)):(i.Left=Math.max(t,n),i.Right=Math.min(e,r)),i.Left<i.Right};a.Clipper.prototype.JoinHorz=function(e,t,r,n,i,o){var s=e.Pt.X>t.Pt.X?a.Direction.dRightToLeft:a.Direction.dLeftToRight,l=r.Pt.X>n.Pt.X?a.Direction.dRightToLeft:a.Direction.dLeftToRight;if(s==l)return!1;if(s==a.Direction.dLeftToRight){for(;e.Next.Pt.X<=i.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==i.Y;)e=e.Next;o&&e.Pt.X!=i.X&&(e=e.Next),t=this.DupOutPt(e,!o),a.IntPoint.op_Inequality(t.Pt,i)&&(e=t,e.Pt.X=i.X,e.Pt.Y=i.Y,t=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=i.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==i.Y;)e=e.Next;!o&&e.Pt.X!=i.X&&(e=e.Next),t=this.DupOutPt(e,o),a.IntPoint.op_Inequality(t.Pt,i)&&(e=t,e.Pt.X=i.X,e.Pt.Y=i.Y,t=this.DupOutPt(e,o))}if(l==a.Direction.dLeftToRight){for(;r.Next.Pt.X<=i.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==i.Y;)r=r.Next;o&&r.Pt.X!=i.X&&(r=r.Next),n=this.DupOutPt(r,!o),a.IntPoint.op_Inequality(n.Pt,i)&&(r=n,r.Pt.X=i.X,r.Pt.Y=i.Y,n=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=i.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==i.Y;)r=r.Next;!o&&r.Pt.X!=i.X&&(r=r.Next),n=this.DupOutPt(r,o),a.IntPoint.op_Inequality(n.Pt,i)&&(r=n,r.Pt.X=i.X,r.Pt.Y=i.Y,n=this.DupOutPt(r,o))}return s==a.Direction.dLeftToRight==o?(e.Prev=r,r.Next=e,t.Next=n,n.Prev=t):(e.Next=r,r.Prev=e,t.Prev=n,n.Next=t),!0};a.Clipper.prototype.JoinPoints=function(e,t,r){var n=e.OutPt1,i=new a.OutPt,o=e.OutPt2,s=new a.OutPt,l=e.OutPt1.Pt.Y==e.OffPt.Y;if(l&&a.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&a.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(i=e.OutPt1.Next;i!=n&&a.IntPoint.op_Equality(i.Pt,e.OffPt);)i=i.Next;var u=i.Pt.Y>e.OffPt.Y;for(s=e.OutPt2.Next;s!=o&&a.IntPoint.op_Equality(s.Pt,e.OffPt);)s=s.Next;var f=s.Pt.Y>e.OffPt.Y;return u==f?!1:u?(i=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,i.Next=s,s.Prev=i,e.OutPt1=n,e.OutPt2=i,!0):(i=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,i.Prev=s,s.Next=i,e.OutPt1=n,e.OutPt2=i,!0)}else if(l){for(i=n;n.Prev.Pt.Y==n.Pt.Y&&n.Prev!=i&&n.Prev!=o;)n=n.Prev;for(;i.Next.Pt.Y==i.Pt.Y&&i.Next!=n&&i.Next!=o;)i=i.Next;if(i.Next==n||i.Next==o)return!1;for(s=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=s&&o.Prev!=i;)o=o.Prev;for(;s.Next.Pt.Y==s.Pt.Y&&s.Next!=o&&s.Next!=n;)s=s.Next;if(s.Next==o||s.Next==n)return!1;var p={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,i.Pt.X,o.Pt.X,s.Pt.X,p))return!1;var d=p.Left,m=p.Right,x=new a.IntPoint,b;return n.Pt.X>=d&&n.Pt.X<=m?(x.X=n.Pt.X,x.Y=n.Pt.Y,b=n.Pt.X>i.Pt.X):o.Pt.X>=d&&o.Pt.X<=m?(x.X=o.Pt.X,x.Y=o.Pt.Y,b=o.Pt.X>s.Pt.X):i.Pt.X>=d&&i.Pt.X<=m?(x.X=i.Pt.X,x.Y=i.Pt.Y,b=i.Pt.X>n.Pt.X):(x.X=s.Pt.X,x.Y=s.Pt.Y,b=s.Pt.X>o.Pt.X),e.OutPt1=n,e.OutPt2=o,this.JoinHorz(n,i,o,s,x,b)}else{for(i=n.Next;a.IntPoint.op_Equality(i.Pt,n.Pt)&&i!=n;)i=i.Next;var C=i.Pt.Y>n.Pt.Y||!a.ClipperBase.SlopesEqual(n.Pt,i.Pt,e.OffPt,this.m_UseFullRange);if(C){for(i=n.Prev;a.IntPoint.op_Equality(i.Pt,n.Pt)&&i!=n;)i=i.Prev;if(i.Pt.Y>n.Pt.Y||!a.ClipperBase.SlopesEqual(n.Pt,i.Pt,e.OffPt,this.m_UseFullRange))return!1}for(s=o.Next;a.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Next;var w=s.Pt.Y>o.Pt.Y||!a.ClipperBase.SlopesEqual(o.Pt,s.Pt,e.OffPt,this.m_UseFullRange);if(w){for(s=o.Prev;a.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!a.ClipperBase.SlopesEqual(o.Pt,s.Pt,e.OffPt,this.m_UseFullRange))return!1}return i==n||s==o||i==s||t==r&&C==w?!1:C?(i=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,i.Next=s,s.Prev=i,e.OutPt1=n,e.OutPt2=i,!0):(i=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,i.Prev=s,s.Next=i,e.OutPt1=n,e.OutPt2=i,!0)}};a.Clipper.GetBounds=function(e){for(var t=0,r=e.length;t<r&&e[t].length==0;)t++;if(t==r)return new a.IntRect(0,0,0,0);var n=new a.IntRect;for(n.left=e[t][0].X,n.right=n.left,n.top=e[t][0].Y,n.bottom=n.top;t<r;t++)for(var i=0,o=e[t].length;i<o;i++)e[t][i].X<n.left?n.left=e[t][i].X:e[t][i].X>n.right&&(n.right=e[t][i].X),e[t][i].Y<n.top?n.top=e[t][i].Y:e[t][i].Y>n.bottom&&(n.bottom=e[t][i].Y);return n};a.Clipper.prototype.GetBounds2=function(e){var t=e,r=new a.IntRect;for(r.left=e.Pt.X,r.right=e.Pt.X,r.top=e.Pt.Y,r.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<r.left&&(r.left=e.Pt.X),e.Pt.X>r.right&&(r.right=e.Pt.X),e.Pt.Y<r.top&&(r.top=e.Pt.Y),e.Pt.Y>r.bottom&&(r.bottom=e.Pt.Y),e=e.Next;return r};a.Clipper.PointInPolygon=function(e,t){var r=0,n=t.length;if(n<3)return 0;for(var i=t[0],o=1;o<=n;++o){var s=o==n?t[0]:t[o];if(s.Y==e.Y&&(s.X==e.X||i.Y==e.Y&&s.X>e.X==i.X<e.X))return-1;if(i.Y<e.Y!=s.Y<e.Y){if(i.X>=e.X)if(s.X>e.X)r=1-r;else{var l=(i.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(i.Y-e.Y);if(l==0)return-1;l>0==s.Y>i.Y&&(r=1-r)}else if(s.X>e.X){var l=(i.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(i.Y-e.Y);if(l==0)return-1;l>0==s.Y>i.Y&&(r=1-r)}}i=s}return r};a.Clipper.prototype.PointInPolygon=function(e,t){for(var r=0,n=t;;){var i=t.Pt.X,o=t.Pt.Y,s=t.Next.Pt.X,l=t.Next.Pt.Y;if(l==e.Y&&(s==e.X||o==e.Y&&s>e.X==i<e.X))return-1;if(o<e.Y!=l<e.Y){if(i>=e.X)if(s>e.X)r=1-r;else{var u=(i-e.X)*(l-e.Y)-(s-e.X)*(o-e.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}else if(s>e.X){var u=(i-e.X)*(l-e.Y)-(s-e.X)*(o-e.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}}if(t=t.Next,n==t)break}return r};a.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var r=e;do{var n=this.PointInPolygon(r.Pt,t);if(n>=0)return n!=0;r=r.Next}while(r!=e);return!0};a.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts!==null&&i.FirstLeft==e&&this.Poly2ContainsPoly1(i.Pts,t.Pts)&&(i.FirstLeft=t)}};a.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var r=0,n=this.m_PolyOuts,i=n.length,o=n[r];r<i;r++,o=n[r])o.FirstLeft==e&&(o.FirstLeft=t)};a.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};a.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var r=this.m_Joins[e],n=this.GetOutRec(r.OutPt1.Idx),i=this.GetOutRec(r.OutPt2.Idx);if(!(n.Pts==null||i.Pts==null)){var o;if(n==i?o=n:this.Param1RightOfParam2(n,i)?o=i:this.Param1RightOfParam2(i,n)?o=n:o=this.GetLowermostRec(n,i),!!this.JoinPoints(r,n,i))if(n==i){if(n.Pts=r.OutPt1,n.BottomPt=null,i=this.CreateOutRec(),i.Pts=r.OutPt2,this.UpdateOutPtIdxs(i),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var u=this.m_PolyOuts[s];u.Pts==null||a.Clipper.ParseFirstLeft(u.FirstLeft)!=n||u.IsHole==n.IsHole||this.Poly2ContainsPoly1(u.Pts,r.OutPt2)&&(u.FirstLeft=i)}this.Poly2ContainsPoly1(i.Pts,n.Pts)?(i.IsHole=!n.IsHole,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):this.Poly2ContainsPoly1(n.Pts,i.Pts)?(i.IsHole=n.IsHole,n.IsHole=!i.IsHole,i.FirstLeft=n.FirstLeft,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):(i.IsHole=n.IsHole,i.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,i))}else i.Pts=null,i.BottomPt=null,i.Idx=n.Idx,n.IsHole=o.IsHole,o==i&&(n.FirstLeft=i.FirstLeft),i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n)}}};a.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};a.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],r=t.Pts;if(r!==null)do{for(var n=r.Next;n!=t.Pts;){if(a.IntPoint.op_Equality(r.Pt,n.Pt)&&n.Next!=r&&n.Prev!=r){var i=r.Prev,o=n.Prev;r.Prev=o,o.Next=r,n.Prev=i,i.Next=n,t.Pts=r;var s=this.CreateOutRec();s.Pts=n,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,t.Pts)?(s.IsHole=!t.IsHole,s.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,s.Pts)?(s.IsHole=t.IsHole,t.IsHole=!s.IsHole,s.FirstLeft=t.FirstLeft,t.FirstLeft=s):(s.IsHole=t.IsHole,s.FirstLeft=t.FirstLeft),n=r}n=n.Next}r=r.Next}while(r!=t.Pts)}};a.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var r=0,n=0,i=t-1;n<t;++n)r+=(e[i].X+e[n].X)*(e[i].Y-e[n].Y),i=n;return-r*.5};a.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var r=0;do r=r+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return r*.5};Es&&(a.Clipper.OffsetPaths=function(e,t,r,n,i){var o=new a.Paths,s=new a.ClipperOffset(i,i);return s.AddPaths(e,r,n),s.Execute(o,t),o});a.Clipper.SimplifyPolygon=function(e,t){var r=new Array,n=new a.Clipper(0);return n.StrictlySimple=!0,n.AddPath(e,a.PolyType.ptSubject,!0),n.Execute(a.ClipType.ctUnion,r,t,t),r};a.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=a.PolyFillType.pftEvenOdd);var r=new Array,n=new a.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(e,a.PolyType.ptSubject,!0),n.Execute(a.ClipType.ctUnion,r,t,t),r};a.Clipper.DistanceSqrd=function(e,t){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n};a.Clipper.DistanceFromLineSqrd=function(e,t,r){var n=t.Y-r.Y,i=r.X-t.X,o=n*t.X+i*t.Y;return o=n*e.X+i*e.Y-o,o*o/(n*n+i*i)};a.Clipper.SlopesNearCollinear=function(e,t,r,n){return a.Clipper.DistanceFromLineSqrd(t,e,r)<n};a.Clipper.PointsAreClose=function(e,t,r){var n=e.X-t.X,i=e.Y-t.Y;return n*n+i*i<=r};a.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};a.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var r=e.length;if(r==0)return new Array;for(var n=new Array(r),i=0;i<r;++i)n[i]=new a.OutPt;for(var i=0;i<r;++i)n[i].Pt=e[i],n[i].Next=n[(i+1)%r],n[i].Next.Prev=n[i],n[i].Idx=0;for(var o=t*t,s=n[0];s.Idx==0&&s.Next!=s.Prev;)a.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,o)?(s=a.Clipper.ExcludeOp(s),r--):a.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,o)?(a.Clipper.ExcludeOp(s.Next),s=a.Clipper.ExcludeOp(s),r-=2):a.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,o)?(s=a.Clipper.ExcludeOp(s),r--):(s.Idx=1,s=s.Next);r<3&&(r=0);for(var l=new Array(r),i=0;i<r;++i)l[i]=new a.IntPoint(s.Pt),s=s.Next;return n=null,l};a.Clipper.CleanPolygons=function(e,t){for(var r=new Array(e.length),n=0,i=e.length;n<i;n++)r[n]=a.Clipper.CleanPolygon(e[n],t);return r};a.Clipper.Minkowski=function(e,t,r,n){var i=n?1:0,o=e.length,s=t.length,l=new Array;if(r)for(var u=0;u<s;u++){for(var f=new Array(o),p=0,d=e.length,m=e[p];p<d;p++,m=e[p])f[p]=new a.IntPoint(t[u].X+m.X,t[u].Y+m.Y);l.push(f)}else for(var u=0;u<s;u++){for(var f=new Array(o),p=0,d=e.length,m=e[p];p<d;p++,m=e[p])f[p]=new a.IntPoint(t[u].X-m.X,t[u].Y-m.Y);l.push(f)}for(var x=new Array,u=0;u<s-1+i;u++)for(var p=0;p<o;p++){var b=new Array;b.push(l[u%s][p%o]),b.push(l[(u+1)%s][p%o]),b.push(l[(u+1)%s][(p+1)%o]),b.push(l[u%s][(p+1)%o]),a.Clipper.Orientation(b)||b.reverse(),x.push(b)}var C=new a.Clipper(0);return C.AddPaths(x,a.PolyType.ptSubject,!0),C.Execute(a.ClipType.ctUnion,l,a.PolyFillType.pftNonZero,a.PolyFillType.pftNonZero),l};a.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var r=e[0],n=e[1],i=e[2];return a.Clipper.Minkowski(r,n,!0,i)}else if(t==4){for(var r=e[0],o=e[1],s=e[2],i=e[3],l=new a.Clipper,u,f=0,p=o.length;f<p;++f){var u=a.Clipper.Minkowski(r,o[f],!0,i);l.AddPaths(u,a.PolyType.ptSubject,!0)}i&&l.AddPaths(o,a.PolyType.ptClip,!0);var d=new a.Paths;return l.Execute(a.ClipType.ctUnion,d,s,s),d}};a.Clipper.MinkowskiDiff=function(e,t,r){return a.Clipper.Minkowski(e,t,!1,r)};a.Clipper.PolyTreeToPaths=function(e){var t=new Array;return a.Clipper.AddPolyNodeToPaths(e,a.Clipper.NodeType.ntAny,t),t};a.Clipper.AddPolyNodeToPaths=function(e,t,r){var n=!0;switch(t){case a.Clipper.NodeType.ntOpen:return;case a.Clipper.NodeType.ntClosed:n=!e.IsOpen;break;default:break}e.m_polygon.length>0&&n&&r.push(e.m_polygon);for(var i=0,o=e.Childs(),s=o.length,l=o[i];i<s;i++,l=o[i])a.Clipper.AddPolyNodeToPaths(l,t,r)};a.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new a.Paths,r=0,n=e.ChildCount();r<n;r++)e.Childs()[r].IsOpen&&t.push(e.Childs()[r].m_polygon);return t};a.Clipper.ClosedPathsFromPolyTree=function(e){var t=new a.Paths;return a.Clipper.AddPolyNodeToPaths(e,a.Clipper.NodeType.ntClosed,t),t};nn(a.Clipper,a.ClipperBase);a.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};a.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=a.ClipperOffset.def_arc_tolerance),this.m_destPolys=new a.Paths,this.m_srcPoly=new a.Path,this.m_destPoly=new a.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new a.IntPoint,this.m_polyNodes=new a.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};a.ClipperOffset.two_pi=6.28318530717959;a.ClipperOffset.def_arc_tolerance=.25;a.ClipperOffset.prototype.Clear=function(){a.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};a.ClipperOffset.Round=a.Clipper.Round;a.ClipperOffset.prototype.AddPath=function(e,t,r){var n=e.length-1;if(!(n<0)){var i=new a.PolyNode;if(i.m_jointype=t,i.m_endtype=r,r==a.EndType.etClosedLine||r==a.EndType.etClosedPolygon)for(;n>0&&a.IntPoint.op_Equality(e[0],e[n]);)n--;i.m_polygon.push(e[0]);for(var o=0,s=0,l=1;l<=n;l++)a.IntPoint.op_Inequality(i.m_polygon[o],e[l])&&(o++,i.m_polygon.push(e[l]),(e[l].Y>i.m_polygon[s].Y||e[l].Y==i.m_polygon[s].Y&&e[l].X<i.m_polygon[s].X)&&(s=o));if(!(r==a.EndType.etClosedPolygon&&o<2||r!=a.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(i),r==a.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new a.IntPoint(0,s);else{var u=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(i.m_polygon[s].Y>u.Y||i.m_polygon[s].Y==u.Y&&i.m_polygon[s].X<u.X)&&(this.m_lowest=new a.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};a.ClipperOffset.prototype.AddPaths=function(e,t,r){for(var n=0,i=e.length;n<i;n++)this.AddPath(e[n],t,r)};a.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!a.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==a.EndType.etClosedPolygon||t.m_endtype==a.EndType.etClosedLine&&a.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==a.EndType.etClosedLine&&!a.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};a.ClipperOffset.GetUnitNormal=function(e,t){var r=t.X-e.X,n=t.Y-e.Y;if(r==0&&n==0)return new a.DoublePoint(0,0);var i=1/Math.sqrt(r*r+n*n);return r*=i,n*=i,new a.DoublePoint(n,-r)};a.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,a.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];r.m_endtype==a.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=a.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*a.ClipperOffset.def_arc_tolerance?n=Math.abs(e)*a.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var i=3.14159265358979/Math.acos(1-n/Math.abs(e));this.m_sin=Math.sin(a.ClipperOffset.two_pi/i),this.m_cos=Math.cos(a.ClipperOffset.two_pi/i),this.m_StepsPerRad=i/a.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||e<=0&&(o<3||r.m_endtype!=a.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(r.m_jointype==a.JoinType.jtRound)for(var s=1,l=0,u=1;u<=i;u++){this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),a.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e)));var f=s;s=s*this.m_cos-this.m_sin*l,l=f*this.m_sin+l*this.m_cos}else for(var s=-1,l=-1,u=0;u<4;++u)this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),a.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e))),s<0?s=1:l<0?l=1:s=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var u=0;u<o-1;u++)this.m_normals.push(a.ClipperOffset.GetUnitNormal(this.m_srcPoly[u],this.m_srcPoly[u+1]));if(r.m_endtype==a.EndType.etClosedLine||r.m_endtype==a.EndType.etClosedPolygon?this.m_normals.push(a.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new a.DoublePoint(this.m_normals[o-2])),r.m_endtype==a.EndType.etClosedPolygon){for(var p=o-1,u=0;u<o;u++)p=this.OffsetPoint(u,p,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==a.EndType.etClosedLine){for(var p=o-1,u=0;u<o;u++)p=this.OffsetPoint(u,p,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var d=this.m_normals[o-1],u=o-1;u>0;u--)this.m_normals[u]=new a.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new a.DoublePoint(-d.X,-d.Y),p=0;for(var u=o-1;u>=0;u--)p=this.OffsetPoint(u,p,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var p=0,u=1;u<o-1;++u)p=this.OffsetPoint(u,p,r.m_jointype);var m;if(r.m_endtype==a.EndType.etOpenButt){var u=o-1;m=new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[u].X+this.m_normals[u].X*e),a.ClipperOffset.Round(this.m_srcPoly[u].Y+this.m_normals[u].Y*e)),this.m_destPoly.push(m),m=new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[u].X-this.m_normals[u].X*e),a.ClipperOffset.Round(this.m_srcPoly[u].Y-this.m_normals[u].Y*e)),this.m_destPoly.push(m)}else{var u=o-1;p=o-2,this.m_sinA=0,this.m_normals[u]=new a.DoublePoint(-this.m_normals[u].X,-this.m_normals[u].Y),r.m_endtype==a.EndType.etOpenSquare?this.DoSquare(u,p):this.DoRound(u,p)}for(var u=o-1;u>0;u--)this.m_normals[u]=new a.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new a.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),p=o-1;for(var u=p-1;u>0;--u)p=this.OffsetPoint(u,p,r.m_jointype);r.m_endtype==a.EndType.etOpenButt?(m=new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),a.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(m),m=new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),a.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(m)):(p=1,this.m_sinA=0,r.m_endtype==a.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};a.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof a.PolyTree;if(t){var r=e[0],n=e[1];r.Clear(),this.FixOrientations(),this.DoOffset(n);var i=new a.Clipper(0);if(i.AddPaths(this.m_destPolys,a.PolyType.ptSubject,!0),n>0)i.Execute(a.ClipType.ctUnion,r,a.PolyFillType.pftPositive,a.PolyFillType.pftPositive);else{var o=a.Clipper.GetBounds(this.m_destPolys),s=new a.Path;if(s.push(new a.IntPoint(o.left-10,o.bottom+10)),s.push(new a.IntPoint(o.right+10,o.bottom+10)),s.push(new a.IntPoint(o.right+10,o.top-10)),s.push(new a.IntPoint(o.left-10,o.top-10)),i.AddPath(s,a.PolyType.ptSubject,!0),i.ReverseSolution=!0,i.Execute(a.ClipType.ctUnion,r,a.PolyFillType.pftNegative,a.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var u=1;u<l.ChildCount();u++)r.AddChild(l.Childs()[u])}else r.Clear()}}else{var r=e[0],n=e[1];a.Clear(r),this.FixOrientations(),this.DoOffset(n);var i=new a.Clipper(0);if(i.AddPaths(this.m_destPolys,a.PolyType.ptSubject,!0),n>0)i.Execute(a.ClipType.ctUnion,r,a.PolyFillType.pftPositive,a.PolyFillType.pftPositive);else{var o=a.Clipper.GetBounds(this.m_destPolys),s=new a.Path;s.push(new a.IntPoint(o.left-10,o.bottom+10)),s.push(new a.IntPoint(o.right+10,o.bottom+10)),s.push(new a.IntPoint(o.right+10,o.top-10)),s.push(new a.IntPoint(o.left-10,o.top-10)),i.AddPath(s,a.PolyType.ptSubject,!0),i.ReverseSolution=!0,i.Execute(a.ClipType.ctUnion,r,a.PolyFillType.pftNegative,a.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};a.ClipperOffset.prototype.OffsetPoint=function(e,t,r){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),a.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new a.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),a.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(r){case a.JoinType.jtMiter:{var n=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);n>=this.m_miterLim?this.DoMiter(e,t,n):this.DoSquare(e,t);break}case a.JoinType.jtSquare:this.DoSquare(e,t);break;case a.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};a.ClipperOffset.prototype.DoSquare=function(e,t){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*r)),a.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*r)))),this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*r)),a.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*r))))};a.ClipperOffset.prototype.DoMiter=function(e,t,r){var n=this.m_delta/r;this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*n),a.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*n)))};a.ClipperOffset.prototype.DoRound=function(e,t){for(var r=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),n=a.Cast_Int32(a.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),i=this.m_normals[t].X,o=this.m_normals[t].Y,s,l=0;l<n;++l)this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+i*this.m_delta),a.ClipperOffset.Round(this.m_srcPoly[e].Y+o*this.m_delta))),s=i,i=i*this.m_cos-this.m_sin*o,o=s*this.m_sin+o*this.m_cos;this.m_destPoly.push(new a.IntPoint(a.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),a.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};a.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};a.JS={};a.JS.AreaOfPolygon=function(e,t){return t||(t=1),a.Clipper.Area(e)/(t*t)};a.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var r=0,n=0;n<e.length;n++)r+=a.Clipper.Area(e[n]);return r/(t*t)};a.JS.BoundsOfPath=function(e,t){return a.JS.BoundsOfPaths([e],t)};a.JS.BoundsOfPaths=function(e,t){t||(t=1);var r=a.Clipper.GetBounds(e);return r.left/=t,r.bottom/=t,r.right/=t,r.top/=t,r};a.JS.Clean=function(n,t){if(!(n instanceof Array))return[];var r=n[0]instanceof Array,n=a.JS.Clone(n);if(typeof t!="number"||t===null)return a.Error("Delta is not a number in Clean()."),n;if(n.length===0||n.length==1&&n[0].length===0||t<0)return n;r||(n=[n]);for(var i=n.length,o,s,l,u,f,p,d,m=[],x=0;x<i;x++)if(s=n[x],o=s.length,o!==0){if(o<3){l=s,m.push(l);continue}for(l=s,u=t*t,f=s[0],p=1,d=1;d<o;d++)(s[d].X-f.X)*(s[d].X-f.X)+(s[d].Y-f.Y)*(s[d].Y-f.Y)<=u||(l[p]=s[d],f=s[d],p++);f=s[p-1],(s[0].X-f.X)*(s[0].X-f.X)+(s[0].Y-f.Y)*(s[0].Y-f.Y)<=u&&p--,p<o&&l.splice(p,o-p),l.length&&m.push(l)}return!r&&m.length?m=m[0]:!r&&m.length===0?m=[]:r&&m.length===0&&(m=[[]]),m};a.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var r=e.length,n,i,o,s,l=new Array(r);for(i=0;i<r;i++){for(n=e[i].length,s=new Array(n),o=0;o<n;o++)s[o]={X:e[i][o].X,Y:e[i][o].Y};l[i]=s}return t||(l=l[0]),l};a.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return a.Error("Tolerance is not a number in Lighten()."),a.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return a.JS.Clone(e);e[0]instanceof Array||(e=[e]);var r,n,i,o,s,l,u,f,p,d,m,x,b,C,w,M,N,O=e.length,W=t*t,H=[];for(r=0;r<O;r++)if(i=e[r],l=i.length,l!=0){for(o=0;o<1e6;o++){for(s=[],l=i.length,i[l-1].X!=i[0].X||i[l-1].Y!=i[0].Y?(x=1,i.push({X:i[0].X,Y:i[0].Y}),l=i.length):x=0,m=[],n=0;n<l-2;n++)u=i[n],p=i[n+1],f=i[n+2],M=u.X,N=u.Y,b=f.X-M,C=f.Y-N,(b!==0||C!==0)&&(w=((p.X-M)*b+(p.Y-N)*C)/(b*b+C*C),w>1?(M=f.X,N=f.Y):w>0&&(M+=b*w,N+=C*w)),b=p.X-M,C=p.Y-N,d=b*b+C*C,d<=W&&(m[n+1]=1,n++);for(s.push({X:i[0].X,Y:i[0].Y}),n=1;n<l-1;n++)m[n]||s.push({X:i[n].X,Y:i[n].Y});if(s.push({X:i[l-1].X,Y:i[l-1].Y}),x&&i.pop(),m.length)i=s;else break}l=s.length,s[l-1].X==s[0].X&&s[l-1].Y==s[0].Y&&s.pop(),s.length>2&&H.push(s)}return!e[0]instanceof Array&&(H=H[0]),typeof H>"u"&&(H=[[]]),H};a.JS.PerimeterOfPath=function(e,t,r){if(typeof e>"u")return 0;var n=Math.sqrt,i=0,o,s,l=0,u=0,f=0,p=0,d=e.length;if(d<2)return 0;for(t&&(e[d]=e[0],d++);--d;)o=e[d],l=o.X,u=o.Y,s=e[d-1],f=s.X,p=s.Y,i+=n((l-f)*(l-f)+(u-p)*(u-p));return t&&e.pop(),i/r};a.JS.PerimeterOfPaths=function(e,t,r){r||(r=1);for(var n=0,i=0;i<e.length;i++)n+=a.JS.PerimeterOfPath(e[i],t,r);return n};a.JS.ScaleDownPath=function(e,t){var r,n;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=n.X/t,n.Y=n.Y/t};a.JS.ScaleDownPaths=function(e,t){var r,n,i,o=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)i=e[r][n],i.X=i.X/t,i.Y=i.Y/t};a.JS.ScaleUpPath=function(e,t){var r,n,i=Math.round;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=i(n.X*t),n.Y=i(n.Y*t)};a.JS.ScaleUpPaths=function(e,t){var r,n,i,o=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)i=e[r][n],i.X=o(i.X*t),i.Y=o(i.Y*t)};a.ExPolygons=function(){return[]};a.ExPolygon=function(){this.outer=null,this.holes=null};a.JS.AddOuterPolyNodeToExPolygons=function(e,t){var r=new a.ExPolygon;r.outer=e.Contour();var n=e.Childs(),i=n.length;r.holes=new Array(i);var o,s,l,u,f,p;for(l=0;l<i;l++)for(o=n[l],r.holes[l]=o.Contour(),u=0,f=o.Childs(),p=f.length;u<p;u++)s=f[u],a.JS.AddOuterPolyNodeToExPolygons(s,t);t.push(r)};a.JS.ExPolygonsToPaths=function(e){var t,r,n,i,o=new a.Paths;for(t=0,n=e.length;t<n;t++)for(o.push(e[t].outer),r=0,i=e[t].holes.length;r<i;r++)o.push(e[t].holes[r]);return o};a.JS.PolyTreeToExPolygons=function(e){var t=new a.ExPolygons,r,n,i,o;for(n=0,i=e.Childs(),o=i.length;n<o;n++)r=i[n],a.JS.AddOuterPolyNodeToExPolygons(r,t);return t};br.exports=a});h();var Or="[MappedinJS]",sa=(i=>(i[i.LOG=0]="LOG",i[i.WARN=1]="WARN",i[i.ERROR=2]="ERROR",i[i.SILENT=3]="SILENT",i))(sa||{});function aa(e="",{prefix:t=Or}={}){let r=`${t}${e?`-${e}`:""}`,n=(i,o)=>{if(typeof window<"u"&&window.rnDebug){let s=o.map(l=>l instanceof Error&&l.stack?`${l.message}
2
+ ${l.stack}`:l);window.rnDebug(`${e} ${i}: ${s.join(" ")}`)}};return{logState:_.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&(console.log(r,...i),n("log",i))},warn(...i){this.logState<=1&&(console.warn(r,...i),n("warn",i))},error(...i){this.logState<=2&&(console.error(r,...i),n("error",i))},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}var ki=aa();function zh(e){0<=e&&e<=3&&(ki.logState=e)}var U=ki;h();h();var Qe=class extends Error{};Qe.prototype.name="InvalidTokenError";function la(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function ua(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return la(t)}catch{return atob(t)}}function Bi(e,t){if(typeof e!="string")throw new Qe("Invalid token specified: must be a string");t||(t={});let r=t.header===!0?0:1,n=e.split(".")[r];if(typeof n!="string")throw new Qe(`Invalid token specified: missing part #${r+1}`);let i;try{i=ua(n)}catch(o){throw new Qe(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new Qe(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}h();var et=63710088e-1;h();function fa(e,t,r,n){return(e<t||e>r)&&U.warn(n),Math.min(r,Math.max(t,e))}h();function ca(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function ld(e){let t=Bi(e);if(t.sub==null)throw new Error("Access token is missing sub claim.");return{sub:t.sub,aud:typeof t.aud=="string"?[t.aud]:t.aud??[],capabilities:t.capabilities??{}}}function Xe(e){return e*(Math.PI/180)}function pa(e){return e*(180/Math.PI)}function ud(e,t){let r=Math.pow(10,t);return Math.sign(e)*Math.round(Math.abs(e)*r)/r}function Ri(e,t){return(e%t+t)%t}function fd([e,t],[r,n]){let i=Xe(n-t),o=Xe(r-e),s=Xe(t),l=Xe(n),u=Math.sin(i/2)*Math.sin(i/2)+Math.sin(o/2)*Math.sin(o/2)*Math.cos(s)*Math.cos(l),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return et*f}function cd([e,t],[r,n]){let i=Xe(t),o=Xe(e),s=Xe(n),u=Xe(r)-o,f=Math.sin(u)*Math.cos(s),p=Math.cos(i)*Math.sin(s)-Math.sin(i)*Math.cos(s)*Math.cos(u);return pa((Math.atan2(f,p)+Math.PI*2)%(Math.PI*2))}function pd(e,t){let r=Ri(e,Math.PI*2),n=Ri(t,Math.PI*2),i=n-r,o=n+(i>Math.PI?-Math.PI*2:i<-Math.PI?Math.PI*2:0);return{start:r,end:o}}function ha(e){return e instanceof wr?Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y):Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y)&&Number.isFinite(e.min.z)&&Number.isFinite(e.max.z)}function hd(){return typeof window<"u"&&window!==null}h();function vd(e,t,r=!1){let n=null,i=0;return function(...o){i++,i===1&&r===!0&&e(...o);let s=()=>{(!r||i>1)&&e(...o),n=null,i=0};clearTimeout(n),n=setTimeout(s,t)}}h();h();function da(e,t){return`${t} ${e}`}var er=class extends Error{constructor(t,r=Or){super(da(t,r)),this.name="MappedinError"}},Xi=class extends er{constructor(t,r=Or){super(t,r),this.name="MappedinRenderError"}};h();var bn=class e extends Error{constructor(r){super(r);c(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function Yi(e,t){if(e==null){let r;t?.customMessage?r=t.customMessage:r=`Expected ${t?.valueName?`'${t.valueName}'`:"value"} to be defined, but received ${e}`;let n=t?.errorClass||bn,i=new n(r);throw t?.captureStackTrace!==!1&&Error.captureStackTrace&&Error.captureStackTrace(i,Yi),i}}function Cd(e,t,r){if(Yi(e),e?.type!==t){let n=`Expected type ${t} but got ${e?.type}`;throw new Error(r??n)}}h();var _n=[0,4,6,8,10],K=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let n=0;n<e.length;n++)n>0&&(n&3)===0&&(t=Math.random()*4294967296),e[n]=t>>>((n&3)<<3)&255;let r=e.map(n=>n.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],_n.map((n,i)=>r.slice(n,i===_n.length-1?void 0:_n[i+1]).join("")).join("-")};function Ed(e,t=0){let r=3735928559^t,n=1103547991^t;for(let i=0,o;i<e.length;i++)o=e.charCodeAt(i),r=Math.imul(r^o,2654435761),n=Math.imul(n^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)}h();var tr=class{constructor(){c(this,"_subscribers",{});c(this,"_destroyed",!1)}publish(t,r){!this._subscribers||!this._subscribers[t]||this._destroyed||this._subscribers[t].forEach(function(n){typeof n=="function"&&n(r)})}on(t,r){(!this._subscribers||this._destroyed)&&(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(r)}off(t,r){if(!this._subscribers||this._subscribers[t]==null||this._destroyed)return;let n=this._subscribers[t].indexOf(r);n!==-1&&this._subscribers[t].splice(n,1)}destroy(){this._destroyed=!0,this._subscribers={}}};h();var Fi="mi-session-data",Gi="mi-local-data",rr="id",nr="deviceId",tt,ge,ve,Mr=class Mr{constructor(){se(this,ge);se(this,ve);try{let t=sessionStorage.getItem(Fi);t?q(this,ge,JSON.parse(t)):q(this,ge,{[rr]:K()})}catch{q(this,ge,{[rr]:K()})}try{let t=localStorage.getItem(Gi);t?q(this,ve,JSON.parse(t)):q(this,ve,{[nr]:K()})}catch{q(this,ve,{[nr]:K()})}Y(this,ge)[rr]||(Y(this,ge)[rr]=K()),Y(this,ve)[nr]||(Y(this,ve)[nr]=K())}static getInstance(){return Y(this,tt)||q(this,tt,new Mr),Y(this,tt)}static ___clearInstance(){q(this,tt,void 0)}saveSessionData(t,r){Y(this,ge)[t]=r;try{return sessionStorage.setItem(Fi,JSON.stringify(Y(this,ge))),!0}catch{return!1}}loadSessionData(t){let r=Y(this,ge)[t];if(r!=null)return r}saveLocalData(t,r){Y(this,ve)[t]=r;try{return localStorage.setItem(Gi,JSON.stringify(Y(this,ve))),!0}catch{return!1}}loadLocalData(t){let r=Y(this,ve)[t];if(r!=null)return r}};tt=new WeakMap,ge=new WeakMap,ve=new WeakMap,se(Mr,tt);var Pn=Mr;h();var ma=new Set(Object.keys(ce.NAMES)),Tn;function Wi(){return Tn==null&&(Tn=new ce),Tn}var ya=e=>ma.has(e.toLowerCase()),ga=e=>{if(!e.startsWith("#"))return!1;let t=e.slice(1);if(t.length!==3&&t.length!==6)return!1;for(let r=0;r<t.length;r++)if(!(t[r]>="0"&&t[r]<="9"||t[r]>="A"&&t[r]<="F"||t[r]>="a"&&t[r]<="f"))return!1;return!0},va=e=>{if(!e.startsWith("rgb(")&&!e.startsWith("rgba("))return!1;let t=e.indexOf("("),r=e.lastIndexOf(")");if(t===-1||r===-1||r<=t||r!==e.length-1)return!1;let n=e.slice(t+1,r).split(",");if(n.length!==3&&n.length!==4)return!1;for(let i=0;i<n.length;i++){let o=n[i].trim();if(i<3)if(o.endsWith("%")){let s=parseFloat(o.slice(0,-1));if(isNaN(s)||s<0||s>100)return!1}else{let s=parseInt(o,10);if(isNaN(s)||s<0||s>255)return!1}else{let s=parseFloat(o);if(isNaN(s)||s<0||s>1)return!1}}return!0},xa=e=>{if(!e.startsWith("hsl(")&&!e.startsWith("hsla("))return!1;let t=e.indexOf("("),r=e.lastIndexOf(")");if(t===-1||r===-1||r<=t||r!==e.length-1)return!1;let n=e.slice(t+1,r).split(",");if(n.length!==3&&n.length!==4)return!1;for(let i=0;i<n.length;i++){let o=n[i].trim();if(i===0){let s=parseFloat(o);if(isNaN(s))return!1}else if(i<3){if(!o.endsWith("%"))return!1;let s=parseFloat(o.slice(0,-1));if(isNaN(s)||s<0||s>100)return!1}else{let s=parseFloat(o);if(isNaN(s)||s<0||s>1)return!1}}return!0},Lr=e=>e==null||typeof e!="string"?!1:!!(ga(e)||va(e)||xa(e)||ya(e)),Yd=e=>{let t=Wi();return t.set(e),[t.r,t.g,t.b]},Fd=e=>{let t=Wi();return t.set(e[0],e[1],e[2]),"#"+t.getHexString()};h();var Vi=["ease-in","ease-out","ease-in-out","linear"];var Hi=e=>e,ba=e=>e*e,_a=e=>1-Math.cos(e*Math.PI/2),Pa=e=>1-(1-e)*(1-e),ji={linear:Hi,"ease-in":ba,"ease-out":Pa,"ease-in-out":_a};function Hd(e,t,r,n,i,o=Hi){if(t===r)return i;e=Math.max(t,Math.min(e,r));let s=(e-Math.min(t,r))/Math.abs(r-t),l=typeof o=="function"?o(s):ji[o](s);return n+l*(i-n)}function Ta(e,t){let r=0;if(t.length<2)return r;let i=t[0]<t[1]?(o,s)=>o>s:(o,s)=>o<s;for(;r<t.length-1&&i(e,t[r+1]);)r++;return r>t.length-2?Math.max(0,t.length-2):r}function jd(e,t,r,n="ease-in"){if(t.length!==r.length)throw new er("Input and output ranges must have the same number of values.");e=Math.max(t[0],Math.min(e,t[t.length-1]));let i=Ta(e,t),o=(e-t[i])/(t[i+1]-t[i]),s=typeof n=="function"?n(o):ji[n](o);return r[i]+s*(r[i+1]-r[i])}var y={};oa(y,{BRAND:()=>qa,DIRTY:()=>rt,EMPTY_PATH:()=>wa,INVALID:()=>E,NEVER:()=>Dl,OK:()=>$,ParseStatus:()=>J,Schema:()=>D,ZodAny:()=>Ge,ZodArray:()=>Me,ZodBigInt:()=>it,ZodBoolean:()=>ot,ZodBranded:()=>sr,ZodCatch:()=>yt,ZodDate:()=>st,ZodDefault:()=>mt,ZodDiscriminatedUnion:()=>Nr,ZodEffects:()=>de,ZodEnum:()=>ht,ZodError:()=>re,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>Br,ZodIntersection:()=>ft,ZodIssueCode:()=>v,ZodLazy:()=>ct,ZodLiteral:()=>pt,ZodMap:()=>Dt,ZodNaN:()=>kt,ZodNativeEnum:()=>dt,ZodNever:()=>xe,ZodNull:()=>lt,ZodNullable:()=>Ce,ZodNumber:()=>nt,ZodObject:()=>ne,ZodOptional:()=>pe,ZodParsedType:()=>T,ZodPipeline:()=>ar,ZodPromise:()=>We,ZodReadonly:()=>gt,ZodRecord:()=>kr,ZodSchema:()=>D,ZodSet:()=>Nt,ZodString:()=>Fe,ZodSymbol:()=>Lt,ZodTransformer:()=>de,ZodTuple:()=>Te,ZodType:()=>D,ZodUndefined:()=>at,ZodUnion:()=>ut,ZodUnknown:()=>Oe,ZodVoid:()=>At,addIssueToContext:()=>P,any:()=>il,array:()=>ll,bigint:()=>Qa,boolean:()=>ro,coerce:()=>Al,custom:()=>Qi,date:()=>el,datetimeRegex:()=>$i,defaultErrorMap:()=>we,discriminatedUnion:()=>pl,effect:()=>Cl,enum:()=>_l,function:()=>vl,getErrorMap:()=>Et,getParsedType:()=>Pe,instanceof:()=>$a,intersection:()=>hl,isAborted:()=>Ar,isAsync:()=>Ot,isDirty:()=>Dr,isValid:()=>Ye,late:()=>Ja,lazy:()=>xl,literal:()=>bl,makeIssue:()=>or,map:()=>yl,nan:()=>Ka,nativeEnum:()=>Pl,never:()=>sl,null:()=>nl,nullable:()=>Sl,number:()=>to,object:()=>ul,objectUtil:()=>Cn,oboolean:()=>Ll,onumber:()=>Ml,optional:()=>Il,ostring:()=>Ol,pipeline:()=>El,preprocess:()=>wl,promise:()=>Tl,quotelessJson:()=>Ca,record:()=>ml,set:()=>gl,setErrorMap:()=>Sa,strictObject:()=>fl,string:()=>eo,symbol:()=>tl,transformer:()=>Cl,tuple:()=>dl,undefined:()=>rl,union:()=>cl,unknown:()=>ol,util:()=>B,void:()=>al});h();h();h();h();h();var B;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),s={};for(let l of o)s[l]=i[l];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(B||(B={}));var Cn;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cn||(Cn={}));var T=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pe=e=>{switch(typeof e){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(e)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(e)?T.array:e===null?T.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?T.promise:typeof Map<"u"&&e instanceof Map?T.map:typeof Set<"u"&&e instanceof Set?T.set:typeof Date<"u"&&e instanceof Date?T.date:T.object;default:return T.unknown}};var v=B.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ca=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),re=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let l=n,u=0;for(;u<s.path.length;){let f=s.path[u];u===s.path.length-1?(l[f]=l[f]||{_errors:[]},l[f]._errors.push(r(s))):l[f]=l[f]||{_errors:[]},l=l[f],u++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};re.create=e=>new re(e);var Ia=(e,t)=>{let r;switch(e.code){case v.invalid_type:e.received===T.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,B.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${B.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${B.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${B.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:B.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case v.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case v.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,B.assertNever(e)}return{message:r}},we=Ia;var Ui=we;function Sa(e){Ui=e}function Et(){return Ui}h();var or=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let l="",u=n.filter(f=>!!f).slice().reverse();for(let f of u)l=f(s,{data:t,defaultError:l}).message;return{...i,path:o,message:l}},wa=[];function P(e,t){let r=Et(),n=or({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===we?void 0:we].filter(i=>!!i)});e.common.issues.push(n)}var J=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return E;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return E;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},E=Object.freeze({status:"aborted"}),rt=e=>({status:"dirty",value:e}),$=e=>({status:"valid",value:e}),Ar=e=>e.status==="aborted",Dr=e=>e.status==="dirty",Ye=e=>e.status==="valid",Ot=e=>typeof Promise<"u"&&e instanceof Promise;h();h();h();var I;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(I||(I={}));var he=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zi=(e,t)=>{if(Ye(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new re(e.common.issues);return this._error=r,this._error}}};function A(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,l)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??l.defaultError}:typeof l.data>"u"?{message:u??n??l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:u??r??l.defaultError}},description:i}}var D=class{get description(){return this._def.description}_getType(t){return Pe(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Pe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new J,ctx:{common:t.parent.common,data:t.data,parsedType:Pe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Ot(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pe(t)},i=this._parseSync({data:t,path:n.path,parent:n});return zi(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pe(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ye(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ye(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pe(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(Ot(i)?i:Promise.resolve(i));return zi(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),l=()=>o.addIssue({code:v.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new de({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return pe.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Me.create(this)}promise(){return We.create(this,this._def)}or(t){return ut.create([this,t],this._def)}and(t){return ft.create(this,t,this._def)}transform(t){return new de({...A(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mt({...A(this._def),innerType:this,defaultValue:r,typeName:L.ZodDefault})}brand(){return new sr({typeName:L.ZodBranded,type:this,...A(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new yt({...A(this._def),innerType:this,catchValue:r,typeName:L.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ar.create(this,t)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ea=/^c[^\s-]{8,}$/i,Oa=/^[0-9a-z]+$/,Ma=/^[0-9A-HJKMNP-TV-Z]{26}$/i,La=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Aa=/^[a-z0-9_-]{21}$/i,Da=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Na=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ka=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ba="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",In,Ra=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ya=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Fa=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ga=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qi="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Va=new RegExp(`^${qi}$`);function Ji(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Ha(e){return new RegExp(`^${Ji(e)}$`)}function $i(e){let t=`${qi}T${Ji(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ja(e,t){return!!((t==="v4"||!t)&&Ra.test(e)||(t==="v6"||!t)&&Ya.test(e))}function Ua(e,t){if(!Da.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function za(e,t){return!!((t==="v4"||!t)&&Xa.test(e)||(t==="v6"||!t)&&Fa.test(e))}var Fe=class e extends D{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==T.string){let o=this._getOrReturnCtx(t);return P(o,{code:v.invalid_type,expected:T.string,received:o.parsedType}),E}let n=new J,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:v.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:v.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,l=t.data.length<o.value;(s||l)&&(i=this._getOrReturnCtx(t,i),s?P(i,{code:v.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):l&&P(i,{code:v.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")ka.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"email",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")In||(In=new RegExp(Ba,"u")),In.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"emoji",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")La.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"uuid",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Aa.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"nanoid",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Ea.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cuid",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Oa.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cuid2",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Ma.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"ulid",code:v.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),P(i,{validation:"url",code:v.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"regex",code:v.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?$i(o).test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Va.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Ha(o).test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:v.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Na.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"duration",code:v.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?ja(t.data,o.version)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"ip",code:v.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Ua(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"jwt",code:v.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?za(t.data,o.version)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cidr",code:v.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Ga.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"base64",code:v.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Wa.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"base64url",code:v.invalid_string,message:o.message}),n.dirty()):B.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:v.invalid_string,...I.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...I.errToObj(t)})}url(t){return this._addCheck({kind:"url",...I.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...I.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...I.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...I.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...I.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...I.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...I.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...I.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...I.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...I.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...I.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...I.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...I.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...I.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...I.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...I.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...I.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...I.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...I.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...I.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...I.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...I.errToObj(r)})}nonempty(t){return this.min(1,I.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Fe.create=e=>new Fe({checks:[],typeName:L.ZodString,coerce:e?.coerce??!1,...A(e)});function Za(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var nt=class e extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==T.number){let o=this._getOrReturnCtx(t);return P(o,{code:v.invalid_type,expected:T.number,received:o.parsedType}),E}let n,i=new J;for(let o of this._def.checks)o.kind==="int"?B.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),P(n,{code:v.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Za(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),P(n,{code:v.not_finite,message:o.message}),i.dirty()):B.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:I.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:I.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:I.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&B.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};nt.create=e=>new nt({checks:[],typeName:L.ZodNumber,coerce:e?.coerce||!1,...A(e)});var it=class e extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==T.bigint)return this._getInvalidInput(t);let n,i=new J;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),P(n,{code:v.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):B.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return P(r,{code:v.invalid_type,expected:T.bigint,received:r.parsedType}),E}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:I.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};it.create=e=>new it({checks:[],typeName:L.ZodBigInt,coerce:e?.coerce??!1,...A(e)});var ot=class extends D{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==T.boolean){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.boolean,received:n.parsedType}),E}return $(t.data)}};ot.create=e=>new ot({typeName:L.ZodBoolean,coerce:e?.coerce||!1,...A(e)});var st=class e extends D{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==T.date){let o=this._getOrReturnCtx(t);return P(o,{code:v.invalid_type,expected:T.date,received:o.parsedType}),E}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return P(o,{code:v.invalid_date}),E}let n=new J,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:v.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:v.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):B.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:I.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:I.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};st.create=e=>new st({checks:[],coerce:e?.coerce||!1,typeName:L.ZodDate,...A(e)});var Lt=class extends D{_parse(t){if(this._getType(t)!==T.symbol){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.symbol,received:n.parsedType}),E}return $(t.data)}};Lt.create=e=>new Lt({typeName:L.ZodSymbol,...A(e)});var at=class extends D{_parse(t){if(this._getType(t)!==T.undefined){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.undefined,received:n.parsedType}),E}return $(t.data)}};at.create=e=>new at({typeName:L.ZodUndefined,...A(e)});var lt=class extends D{_parse(t){if(this._getType(t)!==T.null){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.null,received:n.parsedType}),E}return $(t.data)}};lt.create=e=>new lt({typeName:L.ZodNull,...A(e)});var Ge=class extends D{constructor(){super(...arguments),this._any=!0}_parse(t){return $(t.data)}};Ge.create=e=>new Ge({typeName:L.ZodAny,...A(e)});var Oe=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $(t.data)}};Oe.create=e=>new Oe({typeName:L.ZodUnknown,...A(e)});var xe=class extends D{_parse(t){let r=this._getOrReturnCtx(t);return P(r,{code:v.invalid_type,expected:T.never,received:r.parsedType}),E}};xe.create=e=>new xe({typeName:L.ZodNever,...A(e)});var At=class extends D{_parse(t){if(this._getType(t)!==T.undefined){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.void,received:n.parsedType}),E}return $(t.data)}};At.create=e=>new At({typeName:L.ZodVoid,...A(e)});var Me=class e extends D{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==T.array)return P(r,{code:v.invalid_type,expected:T.array,received:r.parsedType}),E;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,l=r.data.length<i.exactLength.value;(s||l)&&(P(r,{code:s?v.too_big:v.too_small,minimum:l?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(P(r,{code:v.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(P(r,{code:v.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>i.type._parseAsync(new he(r,s,r.path,l)))).then(s=>J.mergeArray(n,s));let o=[...r.data].map((s,l)=>i.type._parseSync(new he(r,s,r.path,l)));return J.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:I.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:I.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:I.toString(r)}})}nonempty(t){return this.min(1,t)}};Me.create=(e,t)=>new Me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...A(t)});function Mt(e){if(e instanceof ne){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=pe.create(Mt(n))}return new ne({...e._def,shape:()=>t})}else return e instanceof Me?new Me({...e._def,type:Mt(e.element)}):e instanceof pe?pe.create(Mt(e.unwrap())):e instanceof Ce?Ce.create(Mt(e.unwrap())):e instanceof Te?Te.create(e.items.map(t=>Mt(t))):e}var ne=class e extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=B.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==T.object){let f=this._getOrReturnCtx(t);return P(f,{code:v.invalid_type,expected:T.object,received:f.parsedType}),E}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof xe&&this._def.unknownKeys==="strip"))for(let f in i.data)s.includes(f)||l.push(f);let u=[];for(let f of s){let p=o[f],d=i.data[f];u.push({key:{status:"valid",value:f},value:p._parse(new he(i,d,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof xe){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of l)u.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(f==="strict")l.length>0&&(P(i,{code:v.unrecognized_keys,keys:l}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let p of l){let d=i.data[p];u.push({key:{status:"valid",value:p},value:f._parse(new he(i,d,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of u){let d=await p.key,m=await p.value;f.push({key:d,value:m,alwaysSet:p.alwaysSet})}return f}).then(f=>J.mergeObjectSync(n,f)):J.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return I.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:I.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:L.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of B.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of B.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Mt(this)}partial(t){let r={};for(let n of B.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of B.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof pe;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Ki(B.objectKeys(this.shape))}};ne.create=(e,t)=>new ne({shape:()=>e,unknownKeys:"strip",catchall:xe.create(),typeName:L.ZodObject,...A(t)});ne.strictCreate=(e,t)=>new ne({shape:()=>e,unknownKeys:"strict",catchall:xe.create(),typeName:L.ZodObject,...A(t)});ne.lazycreate=(e,t)=>new ne({shape:e,unknownKeys:"strip",catchall:xe.create(),typeName:L.ZodObject,...A(t)});var ut=class extends D{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let l of o)if(l.result.status==="valid")return l.result;for(let l of o)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let s=o.map(l=>new re(l.ctx.common.issues));return P(r,{code:v.invalid_union,unionErrors:s}),E}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let u of n){let f={...r,common:{...r.common,issues:[]},parent:null},p=u._parseSync({data:r.data,path:r.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:f}),f.common.issues.length&&s.push(f.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let l=s.map(u=>new re(u));return P(r,{code:v.invalid_union,unionErrors:l}),E}}get options(){return this._def.options}};ut.create=(e,t)=>new ut({options:e,typeName:L.ZodUnion,...A(t)});var Ee=e=>e instanceof ct?Ee(e.schema):e instanceof de?Ee(e.innerType()):e instanceof pt?[e.value]:e instanceof ht?e.options:e instanceof dt?B.objectValues(e.enum):e instanceof mt?Ee(e._def.innerType):e instanceof at?[void 0]:e instanceof lt?[null]:e instanceof pe?[void 0,...Ee(e.unwrap())]:e instanceof Ce?[null,...Ee(e.unwrap())]:e instanceof sr||e instanceof gt?Ee(e.unwrap()):e instanceof yt?Ee(e._def.innerType):[],Nr=class e extends D{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.object)return P(r,{code:v.invalid_type,expected:T.object,received:r.parsedType}),E;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(P(r,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Ee(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of s){if(i.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);i.set(l,o)}}return new e({typeName:L.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...A(n)})}};function Sn(e,t){let r=Pe(e),n=Pe(t);if(e===t)return{valid:!0,data:e};if(r===T.object&&n===T.object){let i=B.objectKeys(t),o=B.objectKeys(e).filter(l=>i.indexOf(l)!==-1),s={...e,...t};for(let l of o){let u=Sn(e[l],t[l]);if(!u.valid)return{valid:!1};s[l]=u.data}return{valid:!0,data:s}}else if(r===T.array&&n===T.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],l=t[o],u=Sn(s,l);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===T.date&&n===T.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ft=class extends D{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Ar(o)||Ar(s))return E;let l=Sn(o.value,s.value);return l.valid?((Dr(o)||Dr(s))&&r.dirty(),{status:r.value,value:l.data}):(P(n,{code:v.invalid_intersection_types}),E)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ft.create=(e,t,r)=>new ft({left:e,right:t,typeName:L.ZodIntersection,...A(r)});var Te=class e extends D{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.array)return P(n,{code:v.invalid_type,expected:T.array,received:n.parsedType}),E;if(n.data.length<this._def.items.length)return P(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new he(n,s,n.path,l)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>J.mergeArray(r,s)):J.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:L.ZodTuple,rest:null,...A(t)})};var kr=class e extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.object)return P(n,{code:v.invalid_type,expected:T.object,received:n.parsedType}),E;let i=[],o=this._def.keyType,s=this._def.valueType;for(let l in n.data)i.push({key:o._parse(new he(n,l,n.path,l)),value:s._parse(new he(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?J.mergeObjectAsync(r,i):J.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof D?new e({keyType:t,valueType:r,typeName:L.ZodRecord,...A(n)}):new e({keyType:Fe.create(),valueType:t,typeName:L.ZodRecord,...A(r)})}},Dt=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.map)return P(n,{code:v.invalid_type,expected:T.map,received:n.parsedType}),E;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([l,u],f)=>({key:i._parse(new he(n,l,n.path,[f,"key"])),value:o._parse(new he(n,u,n.path,[f,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of s){let f=await u.key,p=await u.value;if(f.status==="aborted"||p.status==="aborted")return E;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),l.set(f.value,p.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let u of s){let f=u.key,p=u.value;if(f.status==="aborted"||p.status==="aborted")return E;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),l.set(f.value,p.value)}return{status:r.value,value:l}}}};Dt.create=(e,t,r)=>new Dt({valueType:t,keyType:e,typeName:L.ZodMap,...A(r)});var Nt=class e extends D{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.set)return P(n,{code:v.invalid_type,expected:T.set,received:n.parsedType}),E;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(P(n,{code:v.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(P(n,{code:v.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let f=new Set;for(let p of u){if(p.status==="aborted")return E;p.status==="dirty"&&r.dirty(),f.add(p.value)}return{status:r.value,value:f}}let l=[...n.data.values()].map((u,f)=>o._parse(new he(n,u,n.path,f)));return n.common.async?Promise.all(l).then(u=>s(u)):s(l)}min(t,r){return new e({...this._def,minSize:{value:t,message:I.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:I.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Nt.create=(e,t)=>new Nt({valueType:e,minSize:null,maxSize:null,typeName:L.ZodSet,...A(t)});var Br=class e extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.function)return P(r,{code:v.invalid_type,expected:T.function,received:r.parsedType}),E;function n(l,u){return or({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Et(),we].filter(f=>!!f),issueData:{code:v.invalid_arguments,argumentsError:u}})}function i(l,u){return or({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Et(),we].filter(f=>!!f),issueData:{code:v.invalid_return_type,returnTypeError:u}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof We){let l=this;return $(async function(...u){let f=new re([]),p=await l._def.args.parseAsync(u,o).catch(x=>{throw f.addIssue(n(u,x)),f}),d=await Reflect.apply(s,this,p);return await l._def.returns._def.type.parseAsync(d,o).catch(x=>{throw f.addIssue(i(d,x)),f})})}else{let l=this;return $(function(...u){let f=l._def.args.safeParse(u,o);if(!f.success)throw new re([n(u,f.error)]);let p=Reflect.apply(s,this,f.data),d=l._def.returns.safeParse(p,o);if(!d.success)throw new re([i(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Te.create(t).rest(Oe.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Te.create([]).rest(Oe.create()),returns:r||Oe.create(),typeName:L.ZodFunction,...A(n)})}},ct=class extends D{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ct.create=(e,t)=>new ct({getter:e,typeName:L.ZodLazy,...A(t)});var pt=class extends D{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return P(r,{received:r.data,code:v.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:t.data}}get value(){return this._def.value}};pt.create=(e,t)=>new pt({value:e,typeName:L.ZodLiteral,...A(t)});function Ki(e,t){return new ht({values:e,typeName:L.ZodEnum,...A(t)})}var ht=class e extends D{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return P(r,{expected:B.joinValues(n),received:r.parsedType,code:v.invalid_type}),E}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return P(r,{received:r.data,code:v.invalid_enum_value,options:n}),E}return $(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};ht.create=Ki;var dt=class extends D{_parse(t){let r=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==T.string&&n.parsedType!==T.number){let i=B.objectValues(r);return P(n,{expected:B.joinValues(i),received:n.parsedType,code:v.invalid_type}),E}if(this._cache||(this._cache=new Set(B.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=B.objectValues(r);return P(n,{received:n.data,code:v.invalid_enum_value,options:i}),E}return $(t.data)}get enum(){return this._def.values}};dt.create=(e,t)=>new dt({values:e,typeName:L.ZodNativeEnum,...A(t)});var We=class extends D{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.promise&&r.common.async===!1)return P(r,{code:v.invalid_type,expected:T.promise,received:r.parsedType}),E;let n=r.parsedType===T.promise?r.data:Promise.resolve(r.data);return $(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};We.create=(e,t)=>new We({type:e,typeName:L.ZodPromise,...A(t)});var de=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{P(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return E;let u=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return u.status==="aborted"?E:u.status==="dirty"?rt(u.value):r.value==="dirty"?rt(u.value):u});{if(r.value==="aborted")return E;let l=this._def.schema._parseSync({data:s,path:n.path,parent:n});return l.status==="aborted"?E:l.status==="dirty"?rt(l.value):r.value==="dirty"?rt(l.value):l}}if(i.type==="refinement"){let s=l=>{let u=i.refinement(l,o);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?E:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?E:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ye(s))return E;let l=i.transform(s.value,o);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ye(s)?Promise.resolve(i.transform(s.value,o)).then(l=>({status:r.value,value:l})):E);B.assertNever(i)}};de.create=(e,t,r)=>new de({schema:e,typeName:L.ZodEffects,effect:t,...A(r)});de.createWithPreprocess=(e,t,r)=>new de({schema:t,effect:{type:"preprocess",transform:e},typeName:L.ZodEffects,...A(r)});var pe=class extends D{_parse(t){return this._getType(t)===T.undefined?$(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pe.create=(e,t)=>new pe({innerType:e,typeName:L.ZodOptional,...A(t)});var Ce=class extends D{_parse(t){return this._getType(t)===T.null?$(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ce.create=(e,t)=>new Ce({innerType:e,typeName:L.ZodNullable,...A(t)});var mt=class extends D{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:L.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...A(t)});var yt=class extends D{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ot(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yt.create=(e,t)=>new yt({innerType:e,typeName:L.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...A(t)});var kt=class extends D{_parse(t){if(this._getType(t)!==T.nan){let n=this._getOrReturnCtx(t);return P(n,{code:v.invalid_type,expected:T.nan,received:n.parsedType}),E}return{status:"valid",value:t.data}}};kt.create=e=>new kt({typeName:L.ZodNaN,...A(e)});var qa=Symbol("zod_brand"),sr=class extends D{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ar=class e extends D{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?E:o.status==="dirty"?(r.dirty(),rt(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?E:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:L.ZodPipeline})}},gt=class extends D{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Ye(i)&&(i.value=Object.freeze(i.value)),i);return Ot(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};gt.create=(e,t)=>new gt({innerType:e,typeName:L.ZodReadonly,...A(t)});function Zi(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Qi(e,t={},r){return e?Ge.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let l=Zi(t,n),u=l.fatal??r??!0;i.addIssue({code:"custom",...l,fatal:u})}});if(!o){let s=Zi(t,n),l=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:l})}}):Ge.create()}var Ja={object:ne.lazycreate},L;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(L||(L={}));var $a=(e,t={message:`Input not instance of ${e.name}`})=>Qi(r=>r instanceof e,t),eo=Fe.create,to=nt.create,Ka=kt.create,Qa=it.create,ro=ot.create,el=st.create,tl=Lt.create,rl=at.create,nl=lt.create,il=Ge.create,ol=Oe.create,sl=xe.create,al=At.create,ll=Me.create,ul=ne.create,fl=ne.strictCreate,cl=ut.create,pl=Nr.create,hl=ft.create,dl=Te.create,ml=kr.create,yl=Dt.create,gl=Nt.create,vl=Br.create,xl=ct.create,bl=pt.create,_l=ht.create,Pl=dt.create,Tl=We.create,Cl=de.create,Il=pe.create,Sl=Ce.create,wl=de.createWithPreprocess,El=ar.create,Ol=()=>eo().optional(),Ml=()=>to().optional(),Ll=()=>ro().optional(),Al={string:e=>Fe.create({...e,coerce:!0}),number:e=>nt.create({...e,coerce:!0}),boolean:e=>ot.create({...e,coerce:!0}),bigint:e=>it.create({...e,coerce:!0}),date:e=>st.create({...e,coerce:!0})};var Dl=E;h();var no=y;h();var Ve=no;h();function Rr(e){return(e%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}h();h();h();h();h();h();h();h();var Q=63710088e-1,oo={centimeters:Q*100,centimetres:Q*100,degrees:Q/111325,feet:Q*3.28084,inches:Q*39.37,kilometers:Q/1e3,kilometres:Q/1e3,meters:Q,metres:Q,miles:Q/1609.344,millimeters:Q*1e3,millimetres:Q*1e3,nauticalmiles:Q/1852,radians:1,yards:Q*1.0936},Zm={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Q,yards:1.0936133};function He(e,t,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function Nl(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!io(e[0])||!io(e[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:e};return He(n,t,r)}function qm(e,t,r){r===void 0&&(r={});for(var n=0,i=e;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:e};return He(l,t,r)}function so(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:e};return He(n,t,r)}function Jm(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function $m(e,t,r){r===void 0&&(r={});var n={type:"MultiLineString",coordinates:e};return He(n,t,r)}function Km(e,t,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:e};return He(n,t,r)}function Qm(e,t){t===void 0&&(t="kilometers");var r=oo[t];if(!r)throw new Error(t+" units is invalid");return e*r}function ey(e,t){t===void 0&&(t="kilometers");var r=oo[t];if(!r)throw new Error(t+" units is invalid");return e/r}function ty(e){var t=e%(2*Math.PI);return t*180/Math.PI}function ry(e){var t=e%360;return t*Math.PI/180}function io(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Xr(e,t,r){if(e!==null)for(var n,i,o,s,l,u,f,p=0,d=0,m,x=e.type,b=x==="FeatureCollection",C=x==="Feature",w=b?e.features.length:1,M=0;M<w;M++){f=b?e.features[M].geometry:C?e.geometry:e,m=f?f.type==="GeometryCollection":!1,l=m?f.geometries.length:1;for(var N=0;N<l;N++){var O=0,W=0;if(s=m?f.geometries[N]:f,s!==null){u=s.coordinates;var H=s.type;switch(p=r&&(H==="Polygon"||H==="MultiPolygon")?1:0,H){case null:break;case"Point":if(t(u,d,M,O,W)===!1)return!1;d++,O++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(t(u[n],d,M,O,W)===!1)return!1;d++,H==="MultiPoint"&&O++}H==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-p;i++){if(t(u[n][i],d,M,O,W)===!1)return!1;d++}H==="MultiLineString"&&O++,H==="Polygon"&&W++}H==="Polygon"&&O++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(W=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-p;o++){if(t(u[n][i][o],d,M,O,W)===!1)return!1;d++}W++}O++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(Xr(s.geometries[n],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ay(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}function kl(e,t){var r,n,i,o,s,l,u,f,p,d,m=0,x=e.type==="FeatureCollection",b=e.type==="Feature",C=x?e.features.length:1;for(r=0;r<C;r++){for(l=x?e.features[r].geometry:b?e.geometry:e,f=x?e.features[r].properties:b?e.properties:{},p=x?e.features[r].bbox:b?e.bbox:void 0,d=x?e.features[r].id:b?e.id:void 0,u=l?l.type==="GeometryCollection":!1,s=u?l.geometries.length:1,i=0;i<s;i++){if(o=u?l.geometries[i]:l,o===null){if(t(null,m,f,p,d)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,m,f,p,d)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],m,f,p,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}m++}}function Bl(e,t){kl(e,function(r,n,i,o,s){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(He(r,i,{bbox:o,id:s}),n,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var f=0;f<r.coordinates.length;f++){var p=r.coordinates[f],d={type:u,coordinates:p};if(t(He(d,i),n,f)===!1)return!1}})}function Rl(e,t){Bl(e,function(r,n,i){var o=0;if(r.geometry){var s=r.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,u=0,f=0,p=0;if(Xr(r,function(d,m,x,b,C){if(l===void 0||n>u||b>f||C>p){l=d,u=n,f=b,p=C,o=0;return}var w=so([l,d],r.properties);if(t(w,n,i,C,o)===!1)return!1;o++,l=d})===!1)return!1}}})}function ly(e,t,r){var n=r,i=!1;return Rl(e,function(o,s,l,u,f){i===!1&&r===void 0?n=o:n=t(n,o,s,l,u,f),i=!0}),n}function wn(e){var t=[1/0,1/0,-1/0,-1/0];return Xr(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}wn.default=wn;var ao=wn;function lo(e){return ao(e)}h();h();h();h();h();var Bt=class{constructor(){c(this,"hover",!1);c(this,"dirty",!1)}};h();h();var uo=y.union([y.enum(["low","medium","high","always-visible"]),y.number()]),fo=["","","low","medium","high","always-visible"],Xl=2,Yl=3;var Fl=5;function co(e){return Math.min(Fl,Math.max(Xl,e))}function Rt(e){if(typeof e=="number")return co(e);let t=fo.indexOf(e);return t===-1?Yl:t}function _y(e){let t=co(e);return fo[t]}h();h();h();var Gl=Ve.enum(Vi),Wl=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n<=t)return!1;t=n}return!0},Vl=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n>=t)return!1;t=n}return!0},Hl=e=>Wl(e)||Vl(e),po=Ve.object({on:Ve.literal("zoom-level"),input:Ve.array(Ve.number()).nonempty().refine(Hl,{message:"input array must be strictly increasing or decreasing"}),output:Ve.array(Ve.number()).nonempty(),easing:Gl.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});h();function Yr(e){"@babel/helpers - typeof";return Yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yr(e)}var jl=/^\s+/,Ul=/\s+$/;function S(e,t){if(e=e||"",t=t||{},e instanceof S)return e;if(!(this instanceof S))return new S(e,t);var r=zl(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}S.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),r,n,i,o,s,l;return r=t.r/255,n=t.g/255,i=t.b/255,r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),i<=.03928?l=i/12.92:l=Math.pow((i+.055)/1.055,2.4),.2126*o+.7152*s+.0722*l},setAlpha:function(t){return this._a=bo(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=mo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=mo(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+n+"%, "+i+"%)":"hsva("+r+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=ho(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ho(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+n+"%, "+i+"%)":"hsla("+r+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return yo(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return $l(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(V(this._r,255)*100)+"%",g:Math.round(V(this._g,255)*100)+"%",b:Math.round(V(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(V(this._r,255)*100)+"%, "+Math.round(V(this._g,255)*100)+"%, "+Math.round(V(this._b,255)*100)+"%)":"rgba("+Math.round(V(this._r,255)*100)+"%, "+Math.round(V(this._g,255)*100)+"%, "+Math.round(V(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:uu[yo(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+go(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=S(t);n="#"+go(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var r=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0,o=!r&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(n=this.toRgbString()),t==="prgb"&&(n=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(n=this.toHexString()),t==="hex3"&&(n=this.toHexString(!0)),t==="hex4"&&(n=this.toHex8String(!0)),t==="hex8"&&(n=this.toHex8String()),t==="name"&&(n=this.toName()),t==="hsl"&&(n=this.toHslString()),t==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return S(this.toString())},_applyModification:function(t,r){var n=t.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(tu,arguments)},brighten:function(){return this._applyModification(ru,arguments)},darken:function(){return this._applyModification(nu,arguments)},desaturate:function(){return this._applyModification(Kl,arguments)},saturate:function(){return this._applyModification(Ql,arguments)},greyscale:function(){return this._applyModification(eu,arguments)},spin:function(){return this._applyModification(iu,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(au,arguments)},complement:function(){return this._applyCombination(ou,arguments)},monochromatic:function(){return this._applyCombination(lu,arguments)},splitcomplement:function(){return this._applyCombination(su,arguments)},triad:function(){return this._applyCombination(vo,[3])},tetrad:function(){return this._applyCombination(vo,[4])}};S.fromRatio=function(e,t){if(Yr(e)=="object"){var r={};for(var n in e)e.hasOwnProperty(n)&&(n==="a"?r[n]=e[n]:r[n]=lr(e[n]));e=r}return S(e,t)};function zl(e){var t={r:0,g:0,b:0},r=1,n=null,i=null,o=null,s=!1,l=!1;return typeof e=="string"&&(e=hu(e)),Yr(e)=="object"&&(Le(e.r)&&Le(e.g)&&Le(e.b)?(t=Zl(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Le(e.h)&&Le(e.s)&&Le(e.v)?(n=lr(e.s),i=lr(e.v),t=Jl(e.h,n,i),s=!0,l="hsv"):Le(e.h)&&Le(e.s)&&Le(e.l)&&(n=lr(e.s),o=lr(e.l),t=ql(e.h,n,o),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=bo(r),{ok:s,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function Zl(e,t,r){return{r:V(e,255)*255,g:V(t,255)*255,b:V(r,255)*255}}function ho(e,t,r){e=V(e,255),t=V(t,255),r=V(r,255);var n=Math.max(e,t,r),i=Math.min(e,t,r),o,s,l=(n+i)/2;if(n==i)o=s=0;else{var u=n-i;switch(s=l>.5?u/(2-n-i):u/(n+i),n){case e:o=(t-r)/u+(t<r?6:0);break;case t:o=(r-e)/u+2;break;case r:o=(e-t)/u+4;break}o/=6}return{h:o,s,l}}function ql(e,t,r){var n,i,o;e=V(e,360),t=V(t,100),r=V(r,100);function s(f,p,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?f+(p-f)*6*d:d<1/2?p:d<2/3?f+(p-f)*(2/3-d)*6:f}if(t===0)n=i=o=r;else{var l=r<.5?r*(1+t):r+t-r*t,u=2*r-l;n=s(u,l,e+1/3),i=s(u,l,e),o=s(u,l,e-1/3)}return{r:n*255,g:i*255,b:o*255}}function mo(e,t,r){e=V(e,255),t=V(t,255),r=V(r,255);var n=Math.max(e,t,r),i=Math.min(e,t,r),o,s,l=n,u=n-i;if(s=n===0?0:u/n,n==i)o=0;else{switch(n){case e:o=(t-r)/u+(t<r?6:0);break;case t:o=(r-e)/u+2;break;case r:o=(e-t)/u+4;break}o/=6}return{h:o,s,v:l}}function Jl(e,t,r){e=V(e,360)*6,t=V(t,100),r=V(r,100);var n=Math.floor(e),i=e-n,o=r*(1-t),s=r*(1-i*t),l=r*(1-(1-i)*t),u=n%6,f=[r,s,o,o,l,r][u],p=[l,r,r,s,o,o][u],d=[o,o,l,r,r,s][u];return{r:f*255,g:p*255,b:d*255}}function yo(e,t,r,n){var i=[_e(Math.round(e).toString(16)),_e(Math.round(t).toString(16)),_e(Math.round(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function $l(e,t,r,n,i){var o=[_e(Math.round(e).toString(16)),_e(Math.round(t).toString(16)),_e(Math.round(r).toString(16)),_e(_o(n))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function go(e,t,r,n){var i=[_e(_o(n)),_e(Math.round(e).toString(16)),_e(Math.round(t).toString(16)),_e(Math.round(r).toString(16))];return i.join("")}S.equals=function(e,t){return!e||!t?!1:S(e).toRgbString()==S(t).toRgbString()};S.random=function(){return S.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Kl(e,t){t=t===0?0:t||10;var r=S(e).toHsl();return r.s-=t/100,r.s=Fr(r.s),S(r)}function Ql(e,t){t=t===0?0:t||10;var r=S(e).toHsl();return r.s+=t/100,r.s=Fr(r.s),S(r)}function eu(e){return S(e).desaturate(100)}function tu(e,t){t=t===0?0:t||10;var r=S(e).toHsl();return r.l+=t/100,r.l=Fr(r.l),S(r)}function ru(e,t){t=t===0?0:t||10;var r=S(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),S(r)}function nu(e,t){t=t===0?0:t||10;var r=S(e).toHsl();return r.l-=t/100,r.l=Fr(r.l),S(r)}function iu(e,t){var r=S(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,S(r)}function ou(e){var t=S(e).toHsl();return t.h=(t.h+180)%360,S(t)}function vo(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=S(e).toHsl(),n=[S(e)],i=360/t,o=1;o<t;o++)n.push(S({h:(r.h+o*i)%360,s:r.s,l:r.l}));return n}function su(e){var t=S(e).toHsl(),r=t.h;return[S(e),S({h:(r+72)%360,s:t.s,l:t.l}),S({h:(r+216)%360,s:t.s,l:t.l})]}function au(e,t,r){t=t||6,r=r||30;var n=S(e).toHsl(),i=360/r,o=[S(e)];for(n.h=(n.h-(i*t>>1)+720)%360;--t;)n.h=(n.h+i)%360,o.push(S(n));return o}function lu(e,t){t=t||6;for(var r=S(e).toHsv(),n=r.h,i=r.s,o=r.v,s=[],l=1/t;t--;)s.push(S({h:n,s:i,v:o})),o=(o+l)%1;return s}S.mix=function(e,t,r){r=r===0?0:r||50;var n=S(e).toRgb(),i=S(t).toRgb(),o=r/100,s={r:(i.r-n.r)*o+n.r,g:(i.g-n.g)*o+n.g,b:(i.b-n.b)*o+n.b,a:(i.a-n.a)*o+n.a};return S(s)};S.readability=function(e,t){var r=S(e),n=S(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};S.isReadable=function(e,t,r){var n=S.readability(e,t),i,o;switch(o=!1,i=du(r),i.level+i.size){case"AAsmall":case"AAAlarge":o=n>=4.5;break;case"AAlarge":o=n>=3;break;case"AAAsmall":o=n>=7;break}return o};S.mostReadable=function(e,t,r){var n=null,i=0,o,s,l,u;r=r||{},s=r.includeFallbackColors,l=r.level,u=r.size;for(var f=0;f<t.length;f++)o=S.readability(e,t[f]),o>i&&(i=o,n=S(t[f]));return S.isReadable(e,n,{level:l,size:u})||!s?n:(r.includeFallbackColors=!1,S.mostReadable(e,["#fff","#000"],r))};var En=S.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},uu=S.hexNames=fu(En);function fu(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function bo(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function V(e,t){cu(e)&&(e="100%");var r=pu(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Fr(e){return Math.min(1,Math.max(0,e))}function ae(e){return parseInt(e,16)}function cu(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function pu(e){return typeof e=="string"&&e.indexOf("%")!=-1}function _e(e){return e.length==1?"0"+e:""+e}function lr(e){return e<=1&&(e=e*100+"%"),e}function _o(e){return Math.round(parseFloat(e)*255).toString(16)}function xo(e){return ae(e)/255}var be=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Le(e){return!!be.CSS_UNIT.exec(e)}function hu(e){e=e.replace(jl,"").replace(Ul,"").toLowerCase();var t=!1;if(En[e])e=En[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=be.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=be.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=be.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=be.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=be.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=be.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=be.hex8.exec(e))?{r:ae(r[1]),g:ae(r[2]),b:ae(r[3]),a:xo(r[4]),format:t?"name":"hex8"}:(r=be.hex6.exec(e))?{r:ae(r[1]),g:ae(r[2]),b:ae(r[3]),format:t?"name":"hex"}:(r=be.hex4.exec(e))?{r:ae(r[1]+""+r[1]),g:ae(r[2]+""+r[2]),b:ae(r[3]+""+r[3]),a:xo(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=be.hex3.exec(e))?{r:ae(r[1]+""+r[1]),g:ae(r[2]+""+r[2]),b:ae(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function du(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}var z={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},vt="low-priority",Po=Object.values(z),On=[z.RIGHT,z.LEFT,z.TOP,z.HIDDEN],To=y.object({margin:y.number().min(6).default(6),maxLines:y.number().min(1).default(2),textSize:y.number().min(0).default(11.5),maxWidth:y.number().min(0).default(150),lineHeight:y.number().min(0).default(1.2),color:y.string().default("#333"),outlineColor:y.string().default("white"),textColor:y.string().optional(),textOutlineColor:y.string().optional(),pinColor:y.string().optional(),pinOutlineColor:y.string().optional(),pinColorInactive:y.string().optional(),pinOutlineColorInactive:y.string().optional(),icon:y.string().optional(),iconSize:y.number().min(0).default(20),iconScale:y.union([y.number(),po]).default(1),iconPadding:y.number().min(0).default(2),iconFit:y.enum(["fill","contain","cover"]).default("cover"),iconOverflow:y.enum(["visible","hidden"]).default("hidden"),iconVisible:y.union([y.boolean(),y.number()]).default(!0)}),Co=To.transform(e=>({...e,textColor:e.textColor??e.color,textOutlineColor:e.textOutlineColor??e.outlineColor,pinColor:e.pinColor??e.color,pinOutlineColor:e.pinOutlineColor??e.outlineColor,pinColorInactive:e.pinColorInactive??S(e.pinColor??e.color).toRgbString(),pinOutlineColorInactive:e.pinOutlineColorInactive??S(e.pinOutlineColor??e.outlineColor).toRgbString()})),By=To.strict(),Io=e=>Co.parse(e),mu=y.object({rank:uo.optional(),appearance:Co.optional(),interactive:y.boolean().default(!1),textPlacement:y.union([y.enum(Po),y.array(y.enum(Po))]).default(On)}),Mn=e=>{mu.parse(e??{})},Ry=(e,t,r)=>{y.array(y.number()).min(2).max(3).parse(e),y.string().parse(t),Mn(r)},So=["color","outlineColor","margin"],yu=[...So,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],gu=[...So,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],wo=(e,t)=>yu.some(r=>t[r]!=null&&e[r]!==t[r]),Eo=(e,t)=>gu.some(r=>t[r]!=null&&e[r]!==t[r]);var Oo=4,xu=6,Lo=6.5,Gr=Lo/2,Mo=[Gr,Gr,Gr,Gr],Xt=class Xt{constructor(t,r,n){c(this,"lines",0);c(this,"id");c(this,"rank");c(this,"type","label");c(this,"initialRank");c(this,"contextConfigured",!1);c(this,"fillText");c(this,"newStyle",{});c(this,"opacity",0);c(this,"visibilityNeedsUpdate",!1);c(this,"activePlacement",z.RIGHT);c(this,"text");c(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});c(this,"projection",new Se);c(this,"labelCacheId");c(this,"_cache",{});c(this,"appearance");c(this,"options");c(this,"visible",!0);c(this,"enabled",!0);c(this,"isOccluded",!1);c(this,"offscreen",!1);c(this,"canShow",!1);c(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});c(this,"dimensions",{width:0,height:0});c(this,"currentStrategyIndex",-1);c(this,"totalPinSize",0);c(this,"iconScale",1);c(this,"iconPadding");c(this,"dirty",!0);c(this,"textDirty",!0);c(this,"pinDirty",!0);c(this,"attachedDirty",!0);c(this,"collisionDirty",!0);c(this,"lastTextAlign");c(this,"imageHash");c(this,"pinSize",0);c(this,"iconVisible",!1);c(this,"dp");c(this,"animate",!0);c(this,"onStrategySelected",t=>{if(this.currentStrategyIndex===t)return;this.currentStrategyIndex=t;let r=this.strategies[t];if(this.activePlacement=r?.name??this.activePlacement,r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});c(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});if(this.id=r.id??K(),this.options=r??{},this.text=t,this.dp=(o=1)=>o*n.pixelRatio,typeof r.rank=="string")this.rank=Rt(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let o=Math.trunc(_.env.NODE_ENV==="test"?Xt.testId:Xt.testId*10)/10;Xt.testId+=.001,this.rank=o,this.initialRank=o}this.options.textPlacement=r.textPlacement??On;let i=Io(r.appearance??{});this.appearance=i,this.iconPadding=i.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(Lo),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let r=this.scaledPinSize/2+t;return[r,r,r,r]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):Mo}getBoundingBoxForPlacement(t){let{width:r,height:n}=this.dimensions,{margin:i}=this.appearance,o=Math.max(xu,i);if(this.text==="")return this.getNoTextBbox(o);let s=Math.max(this.scaledPinSize,n);switch(t){case z.RIGHT:return[s/2+o,s/2+o,this.scaledPinSize/2+o,this.scaledPinSize/2+r+o];case z.LEFT:return[s/2+o,s/2+o,this.scaledPinSize/2+r+o,this.scaledPinSize/2+o];case z.TOP:{let l=this.dp();return[n+this.scaledPinSize/2/l+o,this.scaledPinSize/2+o,r/2+o,r/2+o]}case z.CENTER:return[n/2+o,n/2+o,r/2+o,r/2+o];case z.HIDDEN:return this.getHiddenTextPlacementBbox(o);case vt:return Mo;default:return this.getNoTextBbox(o)}}getStrategyStyleForPlacement(t){let{width:r,height:n}=this.dimensions;switch(t){case z.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-n-this.scaledPinSize/2,this.newStyle.left=-r/2;return;case z.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=-r-this.scaledPinSize/2-Oo,this.newStyle.textLabelVisible=!0;return;case z.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=this.scaledPinSize/2+Oo,this.newStyle.textLabelVisible=!0;return;case z.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-n/2,this.newStyle.left=-r/2;return;case z.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case vt:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}get strategies(){let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],r=[],n=!1;for(let i of t)r.push({name:i,getBoundingBox:()=>this.getBoundingBoxForPlacement(i),onStrategySelected:()=>this.getStrategyStyleForPlacement(i)}),i===z.HIDDEN&&(n=!0);return n&&r.push({name:vt,getBoundingBox:()=>this.getBoundingBoxForPlacement(vt),onStrategySelected:()=>this.getStrategyStyleForPlacement(vt)}),r}recomputeCurrentStrategy(t=this.iconScale){if(this.iconScale!==t||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}this.dirty=!1}}toPackedMessage(t=!1){this.visible&&t&&this.collisionDirty===!1&&this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank;let r=this.strategies[this.currentStrategyIndex],n=this.text===""||r?.name===z.HIDDEN||r?.name===vt;if(!n&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let i=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(i!==-1){let o=this.packedMessage.bboxes.splice(i,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let i=0;i<this.strategies.length;i++){let o=this.strategies[i];!n&&i===this.currentStrategyIndex&&this.currentStrategyIndex!==-1?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),i]):this.packedMessage.bboxes.push([...o.getBoundingBox(),i])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};c(Xt,"testId",0);var Ln=Xt,Ao=Ln;h();var ps=xi(as());h();var ls="0.6",G={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},Wn=Object.values(G),us=[G.CENTER,G.HIDDEN],fs=Object.freeze({size:8,color:"#666"});var Vn=y.object({rank:y.union([y.enum(["low","medium","high","always-visible"]),y.number()]).optional(),interactive:y.union([y.boolean(),y.literal("pointer-events-auto")]).optional(),id:y.string().optional(),placement:y.union([y.enum(Wn),y.array(y.enum(Wn))]).optional(),dynamicResize:y.boolean().optional(),zIndex:y.number().optional(),lowPriorityPin:y.object({size:y.number().positive().optional(),color:y.string().optional()}).optional()});function ag(e,t,r){y.array(y.number()).min(2).max(3).parse(e),y.string().parse(t),Vn.parse(r)}var Wt=class Wt{constructor(t,r={}){c(this,"id");c(this,"type","marker");c(this,"rank",0);c(this,"initialRank",0);c(this,"activePlacement","center");c(this,"pointerEvents","none");c(this,"options",{rank:"low",interactive:!1,id:"",placement:us,dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:{...fs}});c(this,"projection",new Se);c(this,"enabled",!0);c(this,"canShow",!1);c(this,"visible",!0);c(this,"isOccluded",!1);c(this,"offscreen",!1);c(this,"strategyIndex",-1);c(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});c(this,"dimensions",{width:0,height:0});c(this,"markerContainer");c(this,"containerEl");c(this,"contentEl",null);c(this,"contentHtml","");c(this,"style",{top:"0px",left:"0px"});c(this,"dirty",!1);c(this,"attachedDirty",!0);c(this,"collisionDirty",!0);c(this,"visibilityNeedsUpdate","show");c(this,"animation",null);c(this,"currentStrategyIndex",-1);c(this,"onStrategySelected",(t,r=!1)=>{if(this.currentStrategyIndex===t&&!r)return;this.currentStrategyIndex=t;let n=this.strategies[t];if(this.activePlacement=n?.name??"center",this.activePlacement===G.HIDDEN){this.markerContainer.setAttribute("data-placement",G.HIDDEN);let i=this.options.lowPriorityPin,o=i.size,s=i.color;this.markerContainer.style.setProperty("--mappedin-pin-size",`${o}px`),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity=ls,this.style.top=-o/2+"px",this.style.left=-o/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:i,height:o}=this.dimensions,s=-o/2+"px",l=-i/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case G.TOP:{this.style.top=-o+"px";break}case G.BOTTOM:{this.style.top="0px";break}case G.LEFT:{this.style.left=-i+"px";break}case G.RIGHT:{this.style.left="0px";break}case G.TOP_LEFT:{this.style.top=-o+"px",this.style.left=-i+"px";break}case G.TOP_RIGHT:{this.style.top=-o+"px",this.style.left="0px";break}case G.BOTTOM_LEFT:{this.style.top="0px",this.style.left=-i+"px";break}case G.BOTTOM_RIGHT:{this.style.top="0px",this.style.left="0px";break}case G.CENTER:default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});c(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});if(this.id=r?.id||K(),this.options=(0,ps.default)(this.options,r),this.options.placement=r.placement??this.options.placement,typeof r.rank=="string")this.rank=Rt(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let n=Math.trunc(_.env.NODE_ENV==="test"?Wt.testId:Wt.testId*10)/10;Wt.testId+=.001,this.rank=n}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML=`<div class="mappedin-marker-content">${this.contentHtml}</div>`,this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=this.markerContainer.firstElementChild??null,this.contentEl=this.markerContainer.firstElementChild?.firstElementChild??null}updateDimensions(t,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};else{let{width:n,height:i}=this.markerContainer.getBoundingClientRect();this.dimensions={width:n,height:i}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:t,height:r}=this.dimensions;return t===0||r===0?[]:(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(o=>({name:o,getBoundingBox:()=>{let s=r/2,l=r/2,u=t/2,f=t/2;switch(o){case G.TOP:{s=r,l=0;break}case G.BOTTOM:{s=0,l=r;break}case G.LEFT:{u=t,f=0;break}case G.RIGHT:{u=0,f=t;break}case G.TOP_LEFT:{s=r,u=t,l=0,f=0;break}case G.TOP_RIGHT:{s=r,f=t,l=0,u=0;break}case G.BOTTOM_LEFT:{l=r,u=t,s=0,f=0;break}case G.BOTTOM_RIGHT:{l=r,f=t,s=0,u=0;break}case G.HIDDEN:let p=Math.max(2,4/2);return[this.options.lowPriorityPin.size/2+p,this.options.lowPriorityPin.size/2+p,this.options.lowPriorityPin.size/2+p,this.options.lowPriorityPin.size/2+p]}return[s+4,l+4,u+4,f+4]}}))}toPackedMessage(t=!1){this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let n=this.packedMessage.bboxes.findIndex(i=>i[4]===this.currentStrategyIndex);if(n!==-1){let i=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(i)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let i=this.strategies[n];n===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...i.getBoundingBox(),n]):this.packedMessage.bboxes.push([...i.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this.options.rank==="always-visible"?-1:this.strategies.findIndex(t=>t.name===G.HIDDEN)}destroy(){}};c(Wt,"testId",0);var cs=Wt;h();var Pt=class extends fe{constructor(){super(...arguments);c(this,"type","geometry");c(this,"userData",{entityId:"",type:"geometry"})}raycast(r,n){this.userData.type==="model"&&this.children[0]&&r.intersectObject(this.children[0],!0).forEach(i=>{n.push(i)})}},le=class{constructor(t,r){c(this,"id",K());c(this,"components");c(this,"parentId");c(this,"entities2D",new Map);this.components=[t,r]}get object3d(){return this.components[0].mesh}get parentObject3D(){return this.components[0].mesh?.parent}get type(){return this.components[0].type}attach(t){this.parentObject3D instanceof ie?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof ie&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};h();var Ie=class extends fe{},Ne=class{constructor(t,r,n=0){c(this,"id");c(this,"verticalOffset");c(this,"occluderId");c(this,"object3d",new Ie);c(this,"components");c(this,"disposed",!1);c(this,"worldPosition",new j);this.id=t.id||K(),this.components=[t],this.verticalOffset=n,this.object3d=new Ie,this.object3d.position.set(r.x,r.y,r.z+n),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type,this.positionDirty=!0}get type(){return this.components[0].type}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(t){this.object3d.userData.worldPositionDirty=t}updatePosition(t){this.object3d.position.copy(t),this.positionDirty=!0}setAltitude(t){this.object3d.position.z=t,this.positionDirty=!0}};h();h();var hs=class extends tr{constructor(r,n,i=!0){super();c(this,"rendererState");c(this,"convertTo3DMapPosition");c(this,"textSet",new Set);c(this,"batchedTextMap",new Map);c(this,"useWorker",!0);c(this,"debugTextAreaMesh",new Map);i===!1&&(this.useWorker=!1,hc(!1)),this.rendererState=r,this.convertTo3DMapPosition=n}remove(r){this.textSet.delete(r)}update(r){let n,i,o,s=[];for(let l of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(l),n?.type==="text3d"){i=n.components[0],o=n.components[1];let u=i.mesh?.parent;if(!u||!(u instanceof oe)||!(i instanceof $r))continue;if("textArea"in i.feature.properties&&i.mesh!=null&&i.polygonEntityId!=null&&i.textMesh==null&&i.mesh.parent!=null&&i.feature.properties?.textArea?.position!=null){if(this.textSet.has(i.polygonEntityId))continue;this.textSet.add(i.polygonEntityId),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,Vt().then(({BatchedText:d})=>{let m=new d;return m.type="batchedtext",u.add(m),m}));let p=this.batchedTextMap.get(u);if(!p)throw new Error("batched text required");s.push(ds({entityId:l,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:p,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(i.mesh!=null&&i.textMesh==null&&i.mesh.parent!=null){if(this.textSet.has(l.toString()))continue;this.textSet.add(l.toString()),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,Vt().then(({BatchedText:d})=>{let m=new d;return m.type="batchedtext",u.add(m),m}));let p=this.batchedTextMap.get(u);if(!p)throw new Error("batched text required");s.push(ds({entityId:l,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:p,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let f=this.batchedTextMap.get(u);i.textMesh&&f&&i.polygonEntityId!=null&&Promise.all([f,Promise.resolve({meshComponent:i,styleComponent:o})]).then(([p,{meshComponent:d,styleComponent:m}])=>{let{textMesh:x}=d;if(p&&x){let b=Un(p,x);d.visible&&!b?p.add(x):!d.visible&&b&&p.remove(x)}m.flipToFaceCamera&&this.flipIfNeeded(d,r)})}return Promise.all(s)}flipIfNeeded(r,n){let i=r.textMesh;if(!i)return!1;let o=i.rotation.z,s=Rr(o+n);s>Math.PI/2&&s<3*Math.PI/2&&(i.rotation.z=Rr(o+Math.PI))}showTextAreaMesh(){let r,n;for(let i of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(i),r?.type==="text3d"&&(n=r.components[0],"textArea"in n.feature.properties)){let o=n.feature.properties.textArea;if(!o)continue;let s=new Ai(o.maxWidth,o.maxHeight),l=new Re(s,new Ke({color:"pink"})),{textMesh:u}=n;if(!u)continue;let f=this.convertTo3DMapPosition(o.position,mr);l.position.copy(f),l.position.z=u.position.z-.1,l.rotation.z=u.rotation.z,Hn.identity(),Hn.makeRotationAxis(new j(0,0,1),u.userData.rotationZ),mr.set(o.maxWidth/2,0,0),mr.applyMatrix4(Hn),l.position.x-=mr.x,l.position.y-=mr.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(i,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function hc(e){Vt().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var Hn=new $e,mr=new j,jn;async function Eg(e){let{preloadFont:t}=await Vt();return t(e)}function Vt(){return jn||(jn=import("./text3d-HT6TS3WO.js").then(e=>e)),jn}async function ds({entityId:e,textComponent:t,styleComponent:r,convertTo3DMapPosition:n,batchedMeshPromise:i,rendererState:o,type:s="text-area"}){return Promise.all([Vt(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:r})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:u},f])=>s==="text-area"?u(f.entityId,f.meshComponent,f.styleComponent,n):l(f.entityId,f.meshComponent,f.styleComponent,n)).catch(l=>{U.warn("Trouble creating text: ",l)}).then(l=>{if(!l?.text)return;let u=[Promise.resolve(l.text),i,Promise.resolve()];if(t.polygonEntityId){let f=o.geometry3DMap.get(t.polygonEntityId);if(f?.type==="geometry"){let p=f.components[0],d=f.components[1];p.textMesh=l.text,l.text.position.z=d.altitude+d.height+dc}}else u[2]=Vt().then(({syncText:f})=>f(l.text));return Promise.all(u)}).then(l=>{if(!l)return;let[u,f]=l;f.add(u),t.batchedText||(t.batchedText=f)})}function Un(e,t){return e._members.has(t)}var dc=.5;var mc=y.object({visible:y.boolean(),color:y.string(),flipToFaceCamera:y.boolean(),font:y.string().optional(),fontSize:y.number(),margin:y.union([y.number(),y.tuple([y.number(),y.number(),y.number(),y.number()])]),outlineColor:y.string(),outlineOpacity:y.number(),outlineBlur:y.union([y.number(),y.string()]),outlineWidth:y.number(),outlineOffsetX:y.number(),outlineOffsetY:y.number(),strokeWidth:y.number(),maxWidth:y.number().optional(),maxHeight:y.number().optional(),strokeOpacity:y.number(),strokeColor:y.string(),fillOpacity:y.number(),hoverColor:y.string().optional(),id:y.union([y.string(),y.number()]),type:y.literal("text3d"),position:y.tuple([y.number(),y.number(),y.number()]),content:y.string()}),ms=mc.partial().omit({id:!0,type:!0}).strict(),ys=ms.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),kg=y.object({appearance:ms.optional(),parentId:y.string().optional()}).strict(),$r=class{constructor(t){c(this,"mesh",new Pt);c(this,"textMesh");c(this,"type","text3d");c(this,"feature");c(this,"parent");c(this,"batchedText");c(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?Un(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};h();var Ht,Kr=class{constructor(t){c(this,"color");c(this,"dirty",!0);c(this,"enabled",!0);se(this,Ht,!1);c(this,"edgeColors");c(this,"edgeVisibility");c(this,"geometry");c(this,"ranges");c(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||Y(this,Ht)===t)return;q(this,Ht,t);let r=this.edgeVisibility.array,n=t?1:0;for(let i=0;i<this.ranges.count;i++){let o=this.ranges.start+i;r[o]=n}this.edgeVisibility.needsUpdate=!0}get visible(){return Y(this,Ht)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};Ht=new WeakMap;h();h();h();var Qr=class extends wi{constructor(r){let n=r,i=3,o=i*4;super(new Uint8Array(r*o),i,r,Ci,Ti);c(this,"_width");c(this,"_height");c(this,"_propertiesLength");this._width=o,this._height=n,this._propertiesLength=i}setColor(r,n,i){let o=this.image.data,s=r*this._width;o[s]=Math.round(n.r*255),o[s+1]=Math.round(n.g*255),o[s+2]=Math.round(n.b*255),o[s+3]=0,o[s+4]=Math.round(i.r*255),o[s+5]=Math.round(i.g*255),o[s+6]=Math.round(i.b*255),o[s+7]=0,this.needsUpdate=!0}getColor(r){let n=this.image.data,i=r*this._width,o=new ce(n[i]/255,n[i+1]/255,n[i+2]/255),s=new ce(n[i+4]/255,n[i+5]/255,n[i+6]/255);return{color:o,topColor:s}}setTexture(r,n,i){let o=this.image.data,s=r*this._width;o[s+8]=n?255:0,o[s+9]=i?255:0,o[s+10]=0,o[s+11]=0,this.needsUpdate=!0}getTexture(r){let n=this.image.data,i=r*this._width,o=n[i+8]===255,s=n[i+9]===255;return{texture:o,topTexture:s}}};h();var gs=`#define LAMBERT
3
+ varying vec3 vViewPosition;
4
+ varying vec4 vPosition;
5
+ varying vec2 vUv;
6
+ varying vec4 finalPosition;
7
+ varying float vVerticalOffset;
8
+ varying vec3 worldNormal;
9
+ varying float vBatchId;
10
+
11
+ #include <common>
12
+ #include <batching_pars_vertex>
13
+ #include <uv_pars_vertex>
14
+ #include <displacementmap_pars_vertex>
15
+ #include <envmap_pars_vertex>
16
+ #include <color_pars_vertex>
17
+ #include <fog_pars_vertex>
18
+ #include <normal_pars_vertex>
19
+ #include <morphtarget_pars_vertex>
20
+ #include <skinning_pars_vertex>
21
+ #include <shadowmap_pars_vertex>
22
+ #include <logdepthbuf_pars_vertex>
23
+ #include <clipping_planes_pars_vertex>
24
+
25
+ void main() {
26
+
27
+ #include <uv_vertex>
28
+ #include <color_vertex>
29
+ #include <morphinstance_vertex>
30
+ #include <morphcolor_vertex>
31
+ #include <batching_vertex>
32
+
33
+ #include <beginnormal_vertex>
34
+ #include <morphnormal_vertex>
35
+ #include <skinbase_vertex>
36
+ #include <skinnormal_vertex>
37
+ #include <defaultnormal_vertex>
38
+ #include <normal_vertex>
39
+
40
+ #include <begin_vertex>
41
+ #include <morphtarget_vertex>
42
+ #include <skinning_vertex>
43
+ #include <displacementmap_vertex>
44
+ #include <project_vertex>
45
+ #include <logdepthbuf_vertex>
46
+ #include <clipping_planes_vertex>
47
+
48
+ vViewPosition = - mvPosition.xyz;
49
+
50
+ #include <worldpos_vertex>
51
+ #include <envmap_vertex>
52
+ #include <shadowmap_vertex>
53
+ #include <fog_vertex>
54
+
55
+ // To mitigate visual defects on machines such as windows and iOS
56
+ vBatchId = getIndirectIndex(gl_DrawID) + 0.5;
57
+ vViewPosition = - mvPosition.xyz;
58
+ worldNormal = normal;
59
+ vUv = uv;
60
+ vVerticalOffset = position.z;
61
+ }
62
+ `;h();var vs=`#define LAMBERT
63
+ uniform vec3 diffuse;
64
+ uniform vec3 emissive;
65
+ uniform float opacity;
66
+ uniform float uGradientEnd;
67
+ uniform float uGradientIntensity;
68
+ uniform float uMinSideAlpha;
69
+ uniform float uMaxSideAlpha;
70
+ uniform float uGradientStart;
71
+ uniform highp sampler2D uPropertiesTexture;
72
+ uniform highp sampler2D uTopTexture;
73
+ uniform highp sampler2D uTexture;
74
+ uniform float uRepeatYFactor;
75
+ uniform bool uBlendTexture;
76
+ varying float vBatchId;
77
+
78
+ varying vec2 vUv;
79
+ varying float vVerticalOffset;
80
+ varying vec3 worldNormal;
81
+
82
+ #include <common>
83
+ #include <packing>
84
+ #include <dithering_pars_fragment>
85
+ #include <color_pars_fragment>
86
+ #include <uv_pars_fragment>
87
+ #include <map_pars_fragment>
88
+ #include <alphamap_pars_fragment>
89
+ #include <alphatest_pars_fragment>
90
+ #include <alphahash_pars_fragment>
91
+ #include <aomap_pars_fragment>
92
+ #include <lightmap_pars_fragment>
93
+ #include <emissivemap_pars_fragment>
94
+ #include <envmap_common_pars_fragment>
95
+ #include <envmap_pars_fragment>
96
+ #include <fog_pars_fragment>
97
+ #include <bsdfs>
98
+ #include <lights_pars_begin>
99
+ #include <normal_pars_fragment>
100
+ #include <lights_lambert_pars_fragment>
101
+ #include <shadowmap_pars_fragment>
102
+ #include <bumpmap_pars_fragment>
103
+ #include <normalmap_pars_fragment>
104
+ #include <specularmap_pars_fragment>
105
+ #include <logdepthbuf_pars_fragment>
106
+ #include <clipping_planes_pars_fragment>
107
+
108
+ vec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {
109
+ vec3 texturedColor = diffuseColor * texColor.rgb;
110
+ return mix(diffuseColor, texturedColor, texColor.a);
111
+ }
112
+
113
+ void main() {
114
+ #include <clipping_planes_fragment>
115
+
116
+ // get the normalized world normal of vertex fragment
117
+ vec3 surfaceNormal = normalize(worldNormal);
118
+
119
+ // get angle relative to Z up
120
+ float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));
121
+
122
+ int idx = int(vBatchId) * 1;
123
+ vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);
124
+ bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;
125
+
126
+ if(shouldShowTexture) {
127
+ vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));
128
+ diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;
129
+ }
130
+
131
+ // if this is a fragment facing upwards, use topColor. Avoid any sort of '==' comparison, due to floating point precision issue
132
+ if(angle < 0.02) {
133
+ bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;
134
+
135
+ if(shouldShowTopTexture) {
136
+ vec4 topTex2d = texture2D(uTopTexture, vUv);
137
+ diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;
138
+ } else {
139
+ diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);
140
+ }
141
+ }
142
+
143
+ vec4 diffuseColor = vec4(diffuse, opacity);
144
+
145
+ // only for vertical surfaces
146
+ if(angle > 89.0 && angle < 91.0) {
147
+
148
+ // get the percentage of the z position from the ground, up
149
+ float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);
150
+
151
+ // gradient based on percentage
152
+ float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);
153
+
154
+ // mix the shadow color with the diffuse color based on the alpha and opacity
155
+ diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);
156
+ }
157
+
158
+ ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));
159
+ vec3 totalEmissiveRadiance = emissive;
160
+
161
+ #include <logdepthbuf_fragment>
162
+ #include <map_fragment>
163
+ #include <color_fragment>
164
+ #include <alphamap_fragment>
165
+ #include <alphatest_fragment>
166
+ #include <alphahash_fragment>
167
+ #include <specularmap_fragment>
168
+ #include <normal_fragment_begin>
169
+ #include <normal_fragment_maps>
170
+ #include <emissivemap_fragment>
171
+
172
+ // accumulation
173
+ #include <lights_lambert_fragment>
174
+ #include <lights_fragment_begin>
175
+ #include <lights_fragment_maps>
176
+ #include <lights_fragment_end>
177
+
178
+ // modulation
179
+ #include <aomap_fragment>
180
+
181
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
182
+
183
+ #include <envmap_fragment>
184
+ #include <opaque_fragment>
185
+ #include <tonemapping_fragment>
186
+ #include <colorspace_fragment>
187
+ #include <fog_fragment>
188
+ #include <premultiplied_alpha_fragment>
189
+ #include <dithering_fragment>
190
+
191
+ }
192
+ `;var yc=-.05,gc=1,yr=class extends Di{constructor(r,n,i=1){super(r);c(this,"propertiesTexture");c(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});c(this,"colorSpace",mn);c(this,"showTextures",r=>{let n=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(n||i)&&(this.propertiesTexture.setTexture(r,n,i),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new Qr(n),this.uniforms.uRepeatYFactor.value=i,this.onBeforeCompile=o=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,u=this.uniforms.uGradientStart,f=this.uniforms.uTopTexture,p=this.uniforms.uTexture,d=this.uniforms.uRepeatYFactor,m=this.uniforms.uBlendTexture;this.uniforms=o.uniforms,o.vertexShader=gs,o.fragmentShader=vs,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:u,uMinSideAlpha:{value:yc},uMaxSideAlpha:{value:gc},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:f,uTexture:p,uRepeatYFactor:d,uBlendTexture:m})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){r.wrapS=Qt,r.wrapT=Qt,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=Qt,r.wrapT=Qt,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?Ii:mn,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,n,i){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=n,this.uniforms.uGradientIntensity.value=i}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(r,n,i){this.propertiesTexture.setColor(r,n,i)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let n=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(n||i)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let n=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,n),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let n=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,n,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};h();var nv={top:0,bottom:0,left:0,right:0,type:"pixel"},gr={enabled:!1,thickness:0,size:0,offset:0,segments:3};function iv(e,t){return{bevelEnabled:e?.enabled??gr.enabled,bevelThickness:e?.thickness??gr.thickness,bevelSize:e?.size??(e?.thickness||gr.size),bevelOffset:e?.offset??gr.offset,bevelSegments:e?.segments??gr.segments,depth:t}}var xs="mappedin";var ov={ALWAYS_ON_TOP:10},sv=250,av="collision-worker.csp.js",lv="maplibre-worker.csp.js";h();function Sv(e,t){let r=0;for(let f of e)r+=f.components[0]?.geometry?.attributes.position.count||0;let n=new ce(t.color),i;i=new yr({color:n,side:t.side==="back"?_i:t.side==="front"?bi:Pi,opacity:t.opacity??1,transparent:t.opacity!==void 0?t.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length);let o=new jt(e.length,r,0,i);o.renderOrder=0;let s,l,u;for(let f of e)s=f.components[0],!(!(s instanceof je)||!s.geometry)&&(s.mesh=o,s.material=i,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=f.id,i instanceof yr&&i.setColor(s.instanceIndex,n,t.topColor?new ce(t.topColor):n),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}function zn(e){return S(e).darken(30).toRgbString()}function wv(e,t,r,n){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let i=e.boundingBox,o=e.getAttribute("position"),s=e.getAttribute("normal"),l=e.getAttribute("uv"),u,f;e.index?(u=e.index.count/3,f=function(O,W){return e.index.getX(O*3+W)}):(u=o.count/3,f=function(O,W){return O*3+W});let p=new $e;p.makeRotationFromQuaternion(new yn().setFromEuler(new vn(0,0,r/180*Math.PI)));let d=t.find(O=>O.face==="top"),m;d&&(m={min:n(d.bounds[1],d.bounds[0],0),max:n(d.bounds[3],d.bounds[2],i.max.z)});let x=t.find(O=>O.face==="side"),b;if(x&&(b={min:n(x.bounds[1],x.bounds[0],0),max:n(x.bounds[3],x.bounds[2],i.max.z)}),!(!b&&!m))for(let O=0;O<u;++O){let W=s.getX(f(O,0))+s.getX(f(O,1))+s.getX(f(O,2)),H=s.getY(f(O,0))+s.getY(f(O,1))+s.getY(f(O,2)),qe=s.getZ(f(O,0))+s.getZ(f(O,1))+s.getZ(f(O,2)),Be=Math.abs(W),Zt=Math.abs(H),Sr=Math.abs(qe);var C,w;Be<=Zt&&Be<=Sr?(C="x",Zt<=Sr?w="y":w="z"):Zt<=Be&&Zt<=Sr?(C="y",Be<=Sr?w="x":w="z"):(C="z",Be<=Zt?w="x":w="y"),C==="z"&&(C=w,w="z");let qt,Jt,$t,Kt,fn,cn;if(w==="z"||C==="z"){if(!x||!b)continue;qt=x.repeat.u,Jt=x.repeat.v,$t=x.offset.u,Kt=x.offset.v,fn=x.rotation,cn=b}else{if(!d||!m)continue;qt=d.repeat.u,Jt=d.repeat.v,$t=d.offset.u,Kt=d.offset.v,fn=(360-r+d.rotation)%360,cn=m}let{min:ye,max:ai}=cn,wt=new fe;wt.position.set(ye.x,ye.y,0),wt.updateMatrix(),wt.updateMatrixWorld();let li=ye.clone().applyMatrix4(p),ui=ai.clone().applyMatrix4(p),Qs=Math.abs(ui.x-li.x),ea=Math.abs(ui.y-li.y),fi=new j(Qs,ea,ai.z).applyMatrix4(wt.matrixWorld),pn=Math.abs(fi[C]-ye[C]),hn=Math.abs(fi[w]-ye[w]),ci=fn*Math.PI/180||0,pi=Math.cos(ci),hi=Math.sin(ci),ta=wt.matrixWorld.clone().invert(),ra=new yn().setFromEuler(new vn(0,0,r/180*Math.PI));for(let Je=0;Je<3;Je++){let di=new j(o.getX(f(O,Je)),o.getY(f(O,Je)),o.getZ(f(O,Je))).applyMatrix4(ta);di.applyQuaternion(ra);let dn=di.applyMatrix4(wt.matrixWorld),mi=dn.x,yi=dn.y,gi=dn.z;var M,N;C==="x"?M=qt*(mi-ye[C])/pn+$t:C==="y"?M=qt*(yi-ye[C])/pn+$t:M=qt*(gi-ye[C])/pn+$t,w==="x"?N=Jt*(mi-ye[w])/hn+Kt:w==="y"?N=Jt*(yi-ye[w])/hn+Kt:N=Jt*(gi-ye[w])/hn+Kt,M-=.5,N-=.5;let na=M*pi-N*hi+.5,ia=M*hi+N*pi+.5;l.setX(f(O,Je),na),l.setY(f(O,Je),ia)}}}h();var en=class{constructor(){c(this,"focusMesh");c(this,"dirty",!0)}};h();var tn=class{constructor(){c(this,"dirty",!0);c(this,"needsRebuild",!1);c(this,"mesh")}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}};function vr(e,t,r){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof Ne&&e.components[1]===void 0?(e.components[1]=new Bt,e.components[1].dirty=!0):e instanceof le&&e.components[2]===void 0?(e.components[2]=new Bt,e.components[2].dirty=!0):e instanceof oe&&e.components[0]===void 0&&(e.components[0]=new Bt,e.components[0].dirty=!0),!0):(e instanceof Ne?e.components[1]=void 0:e instanceof le?e.components[2]=void 0:e instanceof oe&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let n;for(let i of e.userData.entities3D.values())n=r.geometry3DMap.get(i),vr(n,t,r);return!0}}return!1}function Qv(e,t,r){if(!(!r?.color&&!("topColor"in r))){if(r!==void 0&&e.type==="geometry-group"){let n;for(let i of e.userData.entities3D.values())n=t.geometry3DMap.get(i),n&&bs(n,r);return!0}return!1}}function bc(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function ex(e,t,r){if(r!==void 0&&e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);i&&bc(i,r)}return!0}return!1}function tx(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function _c(e,t,r){if(r!==void 0){if(e.type==="geometry"){let n=e.components[1];if(n.height!==r)return n.height=r,n.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);(i?.type==="geometry"||i?.type==="model")&&_c(i,t,r)}return!0}}return!1}function bs(e,t){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=zn(t.color),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function rx(e,t,r){t!==void 0&&(e.type==="label"||e.type==="marker"?e.updatePosition(r(t[1],t[0],t[2]||0)):e.type==="custom-geometry"&&e.components[0].position.copy(r(t[1],t[0],t[2]||0)))}function nx(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof oe?(e.parentObject3D?.removeEntity(e),t.addEntity(e),!0):!1}function ix(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function ox(e,t,r){if(t!==void 0&&e.type==="marker"){let n=e.components[0];if(t.contentHTML!==void 0)return n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,!0;if(Ps(e,t.placement)&&(n.collisionDirty=!0),t.dynamicResize!==void 0)return n.options.dynamicResize=t.dynamicResize,!0;if(t.options!=null){try{Vn.parse(t.options||{})}catch(i){return U.error(i),!1}return t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",vr(e,!1,r)):(n.pointerEvents="none",vr(e,t.options.interactive,r))),_s(e,t.options.rank),!0}}return!1}function _s(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=Rt(t),!0):!1}function Pc(e,t){if(t?.options?.appearance==null)return;let r=t.options.appearance||{};qn(e.appearance,r)}function sx(e,t,r){if(t!==void 0&&e.type==="label"){let n=e.components[0];t.text!==void 0&&t.text!==n.text&&(n.text=t.text,n.textDirty=!0);try{Mn(t.options??{})}catch(i){U.error(i);return}(wo(n.appearance,t.options?.appearance||{})||t.options?.textPlacement!=null)&&(n.textDirty=!0),Eo(n.appearance,t.options?.appearance||{})&&(n.pinDirty=!0),Pc(n,t),Ps(e,t.options?.textPlacement)&&(n.currentStrategyIndex=-1),vr(e,t.options?.interactive,r),_s(e,t.options?.rank)}}function Ps(e,t){if(t!==void 0){if(e.type==="label"){let r=e.components[0];return r.options.textPlacement=t,!0}else if(e.type==="marker"){let r=e.components[0];return r.options.placement=t,!0}}return!1}function ax(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function lx(e,t){if(t!==void 0){let r=e.components[2];if(e.type==="geometry"&&r!=null)return r.hover=t,r.dirty=!0,!0}return!1}function ux(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function fx(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].enableImageCollisions=t)}function Ts(e,t,r){if(r!==void 0)if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){r!==e.components[1].visible&&(e.components[1].visible=r,e.components[1].dirty=!0);let n=e.components[3];return n&&(n.dirty=!0),!0}else{if(e.type==="geometry-group")return e.setVisible(r),!0;if(e.type==="group-container"){if(e.visible!==r)return e.setVisible(r),r===!1&&e.traverse(n=>{if(n instanceof Ie){let i=t.geometry2DMap.get(n.userData.entityId);if(i){let o=i.components[0];o instanceof Ao&&(o.canShow=r)}}}),!0}else if(e.type==="label")return e.components[0].visible=r,!0}return!1}function Tc(e,t,r){if(r!==void 0)if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);(i?.type==="geometry"||i?.type==="model")&&Tc(i,t,r)}return!0}else if(e.type==="group-container"){if(e.opacity!==r){e.setOpacity(r);let n=1;return e.parent instanceof oe&&(n=e.parent.opacity),Cs(e,t,n),!0}}else e instanceof le&&e.components[1].opacity!==r&&(e.components[1].opacity=r,e.components[1].dirty=!0);return!1}function Cs(e,t,r=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let n=r*e.opacity;e.userData.computedOpacity=n;for(let i of e.children)(i instanceof ie&&i.type==="geometry-group"||i instanceof oe&&i.type==="group-container")&&Cs(i,t,n)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n),o;(i?.type==="geometry"||i?.type==="model")&&(o=i.components[1],o.dirty=!0)}}function cx(e,t,r){if(r!==void 0&&e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);i&&Cc(i,r)}}function Cc(e,t){if(e.type==="geometry"){let r=!1,n=e.components[1];if(t?.texture!=null&&n.texture!==t?.texture&&(n.texture=t.texture,r=!0),t?.topTexture!=null&&n.topTexture!==t?.topTexture&&(n.topTexture=t.topTexture,r=!0),r&&e.components[0]instanceof je){let i=e.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),e.components[1].dirty=!0,!0}}return!1}function px(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.opacity!==t){r.opacity=t;let n=e.components[0],i=e.components[3];i&&(i.dirty=!0),n.detached===!1&&(n.detached=!0,n.dirty=!0),r.dirty=!0;let o=e.parentObject3D;return o?.type==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}function hx(e,t){if(t!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==t)return r.altitude=t,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==t)return e.setAltitude(t),!0;if(e.type==="geometry-group"&&e.altitude!==t)return e.setAltitude(t),!0}return!1}function Ic(e,t,r){if(r!==void 0){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);i instanceof le&&Ic(i,t,r)}else if(e.type==="geometry"){let n=e.components[3],i=e.components[1];!n&&r===!0?e.components[3]=new Kr(zn(i.color)):n&&(n.enabled=r,n.dirty=!0)}return!0}return!1}function dx(e,t){if(t!==void 0){let r,n=4;if(e.type==="geometry"?(r=e.components[4],n=4):e.type==="group-container"&&(r=e.components[1],n=1),t===!0&&r==null)return e.components[n]=new en,!0;if(t===!1&&r!=null)return e.components[n]=void 0,!0}return!1}function mx(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.renderOrder!==t){r.renderOrder=t;let n=e.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),n.imageMesh&&(n.imageMesh.renderOrder=t+1),r.dirty=!0,!0}}return!1}function Sc(e,t,r){if(r!=null){if(e.type==="geometry"){let n=e.components[1];n.side!==r&&(n.side=r,n.dirty=!0)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let i=t.geometry3DMap.get(n);i instanceof le&&Sc(i,t,r)}}}function yx(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1],n;if(n=e.components[5],t.borderVisible!==r.borderVisible&&t.borderVisible!=null){if(t.borderVisible===!0){if(n==null){let i=new tn;e.components[5]=i,n=e.components[5],r.borderColor=r.color}n.visible=!0,n.dirty=!0}else t.borderVisible===!1&&n!=null&&(n.visible=!1,n.dirty=!0);r.borderVisible=t.borderVisible}r.borderColor!==t.borderColor&&t.borderColor!=null&&(r.borderColor=t.borderColor,n&&(n.dirty=!0)),r.borderWidth!==t.borderWidth&&t.borderWidth!=null&&(r.borderWidth=t.borderWidth,n&&(n.needsRebuild=!0))}}function gx(e,t,r){let{visible:n,color:i}=r;if(e.type!=="path")return;let o=e.components[0];n!=null&&Ts(e,t,n),i!=null&&bs(e,{color:i}),Object.assign(o,wc(r)),Zn(r)||(o.materialDirty=!0,r.width!=null&&(o.dirty=!0))}function wc(e){return xr(e,Ec)}var Ec=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function vx(e){if(!(e instanceof le&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var Oc=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function xx(e,t,r){Ts(e,t,r.visible);let n=e.components[1],i=xr(r,Oc);"margin"in r&&U.warn("update to margin is not supported atm"),"content"in r&&U.warn("content update is not supported atm");try{ys.parse(i)}catch(o){U.error(o);return}Object.keys(i).length>0&&(Object.assign(n,i),n.dirty=!0)}var Mc=["color","material","opacity","verticalOffset","rotation","position","scale"];function bx(e,t){let r=xr(t,Mc),n=e.components[1],i=e.components[0];Object.keys(r).length>0&&(r.material&&(n.material=r.material),r.opacity!=null&&(n.opacity=r.opacity),r.visible!=null&&(n.visible=r.visible),r.verticalOffset!=null&&(n.verticalOffset=r.verticalOffset),r.color!=null&&(n.color=r.color),r.position!=null&&(i.feature.geometry.coordinates=r.position,i.positionDirty=!0),r.rotation!=null&&(n.rotation=r.rotation),r.scale!=null&&(n.scale=r.scale),n.dirty=!0)}h();h();var Kn=xi(Ns());function ks(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}ks.prototype=Error.prototype;Kn.default.Error=function(e){throw new ks(e)};var ke=Kn.default;var Ch="gray",Qn=new ke.ClipperOffset,te=100;function ei(e,t,r){let{color:n=Ch,opacity:i=1,width:o=1,join:s="round",cap:l="round",height:u=.01,altitude:f=0}=r||{};Array.isArray(i)&&(i=0);let p=[],d=e.geometry.coordinates.every(M=>M[2]!=null);for(let M=0;M<e.geometry.coordinates.length-1;M++){let N=t(e.geometry.coordinates[M][1],e.geometry.coordinates[M][0],e.geometry.coordinates[M][2]),O=t(e.geometry.coordinates[M+1][1],e.geometry.coordinates[M+1][0],e.geometry.coordinates[M+1][2]);p.push([N,O])}let m=p[0][0].y;Qn.AddPaths(p.map(M=>M.map(N=>({X:N.x*te,Y:(d?N.z:N.y)*te}))),s==="round"?ke.JoinType.jsRound:s==="miter"?ke.JoinType.jsMiter:ke.JoinType.jsSquare,l==="round"?ke.EndType.etOpenRound:l==="butt"?ke.EndType.etOpenButt:ke.EndType.etOpenSquare);let x=new ke.PolyTree;Qn.Execute(x,o/2*te);let b=[],C={bevelEnabled:!1,depth:u};for(let M of x.m_AllPolys){let N=new Mi;if(M.IsHole())continue;let O=M.m_polygon;N.moveTo(O[0].X/te,O[0].Y/te),O.slice(1).forEach(W=>N.lineTo(W.X/te,W.Y/te)),N.lineTo(O[0].X/te,O[0].Y/te),N.holes=M.m_Childs.map(W=>{let H=new Oi,qe=W.m_polygon;return H.moveTo(qe[0].X/te,qe[0].Y/te),qe.slice(1).forEach(Be=>H.lineTo(Be.X/te,Be.Y/te)),H.lineTo(qe[0].X/te,qe[0].Y/te),H}),b.push(new Li(N,C))}let w=Er(b);return d&&(w.rotateX(Math.PI/2),w.translate(0,m+u/2,f||0)),w.userData={style:{color:n,opacity:i}},Qn.Clear(),w}h();h();var ue=63710088e-1,Rx={centimeters:ue*100,centimetres:ue*100,degrees:360/(2*Math.PI),feet:ue*3.28084,inches:ue*39.37,kilometers:ue/1e3,kilometres:ue/1e3,meters:ue,metres:ue,miles:ue/1609.344,millimeters:ue*1e3,millimetres:ue*1e3,nauticalmiles:ue/1852,radians:1,yards:ue*1.0936};function Bs(e,t,r={}){let n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function Rs(e,t,r={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return Bs({type:"LineString",coordinates:e},t,r)}function Xs(e,t={}){let r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function Ys(e,t,r={}){return Bs({type:"MultiLineString",coordinates:e},t,r)}h();function an(e){return e.type==="Feature"?e.geometry:e}function Ih(e,t={}){let r=an(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),r.type){case"Polygon":return Sh(r,t);case"MultiPolygon":return wh(r,t);default:throw new Error("invalid poly")}}function Sh(e,t={}){let n=an(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{};return Fs(n,i)}function wh(e,t={}){let n=an(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{},o=[];return n.forEach(s=>{o.push(Fs(s,i))}),Xs(o)}function Fs(e,t){return e.length>1?Ys(e,t):Rs(e[0],t)}var ti=Ih;h();function Gs(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function ri(e){for(let t=e.children.length-1;t>=0;t--)ri(e.children[t]);"geometry"in e&&e.geometry&&e.geometry.dispose(),e.parent&&e.parent.remove(e),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){Gs(t)}):"material"in e&&typeof e.material<"u"&&Gs(e.material)}h();function Ws(e){return e!=null&&e.geometry.type==="Polygon"&&e.geometry.coordinates[0].length>2}function Eh(e,t){let r=e[0]*t[0]+e[1]*t[1],n=Math.sqrt(e[0]*e[0]+e[1]*e[1]),i=Math.sqrt(t[0]*t[0]+t[1]*t[1]);if(n===0||i===0)return 0;let o=r/(n*i),s=Math.max(-1,Math.min(1,o));return Math.acos(s)*(180/Math.PI)}function Oh(e,t=5){if(e.length<3)return e;let r=e.length>3&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1],n=[],i=r?e.length-1:e.length;for(let o=0;o<i;o++){let s=r&&o===0?e[e.length-2]:e[o-1],l=e[o],u=r&&o===e.length-1?e[1]:e[o+1];if(s==null||u==null){n.push(l);continue}let f=[l[0]-s[0],l[1]-s[1]],p=[u[0]-l[0],u[1]-l[1]];Eh(f,p)>t&&n.push(l)}if(r&&n.length>0){let o=n[0],s=n[n.length-1];(o[0]!==s[0]||o[1]!==s[1])&&n.push([o[0],o[1]])}return n}function Vs(e,t=5){return{...e,geometry:{...e.geometry,coordinates:e.geometry.coordinates.map(r=>Oh(r,t))}}}var js=.1,Mh=15,Lh=.25,Hs=class{constructor(t,r){c(this,"rendererState");c(this,"dirty",!1);c(this,"convertTo3DMapPosition");c(this,"colorToMaterialCache",{});this.rendererState=t,this.convertTo3DMapPosition=r}update(){let t,r,n,i;for(let o of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(o),t!=null&&(i=t.components[0],r=t.components[1],t.type==="geometry"&&i instanceof je&&Ws(i.feature))){if(n=t.components[5],n?.dirty){if(n.mesh==null)try{let s=this.buildBorder(i.feature,r,n);i.mesh?.add(s)}catch(s){U.error(s),n.dirty=!1}n.mesh?.children.forEach(s=>{n&&s.material.color.set(r.borderColor)}),n.dirty=!1,n.visible=r.borderVisible}if(n?.needsRebuild){ri(n.mesh);try{let s=this.buildBorder(i.feature,r,n);i.mesh?.add(s)}catch(s){U.error(s)}n.needsRebuild=!1,n.visible=r.borderVisible}}}buildBorder(t,r,n){let i=ti(t),o=Vs(t,Mh),s=ti(o),l=r.borderWidth/2,u=r.borderColor,f=ei(i,this.convertTo3DMapPosition,{width:l,height:l,color:u,cap:"square"}),p=f.clone();p.translate(0,0,r.height);let d;s.geometry.type==="LineString"?d=s.geometry.coordinates:d=s.geometry.coordinates.flat();let m=[];d.pop();for(let O of d||[])try{let W=ei({type:"Feature",geometry:{type:"LineString",coordinates:[[O[0],O[1],0],[O[0],O[1],r.height]]},properties:{}},this.convertTo3DMapPosition,{width:l,height:l,color:u,cap:"butt"});m.push(W)}catch(W){U.warn(W)}let x=Er([f,p,...m]),b=this.colorToMaterialCache[u]?.[0];b==null&&(b=new Ke({color:u}));let C=this.colorToMaterialCache[u]?.[1];C==null&&(C=new Ke({color:u})),this.colorToMaterialCache[u]=[b,C];let w=new fe,M=new Re(x,b),N=new Re(x,C);return w.add(M),w.add(N),N.material.depthWrite=!1,N.material.depthTest=!1,N.material.opacity=Lh,N.material.transparent=!0,w.position.z=r.altitude??0,n.mesh=w,w}destroy(){for(let[t,[r,n]]of Object.entries(this.colorToMaterialCache))r.dispose(),n.dispose();this.colorToMaterialCache={}}};var ni="#ffffff",Ah=.1,ln=.1,Pr,Tr,Cr,ii=class{constructor(t={}){c(this,"initialColor",ni);se(this,Pr,ni);c(this,"initialTopColor");se(this,Tr);c(this,"topTexture");c(this,"texture");se(this,Cr);c(this,"dirty",!0);c(this,"visible",!0);c(this,"opacity",1);c(this,"width",Ah);c(this,"height",ln);c(this,"initialHeight",ln);c(this,"altitude",0);c(this,"join","round");c(this,"cap","round");c(this,"showImage",!0);c(this,"flipImageToFaceCamera",!0);c(this,"enableImageCollisions",!1);c(this,"url");c(this,"side","double");c(this,"renderOrder",0);c(this,"shading");c(this,"bevel");c(this,"borderVisible",!1);c(this,"borderColor");c(this,"borderWidth");this.color=t?.color!==void 0?t.color:this.color,this.initialColor=this.color,this.width=t?.width!==void 0?t.width:this.width,this.opacity=t?.opacity!==void 0?t.opacity:this.opacity,this.visible=t?.visible!==void 0?t.visible:this.visible,this.height=t?.height!==void 0?t.height:this.height,this.initialHeight=this.height,this.altitude=t?.altitude!==void 0?t.altitude:this.altitude,this.join=t?.join!==void 0?t.join:this.join,this.cap=t?.cap!==void 0?t.cap:this.cap,this.topColor=t?.topColor,this.initialTopColor=this.topColor,this.texture=t?.texture,this.topTexture=t?.topTexture,this.showImage=t?.showImage!==void 0?t.showImage:this.showImage,this.flipImageToFaceCamera=t?.flipImageToFaceCamera!==void 0?t.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=t?.url,this.side=t?.side!==void 0?t.side:this.side,this.renderOrder=t?.renderOrder!==void 0?t.renderOrder:this.renderOrder,this.shading=t?.shading,this.bevel=t?.bevel,this.borderVisible=t?.borderVisible!==void 0?t.borderVisible:this.borderVisible,this.borderColor=t?.borderColor!==void 0?t.borderColor:this.color,this.borderWidth=t?.borderWidth!==void 0?t.borderWidth:js,this.enableImageCollisions=t?.enableImageCollisions!==void 0?t.enableImageCollisions:this.enableImageCollisions}set color(t){Lr(t)?q(this,Pr,t):U.warn(`Failed to update color. Invalid color "${t}".`)}get color(){return Y(this,Pr)}set topColor(t){t===void 0||Lr(t)?q(this,Tr,t):U.warn(`Failed to update top color. Invalid color "${t}".`)}get topColor(){return Y(this,Tr)}set hoverColor(t){Lr(t)?q(this,Cr,t):U.warn(`Failed to update hover color. Invalid color "${t}".`)}get hoverColor(){return Y(this,Cr)}};Pr=new WeakMap,Tr=new WeakMap,Cr=new WeakMap;var jt=class extends Ei{constructor(){super(...arguments);c(this,"type","entityBatchedMesh");c(this,"userData",{entities:{}})}},Ir,St,je=class{constructor(t){c(this,"mesh");c(this,"imageMesh");c(this,"textMesh");c(this,"textEntityId");c(this,"type","geometry");c(this,"dirty",!0);c(this,"detached",!1);c(this,"instanceIndex",-1);c(this,"geometry");c(this,"batchedProps");c(this,"material");c(this,"feature");c(this,"currentHeight",ln);c(this,"color",new ce);c(this,"topColor",new ce);c(this,"position",new j);c(this,"altitude",0);se(this,Ir,1);se(this,St);c(this,"texturesVisible",!1);this.feature=t}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,t)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(t){this.mesh&&(this.mesh.renderOrder=t)}setColor(t,r){this.color.set(t),this.topColor.set(r),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){return this.material?.getColor(this.instanceIndex)}get opacity(){return Y(this,Ir)}set opacity(t){if(this.material&&(this.material.opacity=t,this.material.transparent=t<1,this.material.needsUpdate=!0),this.imageMesh){let r=Array.isArray(this.imageMesh.material)?this.imageMesh.material:[this.imageMesh.material];for(let n of r)n.opacity=t,n.needsUpdate=!0}q(this,Ir,t)}get texture(){return this.material?.texture?.image.src}set texture(t){this.material&&(this.material.texture=t)}get textureInstance(){return this.material?.texture}set topTexture(t){this.material&&(this.material.topTexture=t)}get topTexture(){return this.material?.topTexture?.image.src}get topTextureInstance(){return this.material?.topTexture}set blendTexture(t){this.material&&(this.material.blendTexture=t)}get featureBbox(){return Y(this,St)?Y(this,St):(q(this,St,lo(this.feature)),Y(this,St))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}removeSideTexture(){this.material&&this.material.removeSideTexture(this.instanceIndex)}removeTopTexture(){this.material&&this.material.removeTopTexture(this.instanceIndex)}};Ir=new WeakMap,St=new WeakMap;var ie=class extends fe{constructor(r){super();c(this,"visible",!0);c(this,"type","geometry-group");c(this,"components",[]);c(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0});this.userData.entityId=r}setVisible(r){this.visible!==r&&(this.visible=r,this.dispatchEvent({type:"childremoved",child:this}))}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let r;for(let i of this.children)if(!i.userData.detached){r=i;break}return r instanceof jt?Object.values(r.userData.entities)[0]:void 0}setAltitude(r){this.position.z!==r&&(this.position.z=r,this.dispatchEvent({type:"childremoved",child:this}))}get altitude(){return this.position.z}};var oe=class e extends fe{constructor(r){super();c(this,"childrenIds",new Set);c(this,"children",[]);c(this,"type","group-container");c(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});c(this,"components",[]);this.userData.entityId=r}addOccluderFeature(r,n){this.userData.occluderFeature=r,this.userData.occluderId=n,this.userData.occluderDirty=!0}addEntity(r){r instanceof e?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Ne?(this.childrenIds.add(r.id),this.add(r.object3d),this.userData.entities2D.add(r.id),r.positionDirty=!0):r instanceof ie?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof le&&r.object3d&&(this.childrenIds.add(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(r){r instanceof e?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Ne?(this.childrenIds.delete(r.id),this.userData.entities2D.delete(r.id),this.remove(r.object3d)):r instanceof ie?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof le&&r.object3d&&(this.childrenIds.delete(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(r){this.visible!==r&&(this.visible=r,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(r){this.position.z!==r&&(this.position.z=r,this.dispatchEvent({type:"childremoved",child:this}),this.set2DGeometryChildrenPositionDirty())}set2DGeometryChildrenPositionDirty(){this.children.forEach(r=>{r instanceof Ie?r.userData.worldPositionDirty=!0:r instanceof e&&r.set2DGeometryChildrenPositionDirty()})}get altitude(){return this.position.z}setOpacity(r){this.userData.opacity=r}get opacity(){return this.userData.opacity}};h();function Dh(e){let t=e.min,r=e.max,n=new j(t.x,t.y,t.z),i=new j(r.x,t.y,t.z),o=new j(t.x,r.y,t.z),s=new j(r.x,r.y,t.z);return[n,i,o,s]}h();function Us(e,t){let r;return typeof t=="string"||typeof t=="number"?(r=e.geometry2DMap.get(t),r==null&&(r=e.geometry3DMap.get(t))):typeof t?.id=="string"||typeof t?.id=="number"?(r=e.geometry2DMap.get(t.id),r==null&&(r=e.geometry3DMap.get(t.id))):r=t,r}function Nb(e,t,r=[],n=new gn,i){(e.getSystems().renderSystem.threeDdirty||e.getSystems().renderSystem.twoDdirty)&&e.renderSync();let o=Us(e.getInternalState(),t);return zs(o,r,n,i),r}var un=new j;function zs(e,t=[],r=new gn,n){if(e.visible){if(e.isMesh||e.isLine||e.isPoints){let i=e.geometry;if(i.isBufferGeometry){let o=i.attributes.position;for(let s=0;s<o.count;s++)un.fromBufferAttribute(o,s),n!==void 0&&(un.z=n),t.push(un.clone()),r.expandByPoint(un)}}for(let i of e.children)zs(i,t,r,n)}}h();function Nh(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}h();function kh(e,t,r=!1){let n=null,i=0;return function(...o){i++,i===1&&r===!0&&e(...o);let s=()=>{(!r||i>1)&&e(...o),n=null,i=0};clearTimeout(n),n=setTimeout(s,t)}}h();var Bh=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:r,maxTouchPoints:n}=window.navigator,i=/(iphone|ipod|ipad)/i.test(t),o=r==="iPad"||r.indexOf("Mac")===0&&n>0&&!window.MSStream,s=/android/i.test(t);return e={isIpad:o,isMobile:s||i||o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),Zs=Bh.getDeviceType,qs=(()=>{let e,t,r;function n(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let o=e.getContext("webgl")||e.getContext("experimental-webgl");if(!o)return t;try{let s=Zs().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return t=s?o.getParameter(s.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),t}catch{let l=new Error("Failed getting device info");throw l.name="FailedGettingDeviceInfo",l}}function i(){if(!Zs().isWindows)return!1;if(r!==void 0)return r;let o=Rh()?.toLowerCase()??"";return r=o.includes("intel")&&(o.includes("uhd")||o.includes("iris")),r}return{getInfo:n,shouldDisableOffscreenCanvas:i,_setCanvas(o){e=o,t=void 0,r=void 0}}})(),Rh=qs.getInfo,Xh=qs.shouldDisableOffscreenCanvas;h();function xr(e,t){let r={};for(let n=0;n<t.length;n++){let i=t[n];i in e&&(r[i]=e[i])}return r}function Zn(e){return Object.keys(e).length===0}h();var Yh=e=>t=>{if(!t.includes("mappedin")){let r={};for(let n in e){let i=e[n];t.includes("mappedin")||(e[n]=i)}return{url:t,headers:r}}return{url:t,headers:e}};function r0(e,t,r,n){let i=e*(Math.PI/180),o=n/et,s=e+o*180/Math.PI,l=r/et/Math.cos(i),u=t+l*180/Math.PI;return{lat:s,lon:u}}function n0(e,t,r,n){let i=r*(Math.PI/180),o=n*(Math.PI/180),s=e*(Math.PI/180),l=t*(Math.PI/180),u=i-s,f=o-l,p=et*f*Math.cos(s),d=et*u;return{x:p,y:d}}var Fh=(e,t,r,n=!1)=>{let i=e instanceof oe&&e.userData.preloadGeometry,o=n||i&&!e.visible;if(e.children&&(e.visible||i))for(let s of e.children){if(s.visible&&s.type&&!o)if("entities3D"in s.userData&&s.userData?.entities3D&&s instanceof ie){t.add(s.userData.entityId);for(let l of s.userData.entities3D.values())t.add(l)}else(s.type==="group-container"||s.type==="custom-geometry"||s instanceof Pt)&&t.add(s.userData.entityId);s instanceof ie&&s.userData.dirty&&r.add(s.userData.entityId),Fh(s,t,r,o)}return t},Gh=(e,t)=>{if(e.children&&e.visible&&!e.userData?.hidden)for(let r of e.children)r.visible&&r instanceof Ie&&t.add(r.userData.entityId),Gh(r,t);return t};function qn(e,t){for(let r in t)if(!(r==="__proto__"||r==="constructor"||r==="prototype")){if(t[r]==null){e[r]=void 0;continue}Array.isArray(t[r])?e[r]=t[r]:typeof t[r]=="object"?qn(e[r],t[r]):e[r]=t[r]}return e}function i0(e,t,r){let n={translateX:e.x,translateY:e.y,translateZ:e.z,scale:e.meterInMercatorCoordinateUnits()},i=new $e,o=new j(n.scale,-n.scale,n.scale),s=new $e().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(o);return{id:xs,type:"custom",renderingMode:"3d",render:(l,u)=>{i.fromArray(u.defaultProjectionData.mainMatrix),t.projectionMatrix=i.multiply(s),r()}}}function Wh(e){return fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function o0(e){let t=await Wh(e),{access_token:r}=await t.json();return{"x-mappedin-tiles-key":r}}function s0(e,t=0){let r=3735928559^t,n=1103547991^t;for(let i=0,o;i<e.length;i++)o=e.charCodeAt(i),r=Math.imul(r^o,2654435761),n=Math.imul(n^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)}function a0(e,t,r){let n=e*(Math.PI/180)/2,i=t/2;return r*Math.tan(n)/i}function l0(e){return new Ni(new xn(e[0][0],e[0][1]),new xn(e[1][0],e[1][1])).getCenter().toArray()}function u0(e,t){return e<t||t<=12}function f0(e){let t=1;return e.type==="geometry-group"&&e.parent!=null&&e.parent instanceof oe?t=e.parent.userData.computedOpacity:(e.type==="geometry"||e.type==="custom-geometry"||e.type==="model")&&e.parentObject3D!=null&&e.parentObject3D instanceof ie&&e.parentObject3D.parent!=null&&e.parentObject3D.parent instanceof oe&&(t=e.parentObject3D.parent.userData.computedOpacity),t}function c0(e,t,r=1e-10){if(e.length!==t.length)return!1;let n=Math.abs(e[0]-t[0])<r,i=Math.abs(e[1]-t[1])<r;if(e.length===3&&t.length===3){let o=Math.abs(e[2]-t[2])<r;return n&&i&&o}return n&&i}var Vh="maplibre-frustum-culling-hack";function p0(){let e=new Si(.01,.01,.01),t=new Ke({opacity:0,depthWrite:!1,transparent:!0}),r=new Re(e,t);return r.position.copy(new j(0,50,0)),r.frustumCulled=!1,r.name=Vh,r}var Ze=new j,Js=new Se;function h0(e,t,r=new wr){return e.traverse(n=>{if(n instanceof Re){let o=n.geometry.attributes.position;if(t.position.distanceTo(n.position)<t.near)return;for(let l=0;l<o.count;l++)Ze.fromBufferAttribute(o,l),Ze.applyMatrix4(n.matrixWorld),Ze.applyMatrix4(t.matrixWorldInverse),Ze.applyMatrix4(t.projectionMatrix),Ze.z<1&&Ze.z>0&&(Js.set(Ze.x,Ze.y),r.expandByPoint(Js))}}),r}function $s(e,t){let r=t.clientWidth,n=t.clientHeight;return new Se((e.x+1)*r/2,(1-e.y)*n/2)}function d0(e,t,r){let n=document.createElement("div");n.style.position="absolute",n.style.border=`2px solid ${t}`,n.style.pointerEvents="none";let i=$s(new Se(e.min.x,e.min.y),r),o=$s(new Se(e.max.x,e.max.y),r);n.style.left=`${i.x}px`,n.style.top=`${o.y}px`;let s=Math.abs(o.x-i.x),l=Math.abs(o.y-i.y);return n.style.width=`${s}px`,n.style.height=`${l}px`,r.appendChild(n),n}function m0(e,t){let r=0,n=0,i=e.clientWidth,o=e.clientHeight;if(t){let{left:s,top:l,right:u,bottom:f,type:p}=t,d=s??0,m=l??0,x=u??0,b=f??0;p==="portion"?(r=d*i,n=m*o,i=i-r-x*i,o=o-n-b*o):(r=d,n=m,i=i-r-x,o=o-n-b)}return[r,n,i,o].map(s=>Math.max(s,0))}h();var oi=class{constructor(t){c(this,"visible");c(this,"altitude");c(this,"color");c(this,"dirty",!0);c(this,"maxWidth");c(this,"maxHeight");c(this,"hoverByPolygon");c(this,"flipToFaceCamera",Ks.flipToFaceCamera);c(this,"font");c(this,"fillOpacity");c(this,"fontSize");c(this,"margin");c(this,"outlineWidth");c(this,"outlineBlur");c(this,"outlineOffsetX");c(this,"strokeColor");c(this,"strokeOpacity");c(this,"strokeWidth");c(this,"hoverColor");c(this,"outlineOffsetY");c(this,"outlineColor");c(this,"outlineOpacity");t&&Object.assign(this,t)}getState(t=!1){let r={};for(let n in this)!t&&n==="dirty"||this[n]!==void 0&&(r[n]=this[n]);return r}},Ks=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});h();h();var si=class{constructor(t){c(this,"dirty",!0);c(this,"visible",!0);c(this,"opacity",1);c(this,"verticalOffset",0);c(this,"interactive",!1);c(this,"color");c(this,"material");c(this,"rotation");c(this,"scale");t&&Object.assign(this,t)}};h();var Hh=[1,1,1],jh=[0,0,0];export{sa as a,zh as b,U as c,er as d,Xi as e,et as f,fa as g,ca as h,ld as i,Xe as j,ud as k,fd as l,cd as m,pd as n,ha as o,hd as p,vd as q,Cd as r,K as s,Ed as t,tr as u,Pn as v,Lr as w,Yd as x,Fd as y,Hi as z,_a as A,Hd as B,Ta as C,jd as D,He as E,Nl as F,qm as G,so as H,Jm as I,$m as J,Km as K,Qm as L,ey as M,ty as N,ry as O,Xr as P,ay as Q,Bl as R,ly as S,ao as T,y as U,Ve as V,uo as W,Fl as X,_y as Y,S as Z,Po as _,On as $,To as aa,Io as ba,Ry as ca,Ao as da,as as ea,Wn as fa,ag as ga,cs as ha,Ne as ia,Pt as ja,le as ka,nv as la,iv as ma,xs as na,ov as oa,sv as pa,av as qa,lv as ra,Dh as sa,Us as ta,Nb as ua,Nh as va,kh as wa,Xh as xa,Yh as ya,Rr as za,r0 as Aa,n0 as Ba,Fh as Ca,Gh as Da,i0 as Ea,o0 as Fa,s0 as Ga,a0 as Ha,l0 as Ia,u0 as Ja,f0 as Ka,c0 as La,p0 as Ma,h0 as Na,d0 as Oa,m0 as Pa,oi as Qa,Ks as Ra,si as Sa,Hh as Ta,jh as Ua,hs as Va,hc as Wa,Eg as Xa,mc as Ya,ys as Za,kg as _a,$r as $a,Kr as ab,yr as bb,Sv as cb,zn as db,wv as eb,en as fb,vr as gb,Qv as hb,ex as ib,tx as jb,_c as kb,bs as lb,rx as mb,nx as nb,ix as ob,ox as pb,sx as qb,ax as rb,lx as sb,ux as tb,fx as ub,Ts as vb,Tc as wb,cx as xb,Cc as yb,px as zb,hx as Ab,Ic as Bb,dx as Cb,mx as Db,Sc as Eb,yx as Fb,gx as Gb,wc as Hb,vx as Ib,xx as Jb,bx as Kb,ke as Lb,ei as Mb,ri as Nb,Hs as Ob,ni as Pb,ii as Qb,jt as Rb,je as Sb,ie as Tb,oe as Ub};
193
+ //# sourceMappingURL=chunk-AFELLAS6.js.map