diff --git a/assets/CostFunction-6f46faef.js b/assets/CostFunction-6f46faef.js new file mode 100644 index 0000000..34d2528 --- /dev/null +++ b/assets/CostFunction-6f46faef.js @@ -0,0 +1,51 @@ +var ky=Object.defineProperty;var Py=(n,t,e)=>t in n?ky(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var C=(n,t,e)=>(Py(n,typeof t!="symbol"?t+"":t,e),e);import{S as Ne,i as We,s as xe,X as Ay,x as fs,y as Fr,c as Dn,a as En,A as Ir,t as wt,b as Mt,d as Ln,Y as Ig,G as Bg,J as zg,K as Ng,N as Wg,Z as Un,aj as Oy,ak as Cy,D as Ns,l as z,r as No,u as Wo,v as N,al as Dy,T as ds,ac as Ey,U as aa,am as dh,E as yt,an as Vo,ao as jo,ap as Vg,e as I,g as $t,h as Rt,n as F,ab as Ws,$ as jg,f as pt,z as Ge,q as St,w as cn,a3 as Ly,a5 as Ty,Q as Hg,aq as Ry,j as vt,k as Yg,p as Zr,C as Ug,I as gh,V as On,ar as ui,as as Ql,ag as Xg}from"./Layout-e3c78437.js";function $y(n){let t;const e=n[15].default,i=Bg(e,n,n[23],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&8388608)&&zg(i,e,s,s[23],t?Wg(e,s[23],r,null):Ng(s[23]),null)},i(s){t||(wt(i,s),t=!0)},o(s){Mt(i,s),t=!1},d(s){i&&i.d(s)}}}function Fy(n){let t,e,i;function s(o){n[16](o)}let r={id:n[1],type:"fill",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],minzoom:n[9],maxzoom:n[10],hoverCursor:n[11],manageHoverState:n[12],eventsIfTopMost:n[13],interactive:n[14],$$slots:{default:[$y]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new Ay({props:r}),fs.push(()=>Fr(t,"hovered",s)),t.$on("click",n[17]),t.$on("dblclick",n[18]),t.$on("contextmenu",n[19]),t.$on("mouseenter",n[20]),t.$on("mousemove",n[21]),t.$on("mouseleave",n[22]),{c(){Dn(t.$$.fragment)},m(o,a){En(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.minzoom=o[9]),a&1024&&(l.maxzoom=o[10]),a&2048&&(l.hoverCursor=o[11]),a&4096&&(l.manageHoverState=o[12]),a&8192&&(l.eventsIfTopMost=o[13]),a&16384&&(l.interactive=o[14]),a&8388608&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],Ir(()=>e=!1)),t.$set(l)},i(o){i||(wt(t.$$.fragment,o),i=!0)},o(o){Mt(t.$$.fragment,o),i=!1},d(o){Ln(t,o)}}}function Iy(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=Ig("fill")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:y=!1}=t,{hovered:x=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:v=!0}=t;function b(k){x=k,e(0,x)}function _(k){Un.call(this,n,k)}function w(k){Un.call(this,n,k)}function S(k){Un.call(this,n,k)}function M(k){Un.call(this,n,k)}function P(k){Un.call(this,n,k)}function A(k){Un.call(this,n,k)}return n.$$set=k=>{"id"in k&&e(1,r=k.id),"source"in k&&e(2,o=k.source),"sourceLayer"in k&&e(3,a=k.sourceLayer),"beforeId"in k&&e(4,l=k.beforeId),"beforeLayerType"in k&&e(5,c=k.beforeLayerType),"paint"in k&&e(6,h=k.paint),"layout"in k&&e(7,u=k.layout),"filter"in k&&e(8,f=k.filter),"minzoom"in k&&e(9,d=k.minzoom),"maxzoom"in k&&e(10,g=k.maxzoom),"hoverCursor"in k&&e(11,p=k.hoverCursor),"manageHoverState"in k&&e(12,y=k.manageHoverState),"hovered"in k&&e(0,x=k.hovered),"eventsIfTopMost"in k&&e(13,m=k.eventsIfTopMost),"interactive"in k&&e(14,v=k.interactive),"$$scope"in k&&e(23,s=k.$$scope)},[x,r,o,a,l,c,h,u,f,d,g,p,y,m,v,i,b,_,w,S,M,P,A,s]}class By extends Ne{constructor(t){super(),We(this,t,Iy,Fy,xe,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function zy(n,t,e,i,s){let r=!1;n.getSource(t)&&(r=!0,n.removeSource(t));const o=()=>{i(t)&&(n.addSource(t,e),s())};if(r){const a=()=>{t&&(n.getSource(t)?setTimeout(a,1):o())};a()}else o()}function Ny(n,t,e){Oy().then(()=>{let i=Cy(n);if(!i)return;i.getSource(t)===e&&i.removeSource(t)})}function ph(n){let t=n[0],e,i,s=mh(n);return{c(){s.c(),e=Ns()},m(r,o){s.m(r,o),z(r,e,o),i=!0},p(r,o){o&1&&xe(t,t=r[0])?(No(),Mt(s,1,1,yt),Wo(),s=mh(r),s.c(),wt(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(wt(s),i=!0)},o(r){Mt(s),i=!1},d(r){r&&N(e),s.d(r)}}}function mh(n){let t;const e=n[15].default,i=Bg(e,n,n[14],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&16384)&&zg(i,e,s,s[14],t?Wg(e,s[14],r,null):Ng(s[14]),null)},i(s){t||(wt(i,s),t=!0)},o(s){Mt(i,s),t=!1},d(s){i&&i.d(s)}}}function Wy(n){let t,e,i=n[0]&&ph(n);return{c(){i&&i.c(),t=Ns()},m(s,r){i&&i.m(s,r),z(s,t,r),e=!0},p(s,[r]){s[0]?i?(i.p(s,r),r&1&&wt(i,1)):(i=ph(s),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(No(),Mt(i,1,1,()=>{i=null}),Wo())},i(s){e||(wt(i),e=!0)},o(s){Mt(i),e=!1},d(s){s&&N(t),i&&i.d(s)}}}function Vy(n,t,e){let i,s,r,{$$slots:o={},$$scope:a}=t,{id:l=Ig("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:y,self:x}=Dy();ds(n,p,b=>e(13,s=b)),ds(n,y,b=>e(16,r=b)),ds(n,x,b=>e(0,i=b));let m,v=!0;return Ey(()=>{i&&m&&s&&(Ny(p,i,m),aa(x,i=null,i),e(11,m=void 0))}),n.$$set=b=>{"id"in b&&e(4,l=b.id),"data"in b&&e(5,c=b.data),"generateId"in b&&e(6,h=b.generateId),"promoteId"in b&&e(7,u=b.promoteId),"filter"in b&&e(8,f=b.filter),"lineMetrics"in b&&e(9,d=b.lineMetrics),"cluster"in b&&e(10,g=b.cluster),"$$scope"in b&&e(14,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&1024&&aa(y,r=g,r),n.$$.dirty&12273&&s&&i!==l&&(aa(x,i=l,i),zy(s,i,dh({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),b=>s&&b===i,()=>{i&&(e(11,m=s==null?void 0:s.getSource(i)),e(12,v=!0))})),n.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,m=s==null?void 0:s.getSource(l))})),n.$$.dirty&6176&&m&&(v?e(12,v=!1):m.setData(c)),n.$$.dirty&3072&&(m==null||m.setClusterOptions(dh({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[i,p,y,x,l,c,h,u,f,d,g,m,v,s,a,o]}class jy extends Ne{constructor(t){super(),We(this,t,Vy,Wy,xe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}var bh=Object.prototype.toString,Gg=function(t){var e=bh.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&bh.call(t.callee)==="[object Function]"),i},la,yh;function Hy(){if(yh)return la;yh=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,i=Gg,s=Object.prototype.propertyIsEnumerable,r=!s.call({toString:null},"toString"),o=s.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var d=f.constructor;return d&&d.prototype===f},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!c["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),u=function(f){if(typeof window>"u"||!h)return l(f);try{return l(f)}catch{return!1}};n=function(d){var g=d!==null&&typeof d=="object",p=e.call(d)==="[object Function]",y=i(d),x=g&&e.call(d)==="[object String]",m=[];if(!g&&!p&&!y)throw new TypeError("Object.keys called on a non-object");var v=o&&p;if(x&&d.length>0&&!t.call(d,0))for(var b=0;b0)for(var _=0;_"u"||!_t?V:_t(Uint8Array),Rn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?V:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?V:ArrayBuffer,"%ArrayIteratorPrototype%":Xn&&_t?_t([][Symbol.iterator]()):V,"%AsyncFromSyncIteratorPrototype%":V,"%AsyncFunction%":oi,"%AsyncGenerator%":oi,"%AsyncGeneratorFunction%":oi,"%AsyncIteratorPrototype%":oi,"%Atomics%":typeof Atomics>"u"?V:Atomics,"%BigInt%":typeof BigInt>"u"?V:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?V:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?V:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?V:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":f_,"%eval%":eval,"%EvalError%":d_,"%Float32Array%":typeof Float32Array>"u"?V:Float32Array,"%Float64Array%":typeof Float64Array>"u"?V:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?V:FinalizationRegistry,"%Function%":Jg,"%GeneratorFunction%":oi,"%Int8Array%":typeof Int8Array>"u"?V:Int8Array,"%Int16Array%":typeof Int16Array>"u"?V:Int16Array,"%Int32Array%":typeof Int32Array>"u"?V:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xn&&_t?_t(_t([][Symbol.iterator]())):V,"%JSON%":typeof JSON=="object"?JSON:V,"%Map%":typeof Map>"u"?V:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Xn||!_t?V:_t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?V:Promise,"%Proxy%":typeof Proxy>"u"?V:Proxy,"%RangeError%":g_,"%ReferenceError%":p_,"%Reflect%":typeof Reflect>"u"?V:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?V:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Xn||!_t?V:_t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?V:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xn&&_t?_t(""[Symbol.iterator]()):V,"%Symbol%":Xn?Symbol:V,"%SyntaxError%":fi,"%ThrowTypeError%":b_,"%TypedArray%":__,"%TypeError%":li,"%Uint8Array%":typeof Uint8Array>"u"?V:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?V:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?V:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?V:Uint32Array,"%URIError%":m_,"%WeakMap%":typeof WeakMap>"u"?V:WeakMap,"%WeakRef%":typeof WeakRef>"u"?V:WeakRef,"%WeakSet%":typeof WeakSet>"u"?V:WeakSet};if(_t)try{null.error}catch(n){var v_=_t(_t(n));Rn["%Error.prototype%"]=v_}var x_=function n(t){var e;if(t==="%AsyncFunction%")e=ha("async function () {}");else if(t==="%GeneratorFunction%")e=ha("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ha("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&_t&&(e=_t(s.prototype))}return Rn[t]=e,e},Sh={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Vs=nc,Qr=Kg,w_=Vs.call(Function.call,Array.prototype.concat),S_=Vs.call(Function.apply,Array.prototype.splice),Mh=Vs.call(Function.call,String.prototype.replace),to=Vs.call(Function.call,String.prototype.slice),M_=Vs.call(Function.call,RegExp.prototype.exec),k_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P_=/\\(\\)?/g,A_=function(t){var e=to(t,0,1),i=to(t,-1);if(e==="%"&&i!=="%")throw new fi("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new fi("invalid intrinsic syntax, expected opening `%`");var s=[];return Mh(t,k_,function(r,o,a,l){s[s.length]=a?Mh(l,P_,"$1"):o||r}),s},O_=function(t,e){var i=t,s;if(Qr(Sh,i)&&(s=Sh[i],i="%"+s[0]+"%"),Qr(Rn,i)){var r=Rn[i];if(r===oi&&(r=x_(i)),typeof r>"u"&&!e)throw new li("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:r}}throw new fi("intrinsic "+t+" does not exist!")},we=function(t,e){if(typeof t!="string"||t.length===0)throw new li("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new li('"allowMissing" argument must be a boolean');if(M_(/^%?[^%]*%?$/,t)===null)throw new fi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=A_(t),s=i.length>0?i[0]:"",r=O_("%"+s+"%",e),o=r.name,a=r.value,l=!1,c=r.alias;c&&(s=c[0],S_(i,w_([0,1],c)));for(var h=1,u=!0;h=i.length){var p=Tn(a,f);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[f]}else u=Qr(a,f),a=a[f];u&&!l&&(Rn[o]=a)}}return a},fa,kh;function ic(){if(kh)return fa;kh=1;var n=we,t=n("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return fa=t,fa}var C_=we,zr=C_("%Object.getOwnPropertyDescriptor%",!0);if(zr)try{zr([],"length")}catch{zr=null}var sc=zr,Ph=ic(),D_=qg,Gn=hn,Ah=sc,rc=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Gn("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Gn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Gn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Gn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Gn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Gn("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,r=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!Ah&&Ah(t,e);if(Ph)Ph(t,e,{configurable:o===null&&l?l.configurable:!o,enumerable:s===null&&l?l.enumerable:!s,value:i,writable:r===null&&l?l.writable:!r});else if(a||!s&&!r&&!o)t[e]=i;else throw new D_("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},il=ic(),Zg=function(){return!!il};Zg.hasArrayLengthDefineBug=function(){if(!il)return null;try{return il([],"length",{value:1}).length!==1}catch{return!0}};var oc=Zg,E_=tc,L_=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",T_=Object.prototype.toString,R_=Array.prototype.concat,Oh=rc,$_=function(n){return typeof n=="function"&&T_.call(n)==="[object Function]"},Qg=oc(),F_=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!$_(i)||!i())return}Qg?Oh(n,t,e,!0):Oh(n,t,e)},tp=function(n,t){var e=arguments.length>2?arguments[2]:{},i=E_(t);L_&&(i=R_.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s4294967295||z_(e)!==e)throw new Eh("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,r=!0;if("length"in t&&Dh){var o=Dh(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(r=!1)}return(s||r||!i)&&(B_?Ch(t,"length",e,!0,!0):Ch(t,"length",e)),t};(function(n){var t=nc,e=we,i=N_,s=hn,r=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,r),l=ic(),c=e("%Math.max%");n.exports=function(f){if(typeof f!="function")throw new s("a function is required");var d=a(t,o,arguments);return i(d,1+c(0,f.length-(arguments.length-1)),!0)};var h=function(){return a(t,r,arguments)};l?l(n.exports,"apply",{value:h}):n.exports.apply=h})(ep);var wi=ep.exports,np=we,ip=wi,W_=ip(np("String.prototype.indexOf")),ee=function(t,e){var i=np(t,!!e);return typeof i=="function"&&W_(t,".prototype.")>-1?ip(i):i},V_=tc,sp=Ho(),rp=ee,Lh=Object,j_=rp("Array.prototype.push"),Th=rp("Object.prototype.propertyIsEnumerable"),H_=sp?Object.getOwnPropertySymbols:null,op=function(t,e){if(t==null)throw new TypeError("target must be an object");var i=Lh(t);if(arguments.length===1)return i;for(var s=1;s2&&!!arguments[2];return(!i||r0)&&(s0?Rh(t,"name",e,!0,!0):Rh(t,"name",e)),t},l0=a0,c0=hn,h0=Object,hp=l0(function(){if(this==null||this!==h0(this))throw new c0("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),u0=hp,f0=jn.supportsDescriptors,d0=Object.getOwnPropertyDescriptor,up=function(){if(f0&&/a/mig.flags==="gim"){var t=d0(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return u0},g0=jn.supportsDescriptors,p0=up,m0=Object.getOwnPropertyDescriptor,b0=Object.defineProperty,y0=TypeError,$h=Object.getPrototypeOf,_0=/a/,v0=function(){if(!g0||!$h)throw new y0("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=p0(),e=$h(_0),i=m0(e,"flags");return(!i||i.get!==t)&&b0(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},x0=jn,w0=wi,S0=hp,fp=up,M0=v0,dp=w0(fp());x0(dp,{getPolyfill:fp,implementation:S0,shim:M0});var k0=dp,Nr={exports:{}},P0=Ho,Hn=function(){return P0()&&!!Symbol.toStringTag},A0=Hn(),O0=ee,sl=O0("Object.prototype.toString"),Yo=function(t){return A0&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sl(t)==="[object Arguments]"},gp=function(t){return Yo(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sl(t)!=="[object Array]"&&sl(t.callee)==="[object Function]"},C0=function(){return Yo(arguments)}();Yo.isLegacyArguments=gp;var pp=C0?Yo:gp;const D0={},E0=Object.freeze(Object.defineProperty({__proto__:null,default:D0},Symbol.toStringTag,{value:"Module"})),L0=Vo(E0);var ac=typeof Map=="function"&&Map.prototype,ga=Object.getOwnPropertyDescriptor&&ac?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,eo=ac&&ga&&typeof ga.get=="function"?ga.get:null,Fh=ac&&Map.prototype.forEach,lc=typeof Set=="function"&&Set.prototype,pa=Object.getOwnPropertyDescriptor&&lc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,no=lc&&pa&&typeof pa.get=="function"?pa.get:null,Ih=lc&&Set.prototype.forEach,T0=typeof WeakMap=="function"&&WeakMap.prototype,ps=T0?WeakMap.prototype.has:null,R0=typeof WeakSet=="function"&&WeakSet.prototype,ms=R0?WeakSet.prototype.has:null,$0=typeof WeakRef=="function"&&WeakRef.prototype,Bh=$0?WeakRef.prototype.deref:null,F0=Boolean.prototype.valueOf,I0=Object.prototype.toString,B0=Function.prototype.toString,z0=String.prototype.match,cc=String.prototype.slice,qe=String.prototype.replace,N0=String.prototype.toUpperCase,zh=String.prototype.toLowerCase,mp=RegExp.prototype.test,Nh=Array.prototype.concat,pe=Array.prototype.join,W0=Array.prototype.slice,Wh=Math.floor,rl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ma=Object.getOwnPropertySymbols,ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,di=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Et=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===di||"symbol")?Symbol.toStringTag:null,bp=Object.prototype.propertyIsEnumerable,Vh=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function jh(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||mp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var i=n<0?-Wh(-n):Wh(n);if(i!==n){var s=String(i),r=cc.call(t,s.length+1);return qe.call(s,e,"$&_")+"."+qe.call(qe.call(r,/([0-9]{3})/g,"$&_"),/_$/,"")}}return qe.call(t,e,"$&_")}var al=L0,Hh=al.custom,Yh=_p(Hh)?Hh:null,V0=function n(t,e,i,s){var r=e||{};if(Ue(r,"quoteStyle")&&r.quoteStyle!=="single"&&r.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ue(r,"maxStringLength")&&(typeof r.maxStringLength=="number"?r.maxStringLength<0&&r.maxStringLength!==1/0:r.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Ue(r,"customInspect")?r.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ue(r,"indent")&&r.indent!==null&&r.indent!==" "&&!(parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ue(r,"numericSeparator")&&typeof r.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=r.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return xp(t,r);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?jh(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return a?jh(t,c):c}var h=typeof r.depth>"u"?5:r.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof t=="object")return ll(t)?"[Array]":"[Object]";var u=ov(r,i);if(typeof s>"u")s=[];else if(vp(s,t)>=0)return"[Circular]";function f(E,T,O){if(T&&(s=W0.call(s),s.push(T)),O){var L={depth:r.depth};return Ue(r,"quoteStyle")&&(L.quoteStyle=r.quoteStyle),n(E,L,i+1,s)}return n(E,r,i+1,s)}if(typeof t=="function"&&!Uh(t)){var d=J0(t),g=Zs(t,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(g.length>0?" { "+pe.call(g,", ")+" }":"")}if(_p(t)){var p=di?qe.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):ol.call(t);return typeof t=="object"&&!di?Pi(p):p}if(iv(t)){for(var y="<"+zh.call(String(t.nodeName)),x=t.attributes||[],m=0;m",y}if(ll(t)){if(t.length===0)return"[]";var v=Zs(t,f);return u&&!rv(v)?"["+cl(v,u)+"]":"[ "+pe.call(v,", ")+" ]"}if(Y0(t)){var b=Zs(t,f);return!("cause"in Error.prototype)&&"cause"in t&&!bp.call(t,"cause")?"{ ["+String(t)+"] "+pe.call(Nh.call("[cause]: "+f(t.cause),b),", ")+" }":b.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+pe.call(b,", ")+" }"}if(typeof t=="object"&&o){if(Yh&&typeof t[Yh]=="function"&&al)return al(t,{depth:h-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Z0(t)){var _=[];return Fh&&Fh.call(t,function(E,T){_.push(f(T,t,!0)+" => "+f(E,t))}),Xh("Map",eo.call(t),_,u)}if(ev(t)){var w=[];return Ih&&Ih.call(t,function(E){w.push(f(E,t))}),Xh("Set",no.call(t),w,u)}if(Q0(t))return ba("WeakMap");if(nv(t))return ba("WeakSet");if(tv(t))return ba("WeakRef");if(X0(t))return Pi(f(Number(t)));if(q0(t))return Pi(f(rl.call(t)));if(G0(t))return Pi(F0.call(t));if(U0(t))return Pi(f(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===jo)return"{ [object globalThis] }";if(!H0(t)&&!Uh(t)){var S=Zs(t,f),M=Vh?Vh(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",A=!M&&Et&&Object(t)===t&&Et in t?cc.call(un(t),8,-1):P?"Object":"",k=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",D=k+(A||P?"["+pe.call(Nh.call([],A||[],P||[]),": ")+"] ":"");return S.length===0?D+"{}":u?D+"{"+cl(S,u)+"}":D+"{ "+pe.call(S,", ")+" }"}return String(t)};function yp(n,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+n+i}function j0(n){return qe.call(String(n),/"/g,""")}function ll(n){return un(n)==="[object Array]"&&(!Et||!(typeof n=="object"&&Et in n))}function H0(n){return un(n)==="[object Date]"&&(!Et||!(typeof n=="object"&&Et in n))}function Uh(n){return un(n)==="[object RegExp]"&&(!Et||!(typeof n=="object"&&Et in n))}function Y0(n){return un(n)==="[object Error]"&&(!Et||!(typeof n=="object"&&Et in n))}function U0(n){return un(n)==="[object String]"&&(!Et||!(typeof n=="object"&&Et in n))}function X0(n){return un(n)==="[object Number]"&&(!Et||!(typeof n=="object"&&Et in n))}function G0(n){return un(n)==="[object Boolean]"&&(!Et||!(typeof n=="object"&&Et in n))}function _p(n){if(di)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!ol)return!1;try{return ol.call(n),!0}catch{}return!1}function q0(n){if(!n||typeof n!="object"||!rl)return!1;try{return rl.call(n),!0}catch{}return!1}var K0=Object.prototype.hasOwnProperty||function(n){return n in this};function Ue(n,t){return K0.call(n,t)}function un(n){return I0.call(n)}function J0(n){if(n.name)return n.name;var t=z0.call(B0.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function vp(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,i=n.length;et.maxStringLength){var e=n.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return xp(cc.call(n,0,t.maxStringLength),t)+i}var s=qe.call(qe.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,sv);return yp(s,"single",t)}function sv(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+N0.call(t.toString(16))}function Pi(n){return"Object("+n+")"}function ba(n){return n+" { ? }"}function Xh(n,t,e,i){var s=i?cl(e,i):pe.call(e,", ");return n+" ("+t+") {"+s+"}"}function rv(n){for(var t=0;t=0)return!1;return!0}function ov(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=pe.call(Array(n.indent+1)," ");else return null;return{base:e,prev:pe.call(Array(t+1),e)}}function cl(n,t){if(n.length===0)return"";var e=` +`+t.prev+t.base;return e+pe.call(n,","+e)+` +`+t.prev}function Zs(n,t){var e=ll(n),i=[];if(e){i.length=n.length;for(var s=0;s=i)return e+1;var s=eu(t,e);if(s<55296||s>56319)return e+1;var r=eu(t,e+1);return r<56320||r>57343?e+1:e+2},_a=function(t){var e=0;return{next:function(){var s=e>=t.length,r;return s||(r=t[e],e+=1),{done:s,value:r}}}},nu=function(t,e){if(Dv(t)||Jh(t))return _a(t);if(Ev(t)){var i=0;return{next:function(){var r=$v(t,i),o=Rv(t,i,r);return i=r,{done:r>t.length,value:o}}}}if(e&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!Lv&&!Tv)Nr.exports=function(t){if(t!=null)return nu(t,!0)};else{var Fv=Ap,Iv=Cp,iu=re("Map.prototype.forEach",!0),su=re("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var ru=re("Map.prototype.iterator",!0),ou=re("Set.prototype.iterator",!0);var au=re("Map.prototype.@@iterator",!0)||re("Map.prototype._es6-shim iterator_",!0),lu=re("Set.prototype.@@iterator",!0)||re("Set.prototype._es6-shim iterator_",!0),Bv=function(t){if(Fv(t)){if(ru)return Zh(ru(t));if(au)return au(t);if(iu){var e=[];return iu(t,function(s,r){tu(e,[r,s])}),_a(e)}}if(Iv(t)){if(ou)return Zh(ou(t));if(lu)return lu(t);if(su){var i=[];return su(t,function(s){tu(i,s)}),_a(i)}}};Nr.exports=function(t){return Bv(t)||nu(t)}}}var zv=Nr.exports,cu=function(n){return n!==n},Dp=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||cu(t)&&cu(e))},Nv=Dp,Ep=function(){return typeof Object.is=="function"?Object.is:Nv},Wv=Ep,Vv=jn,jv=function(){var t=Wv();return Vv(Object,{is:t},{is:function(){return Object.is!==t}}),t},Hv=jn,Yv=wi,Uv=Dp,Lp=Ep,Xv=jv,Tp=Yv(Lp(),Object);Hv(Tp,{getPolyfill:Lp,implementation:Uv,shim:Xv});var Gv=Tp,qv=wi,Rp=ee,Kv=we,hl=Kv("%ArrayBuffer%",!0),Wr=Rp("ArrayBuffer.prototype.byteLength",!0),Jv=Rp("Object.prototype.toString"),hu=!!hl&&!Wr&&new hl(0).slice,uu=!!hu&&qv(hu),$p=Wr||uu?function(t){if(!t||typeof t!="object")return!1;try{return Wr?Wr(t):uu(t,0),!0}catch{return!1}}:hl?function(t){return Jv(t)==="[object ArrayBuffer]"}:function(t){return!1},Zv=Date.prototype.getDay,Qv=function(t){try{return Zv.call(t),!0}catch{return!1}},tx=Object.prototype.toString,ex="[object Date]",nx=Hn(),ix=function(t){return typeof t!="object"||t===null?!1:nx?Qv(t):tx.call(t)===ex},ul=ee,Fp=Hn(),Ip,Bp,fl,dl;if(Fp){Ip=ul("Object.prototype.hasOwnProperty"),Bp=ul("RegExp.prototype.exec"),fl={};var va=function(){throw fl};dl={toString:va,valueOf:va},typeof Symbol.toPrimitive=="symbol"&&(dl[Symbol.toPrimitive]=va)}var sx=ul("Object.prototype.toString"),rx=Object.getOwnPropertyDescriptor,ox="[object RegExp]",ax=Fp?function(t){if(!t||typeof t!="object")return!1;var e=rx(t,"lastIndex"),i=e&&Ip(e,"value");if(!i)return!1;try{Bp(t,dl)}catch(s){return s===fl}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:sx(t)===ox},lx=ee,fu=lx("SharedArrayBuffer.prototype.byteLength",!0),cx=fu?function(t){if(!t||typeof t!="object")return!1;try{return fu(t),!0}catch{return!1}}:function(t){return!1},hx=Number.prototype.toString,ux=function(t){try{return hx.call(t),!0}catch{return!1}},fx=Object.prototype.toString,dx="[object Number]",gx=Hn(),px=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:gx?ux(t):fx.call(t)===dx},zp=ee,mx=zp("Boolean.prototype.toString"),bx=zp("Object.prototype.toString"),yx=function(t){try{return mx(t),!0}catch{return!1}},_x="[object Boolean]",vx=Hn(),xx=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:vx&&Symbol.toStringTag in t?yx(t):bx(t)===_x},gl={exports:{}},wx=Object.prototype.toString,Sx=ec();if(Sx){var Mx=Symbol.prototype.toString,kx=/^Symbol\(.*\)$/,Px=function(t){return typeof t.valueOf()!="symbol"?!1:kx.test(Mx.call(t))};gl.exports=function(t){if(typeof t=="symbol")return!0;if(wx.call(t)!=="[object Symbol]")return!1;try{return Px(t)}catch{return!1}}}else gl.exports=function(t){return!1};var Ax=gl.exports,pl={exports:{}},du=typeof BigInt<"u"&&BigInt,Ox=function(){return typeof du=="function"&&typeof BigInt=="function"&&typeof du(42)=="bigint"&&typeof BigInt(42)=="bigint"},Cx=Ox();if(Cx){var Dx=BigInt.prototype.valueOf,Ex=function(t){try{return Dx.call(t),!0}catch{}return!1};pl.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:Ex(t)}}else pl.exports=function(t){return!1};var Lx=pl.exports,Tx=kp,Rx=px,$x=xx,Fx=Ax,Ix=Lx,Bx=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(Tx(t))return"String";if(Rx(t))return"Number";if($x(t))return"Boolean";if(Fx(t))return"Symbol";if(Ix(t))return"BigInt"},ro=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,gu=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,oo;ro||(oo=function(t){return!1});var ml=ro?ro.prototype.has:null,xa=gu?gu.prototype.has:null;!oo&&!ml&&(oo=function(t){return!1});var zx=oo||function(t){if(!t||typeof t!="object")return!1;try{if(ml.call(t,ml),xa)try{xa.call(t,xa)}catch{return!0}return t instanceof ro}catch{}return!1},bl={exports:{}},Nx=we,Np=ee,Wx=Nx("%WeakSet%",!0),wa=Np("WeakSet.prototype.has",!0);if(wa){var Sa=Np("WeakMap.prototype.has",!0);bl.exports=function(t){if(!t||typeof t!="object")return!1;try{if(wa(t,wa),Sa)try{Sa(t,Sa)}catch{return!0}return t instanceof Wx}catch{}return!1}}else bl.exports=function(t){return!1};var Vx=bl.exports,jx=Ap,Hx=Cp,Yx=zx,Ux=Vx,Xx=function(t){if(t&&typeof t=="object"){if(jx(t))return"Map";if(Hx(t))return"Set";if(Yx(t))return"WeakMap";if(Ux(t))return"WeakSet"}return!1},Wp=Function.prototype.toString,ai=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,yl,Vr;if(typeof ai=="function"&&typeof Object.defineProperty=="function")try{yl=Object.defineProperty({},"length",{get:function(){throw Vr}}),Vr={},ai(function(){throw 42},null,yl)}catch(n){n!==Vr&&(ai=null)}else ai=null;var Gx=/^\s*class\b/,_l=function(t){try{var e=Wp.call(t);return Gx.test(e)}catch{return!1}},Ma=function(t){try{return _l(t)?!1:(Wp.call(t),!0)}catch{return!1}},jr=Object.prototype.toString,qx="[object Object]",Kx="[object Function]",Jx="[object GeneratorFunction]",Zx="[object HTMLAllCollection]",Qx="[object HTML document.all class]",t1="[object HTMLCollection]",e1=typeof Symbol=="function"&&!!Symbol.toStringTag,n1=!(0 in[,]),vl=function(){return!1};if(typeof document=="object"){var i1=document.all;jr.call(i1)===jr.call(document.all)&&(vl=function(t){if((n1||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=jr.call(t);return(e===Zx||e===Qx||e===t1||e===qx)&&t("")==null}catch{}return!1})}var s1=ai?function(t){if(vl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{ai(t,null,yl)}catch(e){if(e!==Vr)return!1}return!_l(t)&&Ma(t)}:function(t){if(vl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(e1)return Ma(t);if(_l(t))return!1;var e=jr.call(t);return e!==Kx&&e!==Jx&&!/^\[object HTML/.test(e)?!1:Ma(t)},r1=s1,o1=Object.prototype.toString,Vp=Object.prototype.hasOwnProperty,a1=function(t,e,i){for(var s=0,r=t.length;s=3&&(s=i),o1.call(t)==="[object Array]"?a1(t,e,s):typeof t=="string"?l1(t,e,s):c1(t,e,s)},u1=h1,f1=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],ka=f1,d1=typeof globalThis>"u"?jo:globalThis,g1=function(){for(var t=[],e=0;e"u"?jo:globalThis,xl=p1(),pc=gc("String.prototype.slice"),Pa=Object.getPrototypeOf,b1=gc("Array.prototype.indexOf",!0)||function(t,e){for(var i=0;i-1?e:e!=="Object"?!1:_1(t)}return Hr?y1(t):null},x1=ee,bu=x1("ArrayBuffer.prototype.byteLength",!0),w1=$p,S1=function(t){return w1(t)?bu?bu(t):t.byteLength:NaN},Hp=e0,Se=ee,yu=k0,M1=we,gi=zv,k1=Sp,_u=Gv,vu=pp,xu=Mp,wu=$p,Su=ix,Mu=ax,ku=cx,Pu=tc,Au=Bx,Ou=Xx,Cu=v1,Du=S1,Eu=Se("SharedArrayBuffer.prototype.byteLength",!0),Lu=Se("Date.prototype.getTime"),Aa=Object.getPrototypeOf,Tu=Se("Object.prototype.toString"),co=M1("%Set%",!0),wl=Se("Map.prototype.has",!0),ho=Se("Map.prototype.get",!0),Ru=Se("Map.prototype.size",!0),uo=Se("Set.prototype.add",!0),Yp=Se("Set.prototype.delete",!0),fo=Se("Set.prototype.has",!0),Yr=Se("Set.prototype.size",!0);function $u(n,t,e,i){for(var s=gi(n),r;(r=s.next())&&!r.done;)if(ce(t,r.value,e,i))return Yp(n,r.value),!0;return!1}function Up(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function P1(n,t,e,i,s,r){var o=Up(e);if(o!=null)return o;var a=ho(t,o),l=Hp({},s,{strict:!1});return typeof a>"u"&&!wl(t,o)||!ce(i,a,l,r)?!1:!wl(n,o)&&ce(i,a,l,r)}function A1(n,t,e){var i=Up(e);return i??(fo(t,i)&&!fo(n,i))}function Fu(n,t,e,i,s,r){for(var o=gi(n),a,l;(a=o.next())&&!a.done;)if(l=a.value,ce(e,l,s,r)&&ce(i,ho(t,l),s,r))return Yp(n,l),!0;return!1}function ce(n,t,e,i){var s=e||{};if(s.strict?_u(n,t):n===t)return!0;var r=Au(n),o=Au(t);if(r!==o)return!1;if(!n||!t||typeof n!="object"&&typeof t!="object")return s.strict?_u(n,t):n==t;var a=i.has(n),l=i.has(t),c;if(a&&l){if(i.get(n)===i.get(t))return!0}else c={};return a||i.set(n,c),l||i.set(t,c),D1(n,t,s,i)}function Iu(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function O1(n,t,e,i){if(Yr(n)!==Yr(t))return!1;for(var s=gi(n),r=gi(t),o,a,l;(o=s.next())&&!o.done;)if(o.value&&typeof o.value=="object")l||(l=new co),uo(l,o.value);else if(!fo(t,o.value)){if(e.strict||!A1(n,t,o.value))return!1;l||(l=new co),uo(l,o.value)}if(l){for(;(a=r.next())&&!a.done;)if(a.value&&typeof a.value=="object"){if(!$u(l,a.value,e.strict,i))return!1}else if(!e.strict&&!fo(n,a.value)&&!$u(l,a.value,e.strict,i))return!1;return Yr(l)===0}return!0}function C1(n,t,e,i){if(Ru(n)!==Ru(t))return!1;for(var s=gi(n),r=gi(t),o,a,l,c,h,u;(o=s.next())&&!o.done;)if(c=o.value[0],h=o.value[1],c&&typeof c=="object")l||(l=new co),uo(l,c);else if(u=ho(t,c),typeof u>"u"&&!wl(t,c)||!ce(h,u,e,i)){if(e.strict||!P1(n,t,c,h,e,i))return!1;l||(l=new co),uo(l,c)}if(l){for(;(a=r.next())&&!a.done;)if(c=a.value[0],u=a.value[1],c&&typeof c=="object"){if(!Fu(l,n,c,u,e,i))return!1}else if(!e.strict&&(!n.has(c)||!ce(ho(n,c),u,e,i))&&!Fu(l,n,c,u,Hp({},e,{strict:!1}),i))return!1;return Yr(l)===0}return!0}function D1(n,t,e,i){var s,r;if(typeof n!=typeof t||n==null||t==null||Tu(n)!==Tu(t)||vu(n)!==vu(t))return!1;var o=xu(n),a=xu(t);if(o!==a)return!1;var l=n instanceof Error,c=t instanceof Error;if(l!==c||(l||c)&&(n.name!==t.name||n.message!==t.message))return!1;var h=Mu(n),u=Mu(t);if(h!==u||(h||u)&&(n.source!==t.source||yu(n)!==yu(t)))return!1;var f=Su(n),d=Su(t);if(f!==d||(f||d)&&Lu(n)!==Lu(t)||e.strict&&Aa&&Aa(n)!==Aa(t))return!1;var g=Cu(n),p=Cu(t);if(g!==p)return!1;if(g||p){if(n.length!==t.length)return!1;for(s=0;s=0;s--)if(w[s]!=S[s])return!1;for(s=w.length-1;s>=0;s--)if(r=w[s],!ce(n[r],t[r],e,i))return!1;var M=Ou(n),P=Ou(t);return M!==P?!1:M==="Set"||P==="Set"?O1(n,t,e,i):M==="Map"?C1(n,t,e,i):!0}var E1=function(t,e,i){return ce(t,e,i,k1())};const L1=Vg(E1);var T1=Object.defineProperty,Z=(n,t)=>T1(n,"name",{value:t,configurable:!0}),R1=class{constructor(t){this.direction=!1,this.compareProperties=!0;var e,i,s;this.precision=10**-((e=t==null?void 0:t.precision)!=null?e:17),this.direction=(i=t==null?void 0:t.direction)!=null?i:!1,this.compareProperties=(s=t==null?void 0:t.compareProperties)!=null?s:!0}compare(t,e){if(t.type!==e.type||!Qi(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){const i=Sl(t),s=Sl(e);return i.every(r=>s.some(o=>this.compare(r,o)))}}return!1}compareCoord(t,e){return t.length===e.length&&t.every((i,s)=>Math.abs(i-e[s])=0&&(i=[].concat(t.slice(s,t.length),t.slice(1,s+1))),i}comparePath(t,e){return t.every((i,s)=>this.compareCoord(i,e[s]))}comparePolygon(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){const i=t.coordinates.slice(1,t.coordinates.length),s=e.coordinates.slice(1,e.coordinates.length);return i.every(r=>s.some(o=>this.compareLine(r,o,1,!0)))}return!1}compareGeometryCollection(t,e){return Qi(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((i,s)=>this.compare(i,e.geometries[s]))}compareFeature(t,e){return t.id===e.id&&(this.compareProperties?L1(t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return Qi(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((i,s)=>this.compare(i,e.features[s]))}compareBBox(t,e){return!t.bbox&&!e.bbox||(t.bbox&&e.bbox?this.compareCoord(t.bbox,e.bbox):!1)}};Z(R1,"GeojsonEquality");function Qi(n,t){return n.coordinates?n.coordinates.length===t.coordinates.length:n.length===t.length}Z(Qi,"sameLength");function Sl(n){return n.coordinates.map(t=>({type:n.type.replace("Multi",""),coordinates:t}))}Z(Sl,"explode");var Wt=63710088e-1,Xp={centimeters:Wt*100,centimetres:Wt*100,degrees:360/(2*Math.PI),feet:Wt*3.28084,inches:Wt*39.37,kilometers:Wt/1e3,kilometres:Wt/1e3,meters:Wt,metres:Wt,miles:Wt/1609.344,millimeters:Wt*1e3,millimetres:Wt*1e3,nauticalmiles:Wt/1852,radians:1,yards:Wt*1.0936},Bu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ve(n,t,e={}){const i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}Z(ve,"feature");function $1(n,t,e={}){switch(n){case"Point":return Ee(t).geometry;case"LineString":return Fe(t).geometry;case"Polygon":return mc(t).geometry;case"MultiPoint":return qp(t).geometry;case"MultiLineString":return Gp(t).geometry;case"MultiPolygon":return Kp(t).geometry;default:throw new Error(n+" is invalid")}}Z($1,"geometry");function Ee(n,t,e={}){if(!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!go(n[0])||!go(n[1]))throw new Error("coordinates must contain numbers");return ve({type:"Point",coordinates:n},t,e)}Z(Ee,"point");function F1(n,t,e={}){return Uo(n.map(i=>Ee(i,t)),e)}Z(F1,"points");function mc(n,t,e={}){for(const s of n){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let r=0;rmc(i,t)),e)}Z(I1,"polygons");function Fe(n,t,e={}){if(n.length<2)throw new Error("coordinates must be an array of two or more positions");return ve({type:"LineString",coordinates:n},t,e)}Z(Fe,"lineString");function B1(n,t,e={}){return Uo(n.map(i=>Fe(i,t)),e)}Z(B1,"lineStrings");function Uo(n,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Z(Uo,"featureCollection");function Gp(n,t,e={}){return ve({type:"MultiLineString",coordinates:n},t,e)}Z(Gp,"multiLineString");function qp(n,t,e={}){return ve({type:"MultiPoint",coordinates:n},t,e)}Z(qp,"multiPoint");function Kp(n,t,e={}){return ve({type:"MultiPolygon",coordinates:n},t,e)}Z(Kp,"multiPolygon");function z1(n,t,e={}){return ve({type:"GeometryCollection",geometries:n},t,e)}Z(z1,"geometryCollection");function N1(n,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const e=Math.pow(10,t||0);return Math.round(n*e)/e}Z(N1,"round");function Jp(n,t="kilometers"){const e=Xp[t];if(!e)throw new Error(t+" units is invalid");return n*e}Z(Jp,"radiansToLength");function bc(n,t="kilometers"){const e=Xp[t];if(!e)throw new Error(t+" units is invalid");return n/e}Z(bc,"lengthToRadians");function W1(n,t){return Zp(bc(n,t))}Z(W1,"lengthToDegrees");function V1(n){let t=n%360;return t<0&&(t+=360),t}Z(V1,"bearingToAzimuth");function Zp(n){return n%(2*Math.PI)*180/Math.PI}Z(Zp,"radiansToDegrees");function j1(n){return n%360*Math.PI/180}Z(j1,"degreesToRadians");function H1(n,t="kilometers",e="kilometers"){if(!(n>=0))throw new Error("length must be a positive number");return Jp(bc(n,t),e)}Z(H1,"convertLength");function Y1(n,t="meters",e="kilometers"){if(!(n>=0))throw new Error("area must be a positive number");const i=Bu[t];if(!i)throw new Error("invalid original units");const s=Bu[e];if(!s)throw new Error("invalid final units");return n/i*s}Z(Y1,"convertArea");function go(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Z(go,"isNumber");function yc(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}Z(yc,"isObject");function U1(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(t=>{if(!go(t))throw new Error("bbox must only contain numbers")})}Z(U1,"validateBBox");function X1(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Z(X1,"validateId");var G1=Object.defineProperty,Pt=(n,t)=>G1(n,"name",{value:t,configurable:!0});function Mi(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=Fe([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}Pt(em,"segmentEach");function ew(n,t,e){var i=e,s=!1;return em(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}Pt(ew,"segmentReduce");function nm(n,t){if(!n)throw new Error("geojson is required");Xo(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;arw(n,"name",{value:t,configurable:!0});function vc(n,t={}){if(n.bbox!=null&&t.recompute!==!0)return n.bbox;const e=[1/0,1/0,-1/0,-1/0];return Mi(n,i=>{e[0]>i[0]&&(e[0]=i[0]),e[1]>i[1]&&(e[1]=i[1]),e[2]{"loading"in s&&e(0,i=s.loading)},[i]}class bT extends Ne{constructor(t){super(),We(this,t,hw,cw,xe,{loading:0})}}var At=63710088e-1,xc={centimeters:At*100,centimetres:At*100,degrees:At/111325,feet:At*3.28084,inches:At*39.37,kilometers:At/1e3,kilometres:At/1e3,meters:At,metres:At,miles:At/1609.344,millimeters:At*1e3,millimetres:At*1e3,nauticalmiles:At/1852,radians:1,yards:At*1.0936},uw={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/At,yards:1.0936133},Ml={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Zt(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}function fw(n,t,e){switch(n){case"Point":return Bt(t).geometry;case"LineString":return Kt(t).geometry;case"Polygon":return wc(t).geometry;case"MultiPoint":return sm(t).geometry;case"MultiLineString":return im(t).geometry;case"MultiPolygon":return rm(t).geometry;default:throw new Error(n+" is invalid")}}function Bt(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!po(n[0])||!po(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return Zt(i,t,e)}function dw(n,t,e){return e===void 0&&(e={}),zn(n.map(function(i){return Bt(i,t)}),e)}function wc(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}function Sc(n,t){t===void 0&&(t="kilometers");var e=xc[t];if(!e)throw new Error(t+" units is invalid");return n*e}function Go(n,t){t===void 0&&(t="kilometers");var e=xc[t];if(!e)throw new Error(t+" units is invalid");return n/e}function yw(n,t){return Os(Go(n,t))}function _w(n){var t=n%360;return t<0&&(t+=360),t}function Os(n){var t=n%(2*Math.PI);return t*180/Math.PI}function Jt(n){var t=n%360;return t*Math.PI/180}function vw(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return Sc(Go(n,t),e)}function xw(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var i=Ml[t];if(!i)throw new Error("invalid original units");var s=Ml[e];if(!s)throw new Error("invalid final units");return n/i*s}function po(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Mc(n){return!!n&&n.constructor===Object}function ww(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!po(t))throw new Error("bbox must only contain numbers")})}function Sw(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}const Mw=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ml,bearingToAzimuth:_w,convertArea:xw,convertLength:vw,degreesToRadians:Jt,earthRadius:At,factors:xc,feature:Zt,featureCollection:zn,geometry:fw,geometryCollection:mw,isNumber:po,isObject:Mc,lengthToDegrees:yw,lengthToRadians:Go,lineString:Kt,lineStrings:pw,multiLineString:im,multiPoint:sm,multiPolygon:rm,point:Bt,points:dw,polygon:wc,polygons:gw,radiansToDegrees:Os,radiansToLength:Sc,round:bw,unitsFactors:uw,validateBBox:ww,validateId:Sw},Symbol.toStringTag,{value:"Module"}));function Cs(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function pi(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function om(n,t,e){if(e===void 0&&(e={}),e.final===!0)return kw(n,t);var i=Cs(n),s=Cs(t),r=Jt(i[0]),o=Jt(s[0]),a=Jt(i[1]),l=Jt(s[1]),c=Math.sin(o-r)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(o-r);return Os(Math.atan2(c,h))}function kw(n,t){var e=om(t,n);return e=(e+180)%360,e}function Ci(n,t,e){e===void 0&&(e={});var i=Cs(n),s=Cs(t),r=Jt(s[1]-i[1]),o=Jt(s[0]-i[0]),a=Jt(i[1]),l=Jt(s[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(a)*Math.cos(l);return Sc(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),e.units)}function Nu(n,t,e,i){i===void 0&&(i={});var s=Cs(n),r=Jt(s[0]),o=Jt(s[1]),a=Jt(e),l=Go(t,i.units),c=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(a)),h=r+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(c)),u=Os(h),f=Os(c);return Bt([u,f],i.properties)}function js(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=Kt([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}function Lw(n,t,e){var i=e,s=!1;return lm(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}function cm(n,t){if(!n)throw new Error("geojson is required");ki(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;as?e:s,c=i>r?i:r;return[o,a,l,c]}var Pc={exports:{}},hm={exports:{}};(function(n,t){(function(e,i){n.exports=i()})(jo,function(){function e(m,v,b,_,w){(function S(M,P,A,k,D){for(;k>A;){if(k-A>600){var E=k-A+1,T=P-A+1,O=Math.log(E),L=.5*Math.exp(2*O/3),R=.5*Math.sqrt(O*L*(E-L)/E)*(T-E/2<0?-1:1),Q=Math.max(A,Math.floor(P-T*L/E+R)),et=Math.min(k,Math.floor(P+(E-T)*L/E+R));S(M,P,Q,et,D)}var gt=M[P],Tt=A,it=k;for(i(M,A,P),D(M[k],gt)>0&&i(M,A,k);Tt0;)it--}D(M[A],gt)===0?i(M,A,it):i(M,++it,k),it<=P&&(A=it+1),P<=it&&(k=it-1)}})(m,v,b||0,_||m.length-1,w||s)}function i(m,v,b){var _=m[v];m[v]=m[b],m[b]=_}function s(m,v){return mv?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(m,v,b){if(!b)return v.indexOf(m);for(var _=0;_=m.minX&&v.maxY>=m.minY}function y(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function x(m,v,b,_,w){for(var S=[v,b];S.length;)if(!((b=S.pop())-(v=S.pop())<=_)){var M=v+Math.ceil((b-v)/_/2)*_;e(m,M,v,b,w),S.push(v,M,M,b)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var v=this.data,b=[];if(!p(m,v))return b;for(var _=this.toBBox,w=[];v;){for(var S=0;S=0&&w[v].children.length>this._maxEntries;)this._split(w,v),v--;this._adjustParentBBoxes(_,w,v)},r.prototype._split=function(m,v){var b=m[v],_=b.children.length,w=this._minEntries;this._chooseSplitAxis(b,w,_);var S=this._chooseSplitIndex(b,w,_),M=y(b.children.splice(S,b.children.length-S));M.height=b.height,M.leaf=b.leaf,a(b,this.toBBox),a(M,this.toBBox),v?m[v-1].children.push(M):this._splitRoot(b,M)},r.prototype._splitRoot=function(m,v){this.data=y([m,v]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,v,b){for(var _,w,S,M,P,A,k,D=1/0,E=1/0,T=v;T<=b-v;T++){var O=l(m,0,T,this.toBBox),L=l(m,T,b,this.toBBox),R=(w=O,S=L,M=void 0,P=void 0,A=void 0,k=void 0,M=Math.max(w.minX,S.minX),P=Math.max(w.minY,S.minY),A=Math.min(w.maxX,S.maxX),k=Math.min(w.maxY,S.maxY),Math.max(0,A-M)*Math.max(0,k-P)),Q=f(O)+f(L);R=v;D--){var E=m.children[D];c(M,m.leaf?w(E):E),P+=d(M)}return P},r.prototype._adjustParentBBoxes=function(m,v,b){for(var _=b;_>=0;_--)c(v[_],m)},r.prototype._condense=function(m){for(var v=m.length-1,b=void 0;v>=0;v--)m[v].children.length===0?v>0?(b=m[v-1].children).splice(b.indexOf(m[v]),1):this.clear():a(m[v],this.toBBox)},r})})(hm);var Nw=hm.exports;const Ww=Vo(Mw),Vw=Vo(Fw),jw=Vo(lw);var ue=Nw,um=Ww,fm=Vw,qn=jw.default,Hw=fm.featureEach;fm.coordEach;um.polygon;var Vu=um.featureCollection;function dm(n){var t=new ue(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:qn(e),ue.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:qn(s),i.push(s)}):Hw(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:qn(s),i.push(s)}),ue.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:qn(e),ue.prototype.remove.call(this,e,i)},t.clear=function(){return ue.prototype.clear.call(this)},t.search=function(e){var i=ue.prototype.search.call(this,this.toBBox(e));return Vu(i)},t.collides=function(e){return ue.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ue.prototype.all.call(this);return Vu(e)},t.toJSON=function(){return ue.prototype.toJSON.call(this)},t.fromJSON=function(e){return ue.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=qn(e);else if(e.type==="FeatureCollection")i=qn(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Pc.exports=dm;Pc.exports.default=dm;var Yw=Pc.exports;const Uw=Vg(Yw);function Xw(n,t){var e={},i=[];if(n.type==="LineString"&&(n=Zt(n)),t.type==="LineString"&&(t=Zt(t)),n.type==="Feature"&&t.type==="Feature"&&n.geometry!==null&&t.geometry!==null&&n.geometry.type==="LineString"&&t.geometry.type==="LineString"&&n.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var s=ju(n,t);return s&&i.push(s),zn(i)}var r=Uw();return r.load(Wu(t)),mo(Wu(n),function(o){mo(r.search(o),function(a){var l=ju(o,a);if(l){var c=pi(l).join(",");e[c]||(e[c]=!0,i.push(l))}})}),zn(i)}function ju(n,t){var e=pi(n),i=pi(t);if(e.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var s=e[0][0],r=e[0][1],o=e[1][0],a=e[1][1],l=i[0][0],c=i[0][1],h=i[1][0],u=i[1][1],f=(u-c)*(o-s)-(h-l)*(a-r),d=(h-l)*(r-c)-(u-c)*(s-l),g=(o-s)*(r-c)-(a-r)*(s-l);if(f===0)return null;var p=d/f,y=g/f;if(p>=0&&p<=1&&y>=0&&y<=1){var x=s+p*(o-s),m=r+p*(a-r);return Bt([x,m])}return null}function Gw(n,t,e){e===void 0&&(e={});var i=Bt([1/0,1/0],{dist:1/0}),s=0;return ki(n,function(r){for(var o=pi(r),a=0;a0&&(y=p.features[0],y.properties.dist=Ci(t,y,e),y.properties.location=s+Ci(l,y,e)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let e=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let s of this.points)s[0]-=e,s[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});C(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let e=[];if(Hu(this.points).forEach((i,s)=>{e.push([s+1,Gw(i,this.cursor).properties.dist])}),e.sort((i,s)=>i[1]-s[1]),e.length>0){let i=e[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});C(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=Oa(t.lngLat.toArray()),this.onClick(t),this.finish())});C(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});C(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});C(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});C(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersSuccess)e(t);else for(let e of this.eventListenersFailure)e();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((s,r)=>{let o=Oa(s);o.properties.hover=this.hover==r,o.properties.idx=r,t.features.push(o)}),t.features=t.features.concat(Hu(this.points));let e=this.polygonFeature();e&&(e.properties.hover=this.hover=="polygon",t.features.push(e)),pm.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,mm.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersUpdated)e(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let e of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(e.geometry.type=="Polygon"){this.hover="polygon";break}else if(e.geometry.type=="Point"&&Object.hasOwn(e.properties,"idx")){this.hover=e.properties.idx;break}this.hover==null&&(this.cursor=Oa(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(gm),e=[JSON.parse(JSON.stringify(t))];return e[0].push(JSON.parse(JSON.stringify(e[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:e},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Zw&&this.previousStates.shift()}}function Hu(n){let t=[];for(let e=0;e=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[n[n.length-1],n[0]]},properties:{}}),t}function tS(n){let t,e,i;return{c(){t=$t("Undo ("),e=$t(n[1]),i=$t(")")},m(s,r){z(s,t,r),z(s,e,r),z(s,i,r)},p(s,r){r&2&&Ws(e,s[1])},d(s){s&&(N(t),N(e),N(i))}}}function eS(n){let t;return{c(){t=$t("Undo")},m(e,i){z(e,t,i)},p:yt,d(e){e&&N(t)}}}function nS(n){let t,e,i,s,r,o,a,l,c,h,u;function f(p,y){return p[1]==0?eS:tS}let d=f(n),g=d(n);return{c(){t=I("div"),e=I("button"),e.textContent="Finish",i=pt(),s=I("button"),s.textContent="Cancel",r=pt(),o=I("button"),g.c(),l=pt(),c=I("ul"),c.innerHTML=`
  • Click + the map to add a vertex
  • Click + a vertex to delete it
  • Drag + a vertex or the polygon to move it
  • Press Control+Z + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `,o.disabled=a=n[1]==0,Ge(t,"display","flex"),Ge(t,"justify-content","space-between")},m(p,y){z(p,t,y),F(t,e),F(t,i),F(t,s),F(t,r),F(t,o),g.m(o,null),z(p,l,y),z(p,c,y),h||(u=[St(e,"click",n[2]),St(s,"click",n[3]),St(o,"click",n[4])],h=!0)},p(p,[y]){d===(d=f(p))&&g?g.p(p,y):(g.d(1),g=d(p),g&&(g.c(),g.m(o,null))),y&2&&a!==(a=p[1]==0)&&(o.disabled=a)},i:yt,o:yt,d(p){p&&(N(t),N(l),N(c)),g.d(),h=!1,cn(u)}}}function iS(n,t,e){let i;ds(n,mm,l=>e(1,i=l));let{polygonTool:s}=t;const r=()=>s.finish(),o=()=>s.cancel(),a=()=>s.undo();return n.$$set=l=>{"polygonTool"in l&&e(0,s=l.polygonTool)},[s,i,r,o,a]}class sS extends Ne{constructor(t){super(),We(this,t,iS,nS,xe,{polygonTool:0})}}function rS(n){let t,e,i,s,r,o;return t=new By({props:{id:"edit-polygon-fill",filter:qw,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),i=new Ly({props:{id:"edit-polygon-lines",filter:Kw,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),r=new Ty({props:{id:"edit-polygon-vertices",filter:Jw,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Dn(t.$$.fragment),e=pt(),Dn(i.$$.fragment),s=pt(),Dn(r.$$.fragment)},m(a,l){En(t,a,l),z(a,e,l),En(i,a,l),z(a,s,l),En(r,a,l),o=!0},p:yt,i(a){o||(wt(t.$$.fragment,a),wt(i.$$.fragment,a),wt(r.$$.fragment,a),o=!0)},o(a){Mt(t.$$.fragment,a),Mt(i.$$.fragment,a),Mt(r.$$.fragment,a),o=!1},d(a){a&&(N(e),N(s)),Ln(t,a),Ln(i,a),Ln(r,a)}}}function oS(n){let t,e;return t=new jy({props:{data:n[0],$$slots:{default:[rS]},$$scope:{ctx:n}}}),{c(){Dn(t.$$.fragment)},m(i,s){En(t,i,s),e=!0},p(i,[s]){const r={};s&1&&(r.data=i[0]),s&2&&(r.$$scope={dirty:s,ctx:i}),t.$set(r)},i(i){e||(wt(t.$$.fragment,i),e=!0)},o(i){Mt(t.$$.fragment,i),e=!1},d(i){Ln(t,i)}}}function aS(n,t,e){let i;return ds(n,pm,s=>e(0,i=s)),[i]}class yT extends Ne{constructor(t){super(),We(this,t,aS,oS,xe,{})}}function lS(n){let t,e,i,s,r,o,a;return{c(){t=I("button"),t.textContent="Import current view",e=pt(),i=I("i"),i.textContent="or...",s=pt(),r=I("button"),r.textContent="Draw an area to import on the map",Rt(t,"type","button"),Rt(r,"type","button")},m(l,c){z(l,t,c),z(l,e,c),z(l,i,c),z(l,s,c),z(l,r,c),o||(a=[St(t,"click",n[1]),St(r,"click",n[2])],o=!0)},p:yt,i:yt,o:yt,d(l){l&&(N(t),N(e),N(i),N(s),N(r)),o=!1,cn(a)}}}function cS(n){let t,e;return t=new sS({props:{polygonTool:n[0]}}),{c(){Dn(t.$$.fragment)},m(i,s){En(t,i,s),e=!0},p(i,s){const r={};s&1&&(r.polygonTool=i[0]),t.$set(r)},i(i){e||(wt(t.$$.fragment,i),e=!0)},o(i){Mt(t.$$.fragment,i),e=!1},d(i){Ln(t,i)}}}function hS(n){let t,e,i,s;const r=[cS,lS],o=[];function a(l,c){return l[0]?0:1}return t=a(n),e=o[t]=r[t](n),{c(){e.c(),i=Ns()},m(l,c){o[t].m(l,c),z(l,i,c),s=!0},p(l,[c]){let h=t;t=a(l),t===h?o[t].p(l,c):(No(),Mt(o[h],1,1,()=>{o[h]=null}),Wo(),e=o[t],e?e.p(l,c):(e=o[t]=r[t](l),e.c()),wt(e,1),e.m(i.parentNode,i))},i(l){s||(wt(e),s=!0)},o(l){Mt(e),s=!1},d(l){l&&N(i),o[t].d(l)}}}function Di(n){return[n.lng,n.lat]}function uS(n,t,e){let{map:i}=t;const s=Hg();let r=null;async function o(h){try{s("loading","Loading from Overpass");let f=await(await fetch(Ry(h))).text();s("gotXml",f)}catch(u){s("error",u.toString())}}function a(){let h=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Di(h.getSouthWest()),Di(h.getNorthWest()),Di(h.getNorthEast()),Di(h.getSouthEast()),Di(h.getSouthWest())]],type:"Polygon"}}}async function l(){if(i){if(i.getZoom()<13){s("error","Zoom in more to import");return}await o(a())}}function c(){i&&(e(0,r=new Qw(i)),r.startNew(),r.addEventListenerSuccess(async h=>{e(0,r=null),await o(h)}),r.addEventListenerFailure(()=>{e(0,r=null)}))}return n.$$set=h=>{"map"in h&&e(3,i=h.map)},[r,l,c,i]}class _T extends Ne{constructor(t){super(),We(this,t,uS,hS,xe,{map:3})}}let W;const bm=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&bm.decode();let ts=null;function bs(){return(ts===null||ts.byteLength===0)&&(ts=new Uint8Array(W.memory.buffer)),ts}function An(n,t){return n=n>>>0,bm.decode(bs().subarray(n,n+t))}const $e=new Array(128).fill(void 0);$e.push(void 0,null,!0,!1);let ys=$e.length;function G(n){ys===$e.length&&$e.push($e.length+1);const t=ys;return ys=$e[t],$e[t]=n,t}function $(n){return $e[n]}let $n=0;const Ur=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},fS=typeof Ur.encodeInto=="function"?function(n,t){return Ur.encodeInto(n,t)}:function(n,t){const e=Ur.encode(n);return t.set(e),{read:n.length,written:e.length}};function Ca(n,t,e){if(e===void 0){const a=Ur.encode(n),l=t(a.length,1)>>>0;return bs().subarray(l,l+a.length).set(a),$n=a.length,l}let i=n.length,s=t(i,1)>>>0;const r=bs();let o=0;for(;o127)break;r[s+o]=a}if(o!==i){o!==0&&(n=n.slice(o)),s=e(s,i,i=o+n.length*3,1)>>>0;const a=bs().subarray(s+o,s+i),l=fS(n,a);o+=l.written,s=e(s,i,o,1)>>>0}return $n=o,s}function Ei(n){return n==null}let es=null;function lt(){return(es===null||es.byteLength===0)&&(es=new Int32Array(W.memory.buffer)),es}function dS(n){n<132||($e[n]=ys,ys=n)}function Ke(n){const t=$(n);return dS(n),t}let ns=null;function ym(){return(ns===null||ns.byteLength===0)&&(ns=new Float64Array(W.memory.buffer)),ns}let is=null;function gS(){return(is===null||is.byteLength===0)&&(is=new BigInt64Array(W.memory.buffer)),is}function kl(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const s=n.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=n.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(n)){const s=n.length;let r="[";s>0&&(r+=kl(n[0]));for(let o=1;o1)i=e[1];else return toString.call(n);if(i=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message} +${n.stack}`:i}function pS(n,t){const e=t(n.length*1,1)>>>0;return bs().set(n,e/1),$n=n.length,e}function mS(n,t){return n=n>>>0,ym().subarray(n/8,n/8+t)}function pn(n,t){try{return n.apply(this,t)}catch(e){W.__wbindgen_exn_store(G(e))}}const bS=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>W.__wbg_jsnetwork_free(n>>>0));class vT{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,bS.unregister(this),t}free(){const t=this.__destroy_into_raw();W.__wbg_jsnetwork_free(t)}constructor(t){try{const r=W.__wbindgen_add_to_stack_pointer(-16),o=pS(t,W.__wbindgen_malloc),a=$n;W.jsnetwork_new(r,o,a);var e=lt()[r/4+0],i=lt()[r/4+1],s=lt()[r/4+2];if(s)throw Ke(i);return this.__wbg_ptr=e>>>0,this}finally{W.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,i;try{const h=W.__wbindgen_add_to_stack_pointer(-16);W.jsnetwork_recalculate(h,this.__wbg_ptr,G(t));var s=lt()[h/4+0],r=lt()[h/4+1],o=lt()[h/4+2],a=lt()[h/4+3],l=s,c=r;if(a)throw l=0,c=0,Ke(o);return e=l,i=c,An(l,c)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,i,1)}}updateCostFunction(t){try{const s=W.__wbindgen_add_to_stack_pointer(-16);W.jsnetwork_updateCostFunction(s,this.__wbg_ptr,G(t));var e=lt()[s/4+0],i=lt()[s/4+1];if(i)throw Ke(e)}finally{W.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=W.__wbindgen_add_to_stack_pointer(-16);W.jsnetwork_getBounds(s,this.__wbg_ptr);var t=lt()[s/4+0],e=lt()[s/4+1],i=mS(t,e).slice();return W.__wbindgen_free(t,e*8,8),i}finally{W.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=W.__wbindgen_add_to_stack_pointer(-16);W.jsnetwork_debugNetwork(c,this.__wbg_ptr);var i=lt()[c/4+0],s=lt()[c/4+1],r=lt()[c/4+2],o=lt()[c/4+3],a=i,l=s;if(o)throw a=0,l=0,Ke(r);return t=a,e=l,An(a,l)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(t,e,1)}}}async function yS(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(i){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function _S(){const n={};return n.wbg={},n.wbg.__wbindgen_string_new=function(t,e){const i=An(t,e);return G(i)},n.wbg.__wbindgen_string_get=function(t,e){const i=$(e),s=typeof i=="string"?i:void 0;var r=Ei(s)?0:Ca(s,W.__wbindgen_malloc,W.__wbindgen_realloc),o=$n;lt()[t/4+1]=o,lt()[t/4+0]=r},n.wbg.__wbindgen_object_drop_ref=function(t){Ke(t)},n.wbg.__wbindgen_is_bigint=function(t){return typeof $(t)=="bigint"},n.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return G(e)},n.wbg.__wbindgen_jsval_eq=function(t,e){return $(t)===$(e)},n.wbg.__wbindgen_error_new=function(t,e){const i=new Error(An(t,e));return G(i)},n.wbg.__wbindgen_number_get=function(t,e){const i=$(e),s=typeof i=="number"?i:void 0;ym()[t/8+1]=Ei(s)?0:s,lt()[t/4+0]=!Ei(s)},n.wbg.__wbindgen_is_string=function(t){return typeof $(t)=="string"},n.wbg.__wbindgen_is_object=function(t){const e=$(t);return typeof e=="object"&&e!==null},n.wbg.__wbindgen_is_undefined=function(t){return $(t)===void 0},n.wbg.__wbindgen_in=function(t,e){return $(t)in $(e)},n.wbg.__wbindgen_jsval_loose_eq=function(t,e){return $(t)==$(e)},n.wbg.__wbindgen_boolean_get=function(t){const e=$(t);return typeof e=="boolean"?e?1:0:2},n.wbg.__wbindgen_as_number=function(t){return+$(t)},n.wbg.__wbindgen_number_new=function(t){return G(t)},n.wbg.__wbindgen_object_clone_ref=function(t){const e=$(t);return G(e)},n.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,e){const i=$(t)[$(e)];return G(i)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return G(t)},n.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const i=$(e).stack,s=Ca(i,W.__wbindgen_malloc,W.__wbindgen_realloc),r=$n;lt()[t/4+1]=r,lt()[t/4+0]=s},n.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let i,s;try{i=t,s=e,console.error(An(t,e))}finally{W.__wbindgen_free(i,s,1)}},n.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const i=$(t)[$(e)];return G(i)},n.wbg.__wbg_set_841ac57cff3d672b=function(t,e,i){$(t)[Ke(e)]=Ke(i)},n.wbg.__wbg_now_4e659b3d15f470d9=function(t){return $(t).now()},n.wbg.__wbg_debug_5fb96680aecf5dc8=function(t){console.debug($(t))},n.wbg.__wbg_error_8e3928cfb8a43e2b=function(t){console.error($(t))},n.wbg.__wbg_info_530a29cb2e4e3304=function(t){console.info($(t))},n.wbg.__wbg_log_5bb5f88f245d7762=function(t){console.log($(t))},n.wbg.__wbg_warn_63bbae1730aead09=function(t){console.warn($(t))},n.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,e){const i=$(t)[e>>>0];return G(i)},n.wbg.__wbg_length_cd7af8117672b8b8=function(t){return $(t).length},n.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const t=new Array;return G(t)},n.wbg.__wbindgen_is_function=function(t){return typeof $(t)=="function"},n.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,e){const i=new Function(An(t,e));return G(i)},n.wbg.__wbg_next_40fc327bfc8770e6=function(t){const e=$(t).next;return G(e)},n.wbg.__wbg_next_196c84450b364254=function(){return pn(function(t){const e=$(t).next();return G(e)},arguments)},n.wbg.__wbg_done_298b57d23c0fc80c=function(t){return $(t).done},n.wbg.__wbg_value_d93c65011f51a456=function(t){const e=$(t).value;return G(e)},n.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return G(Symbol.iterator)},n.wbg.__wbg_get_e3c254076557e348=function(){return pn(function(t,e){const i=Reflect.get($(t),$(e));return G(i)},arguments)},n.wbg.__wbg_call_27c0f87801dedf93=function(){return pn(function(t,e){const i=$(t).call($(e));return G(i)},arguments)},n.wbg.__wbg_new_72fb9a18b5ae2624=function(){const t=new Object;return G(t)},n.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return pn(function(){const t=self.self;return G(t)},arguments)},n.wbg.__wbg_window_c6fb939a7f436783=function(){return pn(function(){const t=window.window;return G(t)},arguments)},n.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return pn(function(){const t=globalThis.globalThis;return G(t)},arguments)},n.wbg.__wbg_global_207b558942527489=function(){return pn(function(){const t=global.global;return G(t)},arguments)},n.wbg.__wbg_set_d4638f722068f043=function(t,e,i){$(t)[e>>>0]=Ke(i)},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let e;try{e=$(t)instanceof ArrayBuffer}catch{e=!1}return e},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger($(t))},n.wbg.__wbg_entries_95cc2c823b285a09=function(t){const e=Object.entries($(t));return G(e)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const e=$(t).buffer;return G(e)},n.wbg.__wbg_new_63b92bc8671ed464=function(t){const e=new Uint8Array($(t));return G(e)},n.wbg.__wbg_set_a47bac70306a19a7=function(t,e,i){$(t).set($(e),i>>>0)},n.wbg.__wbg_length_c20a40f15020d68a=function(t){return $(t).length},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let e;try{e=$(t)instanceof Uint8Array}catch{e=!1}return e},n.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const i=$(e),s=typeof i=="bigint"?i:void 0;gS()[t/8+1]=Ei(s)?BigInt(0):s,lt()[t/4+0]=!Ei(s)},n.wbg.__wbindgen_debug_string=function(t,e){const i=kl($(e)),s=Ca(i,W.__wbindgen_malloc,W.__wbindgen_realloc),r=$n;lt()[t/4+1]=r,lt()[t/4+0]=s},n.wbg.__wbindgen_throw=function(t,e){throw new Error(An(t,e))},n.wbg.__wbindgen_memory=function(){const t=W.memory;return G(t)},n}function vS(n,t){return W=n.exports,xS.__wbindgen_wasm_module=t,is=null,ns=null,es=null,ts=null,W}async function xS(n){if(W!==void 0)return W;typeof n>"u"&&(n="/od2net/assets/wasm_od2net_bg.wasm");const t=_S();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:e,module:i}=await yS(await n,t);return vS(e,i)}function wS(n){let t,e,i,s,r,o,a,l,c,h,u,f;return{c(){t=I("div"),e=I("label"),i=$t(`Or load an example: + `),s=I("select"),r=I("option"),r.textContent="Custom file loaded",o=I("option"),o.textContent="Antwerp",a=I("option"),a.textContent="Berlin",l=I("option"),l.textContent="South London",c=I("option"),c.textContent="Paris",h=I("option"),h.textContent="Seattle",r.__value="",vt(r,r.__value),o.__value="antwerp",vt(o,o.__value),a.__value="berlin",vt(a,a.__value),l.__value="london",vt(l,l.__value),c.__value="paris",vt(c,c.__value),h.__value="seattle",vt(h,h.__value),n[0]===void 0&&Yg(()=>n[1].call(s))},m(d,g){z(d,t,g),F(t,e),F(e,i),F(e,s),F(s,r),F(s,o),F(s,a),F(s,l),F(s,c),F(s,h),Zr(s,n[0],!0),u||(f=St(s,"change",n[1]),u=!0)},p(d,[g]){g&1&&Zr(s,d[0])},i:yt,o:yt,d(d){d&&N(t),u=!1,f()}}}function SS(n,t,e){let{example:i}=t;function s(){i=Ug(this),e(0,i)}return n.$$set=r=>{"example"in r&&e(0,i=r.example)},[i,s]}class xT extends Ne{constructor(t){super(),We(this,t,SS,wS,xe,{example:0})}}/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function Hs(n){return n+.5|0}const Je=(n,t,e)=>Math.max(Math.min(n,e),t);function ss(n){return Je(Hs(n*2.55),0,255)}function nn(n){return Je(Hs(n*255),0,255)}function Le(n){return Je(Hs(n/2.55)/100,0,1)}function Yu(n){return Je(Hs(n*100),0,100)}const Yt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pl=[..."0123456789ABCDEF"],MS=n=>Pl[n&15],kS=n=>Pl[(n&240)>>4]+Pl[n&15],er=n=>(n&240)>>4===(n&15),PS=n=>er(n.r)&&er(n.g)&&er(n.b)&&er(n.a);function AS(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Yt[n[1]]*17,g:255&Yt[n[2]]*17,b:255&Yt[n[3]]*17,a:t===5?Yt[n[4]]*17:255}:(t===7||t===9)&&(e={r:Yt[n[1]]<<4|Yt[n[2]],g:Yt[n[3]]<<4|Yt[n[4]],b:Yt[n[5]]<<4|Yt[n[6]],a:t===9?Yt[n[7]]<<4|Yt[n[8]]:255})),e}const OS=(n,t)=>n<255?t(n):"";function CS(n){var t=PS(n)?MS:kS;return n?"#"+t(n.r)+t(n.g)+t(n.b)+OS(n.a,t):void 0}const DS=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function _m(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function ES(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function LS(n,t,e){const i=_m(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function TS(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=TS(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function Oc(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(nn)}function Cc(n,t,e){return Oc(_m,n,t,e)}function RS(n,t,e){return Oc(LS,n,t,e)}function $S(n,t,e){return Oc(ES,n,t,e)}function vm(n){return(n%360+360)%360}function FS(n){const t=DS.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?ss(+t[5]):nn(+t[5]));const s=vm(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=RS(s,r,o):t[1]==="hsv"?i=$S(s,r,o):i=Cc(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function IS(n,t){var e=Ac(n);e[0]=vm(e[0]+t),e=Cc(e),n.r=e[0],n.g=e[1],n.b=e[2]}function BS(n){if(!n)return;const t=Ac(n),e=t[0],i=Yu(t[1]),s=Yu(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Le(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Uu={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Xu={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function zS(){const n={},t=Object.keys(Xu),e=Object.keys(Uu);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let nr;function NS(n){nr||(nr=zS(),nr.transparent=[0,0,0,0]);const t=nr[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const WS=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function VS(n){const t=WS.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?ss(o):Je(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?ss(i):Je(i,0,255)),s=255&(t[4]?ss(s):Je(s,0,255)),r=255&(t[6]?ss(r):Je(r,0,255)),{r:i,g:s,b:r,a:e}}}function jS(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Le(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Da=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Kn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function HS(n,t,e){const i=Kn(Le(n.r)),s=Kn(Le(n.g)),r=Kn(Le(n.b));return{r:nn(Da(i+e*(Kn(Le(t.r))-i))),g:nn(Da(s+e*(Kn(Le(t.g))-s))),b:nn(Da(r+e*(Kn(Le(t.b))-r))),a:n.a+e*(t.a-n.a)}}function ir(n,t,e){if(n){let i=Ac(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Cc(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function xm(n,t){return n&&Object.assign(t||{},n)}function Gu(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=nn(n[3]))):(t=xm(n,{r:0,g:0,b:0,a:1}),t.a=nn(t.a)),t}function YS(n){return n.charAt(0)==="r"?VS(n):FS(n)}let wm=class Al{constructor(t){if(t instanceof Al)return t;const e=typeof t;let i;e==="object"?i=Gu(t):e==="string"&&(i=AS(t)||NS(t)||YS(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=xm(this._rgb);return t&&(t.a=Le(t.a)),t}set rgb(t){this._rgb=Gu(t)}rgbString(){return this._valid?jS(this._rgb):void 0}hexString(){return this._valid?CS(this._rgb):void 0}hslString(){return this._valid?BS(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=HS(this._rgb,t._rgb,e)),this}clone(){return new Al(this.rgb)}alpha(t){return this._rgb.a=nn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Hs(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ir(this._rgb,2,t),this}darken(t){return ir(this._rgb,2,-t),this}saturate(t){return ir(this._rgb,1,t),this}desaturate(t){return ir(this._rgb,1,-t),this}rotate(t){return IS(this._rgb,t),this}};/*! + * Chart.js v4.4.2 + * https://www.chartjs.org + * (c) 2024 Chart.js Contributors + * Released under the MIT License + */function Pe(){}const US=(()=>{let n=0;return()=>n++})();function U(n){return n===null||typeof n>"u"}function st(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function j(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function ht(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Vt(n,t){return ht(n)?n:t}function B(n,t){return typeof n>"u"?t:n}const XS=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Sm=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function nt(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function q(n,t,e,i){let s,r,o;if(st(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function KS(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function JS(n){const t=KS(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function rn(n,t){return(qu[t]||(qu[t]=JS(t)))(n)}function Dc(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Es=n=>typeof n<"u",on=n=>typeof n=="function",Ku=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function ZS(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const ot=Math.PI,rt=2*ot,QS=rt+ot,_o=Number.POSITIVE_INFINITY,tM=ot/180,mt=ot/2,mn=ot/4,Ju=ot*2/3,Ze=Math.log10,ye=Math.sign;function vs(n,t,e){return Math.abs(n-t)s-r).pop(),t}function mi(n){return!isNaN(parseFloat(n))&&isFinite(n)}function nM(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function km(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Lc(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Be=(n,t,e,i)=>Lc(n,e,i?s=>{const r=n[s][t];return rn[s][t]Lc(n,e,i=>n[i][t]>=e);function oM(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+Dc(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function tf(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Am.forEach(r=>{delete n[r]}),delete n._chartjs)}function Om(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const Cm=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Dm(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Cm.call(window,()=>{i=!1,n.apply(t,e)}))}}function lM(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Tc=n=>n==="start"?"left":n==="end"?"right":"center",Ot=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,cM=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Em(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=xt(Math.min(Be(a,l,c).lo,e?i:Be(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=xt(Math.max(Be(a,o.axis,h,!0).hi+1,e?0:Be(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Lm(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const sr=n=>n===0||n===1,ef=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*rt/e)),nf=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*rt/e)+1,xs={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*mt)+1,easeOutSine:n=>Math.sin(n*mt),easeInOutSine:n=>-.5*(Math.cos(ot*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>sr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>sr(n)?n:ef(n,.075,.3),easeOutElastic:n=>sr(n)?n:nf(n,.075,.3),easeInOutElastic(n){return sr(n)?n:n<.5?.5*ef(n*2,.1125,.45):.5+.5*nf(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-xs.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?xs.easeInBounce(n*2)*.5:xs.easeOutBounce(n*2-1)*.5+.5};function Rc(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function sf(n){return Rc(n)?n:new wm(n)}function Ea(n){return Rc(n)?n:new wm(n).saturate(.5).darken(.1).hexString()}const hM=["x","y","borderWidth","radius","tension"],uM=["color","borderColor","backgroundColor"];function fM(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:uM},numbers:{type:"number",properties:hM}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function dM(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const rf=new Map;function gM(n,t){t=t||{};const e=n+JSON.stringify(t);let i=rf.get(e);return i||(i=new Intl.NumberFormat(n,t),rf.set(e,i)),i}function Ys(n,t,e){return gM(t,e).format(n)}const Tm={values(n){return st(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=pM(n,e)}const o=Ze(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ys(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(Ze(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Tm.numeric.call(this,n,t,e):""}};function pM(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var qo={formatters:Tm};function mM(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:qo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Nn=Object.create(null),Cl=Object.create(null);function ws(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ii.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Ea(s.backgroundColor),this.hoverBorderColor=(i,s)=>Ea(s.borderColor),this.hoverColor=(i,s)=>Ea(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return La(this,t,e)}get(t){return ws(this,t)}describe(t,e){return La(Cl,t,e)}override(t,e){return La(Nn,t,e)}route(t,e,i,s){const r=ws(this,t),o=ws(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return j(l)?Object.assign({},c,l):B(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var ut=new bM({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[fM,dM,mM]);function yM(n){return!n||U(n.size)||U(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function vo(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function _M(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function ze(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,wM(n,r),l=0;l+n||0;function $c(n,t){const e={},i=j(t),s=i?Object.keys(t):t,r=j(n)?i?o=>B(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=OM(r(o));return e}function $m(n){return $c(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Fn(n){return $c(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Lt(n){const t=$m(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function bt(n,t){n=n||{},t=t||ut.font;let e=B(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=B(n.style,t.style);i&&!(""+i).match(PM)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:B(n.family,t.family),lineHeight:AM(B(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:B(n.weight,t.weight),string:""};return s.string=yM(s),s}function rs(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function fn(n,t){return Object.assign(Object.create(n),t)}function Fc(n,t=[""],e,i,s=()=>n[0]){const r=e||n;typeof i>"u"&&(i=zm("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:a=>Fc([a,...n],t,r,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return Im(a,l,()=>IM(l,t,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return lf(a).includes(l)},ownKeys(a){return lf(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function bi(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:Fm(n,i),setContext:r=>bi(n,r,e,i),override:r=>bi(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return Im(r,o,()=>EM(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function Fm(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:on(e)?e:()=>e,isIndexable:on(i)?i:()=>i}}const DM=(n,t)=>n?n+Dc(t):t,Ic=(n,t)=>j(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Im(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function EM(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return on(a)&&o.isScriptable(t)&&(a=LM(t,a,n,e)),st(a)&&a.length&&(a=TM(t,a,n,o.isIndexable)),Ic(t,a)&&(a=bi(a,s,r&&r[t],o)),a}function LM(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=t(r,o||i);return a.delete(n),Ic(n,l)&&(l=Bc(s._scopes,s,n,l)),l}function TM(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(typeof r.index<"u"&&i(n))return t[r.index%t.length];if(j(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Bc(c,s,n,h);t.push(bi(u,r,o&&o[n],a))}}return t}function Bm(n,t,e){return on(n)?n(t,e):n}const RM=(n,t)=>n===!0?t:typeof n=="string"?rn(t,n):void 0;function $M(n,t,e,i,s){for(const r of t){const o=RM(e,r);if(o){n.add(o);const a=Bm(o._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(o===!1&&typeof i<"u"&&e!==i)return null}return!1}function Bc(n,t,e,i){const s=t._rootScopes,r=Bm(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=af(a,o,e,r||e,i);return l===null||typeof r<"u"&&r!==e&&(l=af(a,o,r,l,i),l===null)?!1:Fc(Array.from(a),[""],s,r,()=>FM(t,e,i))}function af(n,t,e,i,s){for(;e;)e=$M(n,t,e,i,s);return e}function FM(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return st(s)&&j(e)?e:s||{}}function IM(n,t,e,i){let s;for(const r of t)if(s=zm(DM(r,n),e),typeof s<"u")return Ic(n,s)?Bc(e,i,n,s):s}function zm(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function lf(n){let t=n._keys;return t||(t=n._keys=BM(n._scopes)),t}function BM(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Nm(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function NM(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=Ol(r,s),l=Ol(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function WM(n,t,e){const i=n.length;let s,r,o,a,l,c=yi(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")jM(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rn.ownerDocument.defaultView.getComputedStyle(n,null);function UM(n,t){return Zo(n).getPropertyValue(t)}const XM=["top","right","bottom","left"];function In(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=XM[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const GM=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function qM(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(GM(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function wn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=Zo(e),r=s.boxSizing==="border-box",o=In(s,"padding"),a=In(s,"border","width"),{x:l,y:c,box:h}=qM(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function KM(n,t,e){let i,s;if(t===void 0||e===void 0){const r=Nc(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=Zo(r),l=In(a,"border","width"),c=In(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=xo(a.maxWidth,r,"clientWidth"),s=xo(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||_o,maxHeight:s||_o}}const or=n=>Math.round(n*10)/10;function JM(n,t,e,i){const s=Zo(n),r=In(s,"margin"),o=xo(s.maxWidth,n,"clientWidth")||_o,a=xo(s.maxHeight,n,"clientHeight")||_o,l=KM(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const f=In(s,"border","width"),d=In(s,"padding");c-=d.width+f.width,h-=d.height+f.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?c/i:h-r.height),c=or(Math.min(c,o,l.maxWidth)),h=or(Math.min(h,a,l.maxHeight)),c&&!h&&(h=or(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=or(Math.floor(h*i))),{width:c,height:h}}function cf(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const ZM=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};zc()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function hf(n,t){const e=UM(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Sn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function QM(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function tk(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=Sn(n,s,e),a=Sn(s,r,e),l=Sn(r,t,e),c=Sn(o,a,e),h=Sn(a,l,e);return Sn(c,h,e)}const ek=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},nk=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function ci(n,t,e){return n?ek(t,e):nk()}function Vm(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function jm(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Hm(n){return n==="angle"?{between:Ls,compare:iM,normalize:jt}:{between:Ie,compare:(t,e)=>t-e,normalize:t=>t}}function uf({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function ik(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=Hm(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),S=()=>!p||_();for(let M=h,P=h;M<=u;++M)m=t[M%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?M:P),y!==null&&S()&&(g.push(uf({start:y,end:M,loop:f,count:o,style:d})),y=null),P=M,v=x));return y!==null&&g.push(uf({start:y,end:u,loop:f,count:o,style:d})),g}function Um(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function rk(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function ok(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=sk(e,s,r,i);if(i===!0)return ff(n,[{start:o,end:a,loop:r}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Cm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var Ae=new ck;const gf="transparent",hk={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=sf(n||gf),s=i.valid&&sf(t||gf);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};let uk=class{constructor(t,e,i,s){const r=e[i];s=rs([t.to,s,r,t.from]);const o=rs([t.from,r,s]);this._active=!0,this._fn=t.fn||hk[t.type||typeof o],this._easing=xs[t.easing]||xs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=rs([t.to,e,s,t.from]),this._from=rs([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s{const r=t[s];if(!j(r))return;const o={};for(const a of e)o[a]=r[a];(st(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,e){const i=e.options,s=dk(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&fk(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new uk(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Ae.add(this._chart,i),!0}};function fk(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function _f(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=bk(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function vk(n,t){return fn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function xk(n,t,e){return fn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Li(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Ra=n=>n==="reset"||n==="none",vf=(n,t)=>t?n:Object.assign({},n),wk=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Gm(e,!0),values:null};var Hi;let dn=(Hi=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=bf(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Li(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=B(i.xAxisID,Ta(t,"x")),o=e.yAxisID=B(i.yAxisID,Ta(t,"y")),a=e.rAxisID=B(i.rAxisID,Ta(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&tf(this._data,this),t._stacked&&Li(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(j(e))this._data=mk(e);else if(i!==e){if(i){tf(i,this);const s=this._cachedMeta;Li(s),s._parsed=[]}e&&Object.isExtensible(e)&&aM(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=bf(e.vScale,e),e.stack!==i.stack&&(s=!0,Li(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&_f(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{st(s[t])?f=this.parseArrayData(i,s,t,e):j(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s,e),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(vf(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new Xm(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ra(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){Ra(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ra(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function Mk(n){const t=n.iScale,e=Sk(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(Es(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function qm(n,t,e,i){return st(n)?Ak(n,t,e,i):t[e.axis]=e.parse(n,i),t}function xf(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function Ck(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(U(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:i[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fLs(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>Ls(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(mt,h,f),x=g(ot,c,u),m=g(ot+mt,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}var ni;let Wc=(ni=class extends dn{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(j(i[t])){const{key:l="value"}=this._parsing;r=c=>+rn(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?rt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=Ys(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),C(ni,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}}),ni);var Xi;let Fk=(Xi=class extends dn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=Em(e,s,o);this._drawStart=a,this._drawCount=l,Lm(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=mi(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none",m=e+i,v=t.length;let b=e>0&&this.getParsed(e-1);for(let _=0;_=m){S.skip=!0;continue}const M=this.getParsed(_),P=U(M[d]),A=S[f]=o.getPixelForValue(M[f],_),k=S[d]=r||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[d],_);S.skip=isNaN(A)||isNaN(k)||P,S.stop=_>0&&Math.abs(M[f]-b[f])>y,p&&(S.parsed=M,S.raw=c.data[_]),u&&(S.options=h||this.resolveDataElementOptions(_,w.active?"active":s)),x||this.updateElement(w,_,S,s),b=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},C(Xi,"id","line"),C(Xi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),C(Xi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),Xi);var Gi;let Km=(Gi=class extends dn{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=Ys(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return Nm.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*ot;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ae(this.resolveDataElementOptions(t,e).angle||i):0}},C(Gi,"id","polarArea"),C(Gi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),C(Gi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),Gi);var Cr;let Ik=(Cr=class extends Wc{},C(Cr,"id","pie"),C(Cr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),Cr);var qi;let Bk=(qi=class extends dn{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Nm.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(S.parsed=w,S.raw=c.data[b]),f&&(S.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,S,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}},C(Ki,"id","scatter"),C(Ki,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),C(Ki,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),Ki);var Nk=Object.freeze({__proto__:null,BarController:Tk,BubbleController:Rk,DoughnutController:Wc,LineController:Fk,PieController:Ik,PolarAreaController:Km,RadarController:Bk,ScatterController:zk});function yn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vc{constructor(t){C(this,"options");this.options=t||{}}static override(t){Object.assign(Vc.prototype,t)}init(){}formats(){return yn()}parse(){return yn()}format(){return yn()}add(){return yn()}diff(){return yn()}startOf(){return yn()}endOf(){return yn()}}var Wk={_date:Vc};function Vk(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?rM:Be;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Us(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var Uk={evaluateInteractionItems:Us,modes:{index(n,t,e,i){const s=wn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?Fa(n,s,r,i,o):Ia(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=wn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?Fa(n,s,r,i,o):Ia(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function kf(n,t){return n.filter(e=>Jm.indexOf(e.pos)===-1&&e.box.axis===t)}function Ri(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Xk(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=Ri(Ti(t,"left"),!0),s=Ri(Ti(t,"right")),r=Ri(Ti(t,"top"),!0),o=Ri(Ti(t,"bottom")),a=kf(t,"x"),l=kf(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Ti(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function Pf(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Zm(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function Jk(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!j(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&Zm(o,r.getPadding());const a=Math.max(0,t.outerWidth-Pf(o,n,"left","right")),l=Math.max(0,t.outerHeight-Pf(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Zk(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function Qk(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function os(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);Zm(f,Lt(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=qk(l.concat(c),u);os(a.fullSize,d,u,g),os(l,d,u,g),os(c,d,u,g)&&os(l,d,u,g),Zk(d),Af(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,Af(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},q(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};let Qm=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},tP=class extends Qm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const Xr="$chartjs",eP={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Of=n=>n===null||n==="";function nP(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Xr]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Of(s)){const r=hf(n,"width");r!==void 0&&(n.width=r)}if(Of(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=hf(n,"height");r!==void 0&&(n.height=r)}return n}const tb=ZM?{passive:!0}:!1;function iP(n,t,e){n&&n.addEventListener(t,e,tb)}function sP(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,tb)}function rP(n,t){const e=eP[n.type]||n.type,{x:i,y:s}=wn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function wo(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function oP(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||wo(a.addedNodes,i),o=o&&!wo(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function aP(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||wo(a.removedNodes,i),o=o&&!wo(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Rs=new Map;let Cf=0;function eb(){const n=window.devicePixelRatio;n!==Cf&&(Cf=n,Rs.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function lP(n,t){Rs.size||window.addEventListener("resize",eb),Rs.set(n,t)}function cP(n){Rs.delete(n),Rs.size||window.removeEventListener("resize",eb)}function hP(n,t,e){const i=n.canvas,s=i&&Nc(i);if(!s)return;const r=Dm((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),lP(n,r),o}function Ba(n,t,e){e&&e.disconnect(),t==="resize"&&cP(n)}function uP(n,t,e){const i=n.canvas,s=Dm(r=>{n.ctx!==null&&e(rP(r,n))},n);return iP(i,t,s),s}let fP=class extends Qm{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(nP(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Xr])return!1;const i=e[Xr].initial;["height","width"].forEach(r=>{const o=i[r];U(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[Xr],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:oP,detach:aP,resize:hP}[e]||uP;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Ba,detach:Ba,resize:Ba}[e]||sP)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return JM(t,e,i,s)}isAttached(t){const e=Nc(t);return!!(e&&e.isConnected)}};function dP(n){return!zc()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?tP:fP}var Dr;let Ve=(Dr=class{constructor(){C(this,"x");C(this,"y");C(this,"active",!1);C(this,"options");C(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return mi(this.x)&&mi(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}},C(Dr,"defaults",{}),C(Dr,"defaultRoutes"),Dr);function gP(n,t){const e=n.options.ticks,i=pP(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?bP(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return yP(t,c,r,o/s),c;const h=mP(r,t,s);if(o>0){let u,f;const d=o>1?Math.round((l-a)/(o-1)):null;for(lr(t,c,h,U(d)?0:a-d,a),u=0,f=o-1;us)return l}return Math.max(s,1)}function bP(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,Df=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Ef=(n,t)=>Math.min(t||n,n);function Lf(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function wP(n,t){q(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:Vt(e,Vt(i,e)),max:Vt(i,Vt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){nt(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=CM(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=xt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-$i(t.grid)-e.padding-Tf(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=Ec(Math.min(Math.asin(xt((h.highest.height+6)/a,-1,1)),Math.asin(xt(l/c,-1,1))-Math.asin(xt(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){nt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){nt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Tf(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=$i(r)+l):(t.height=this.maxHeight,t.width=$i(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=ae(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){nt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:o[P]||0,height:a[P]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(S),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return sM(this._alignToPixels?bn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=$i(r),d=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,y=p/2,x=function(L){return bn(i,L,p)};let m,v,b,_,w,S,M,P,A,k,D,E;if(o==="top")m=x(this.bottom),S=this.bottom-f,P=m-y,k=x(t.top)+y,E=t.bottom;else if(o==="bottom")m=x(this.top),k=t.top,E=x(t.bottom)-y,S=m+y,P=this.top+f;else if(o==="left")m=x(this.right),w=this.right-f,M=m-y,A=x(t.left)+y,D=t.right;else if(o==="right")m=x(this.left),A=t.left,D=x(t.right)-y,w=m+y,M=this.left+f;else if(e==="x"){if(o==="center")m=x((t.top+t.bottom)/2+.5);else if(j(o)){const L=Object.keys(o)[0],R=o[L];m=x(this.chart.scales[L].getPixelForValue(R))}k=t.top,E=t.bottom,S=m+y,P=S+f}else if(e==="y"){if(o==="center")m=x((t.left+t.right)/2);else if(j(o)){const L=Object.keys(o)[0],R=o[L];m=x(this.chart.scales[L].getPixelForValue(R))}w=m-y,M=w-f,A=t.left,D=t.right}const T=B(s.ticks.maxTicksLimit,u),O=Math.max(1,Math.ceil(u/T));for(v=0;v0&&(se-=ie/2);break}Tt={left:se,top:Me,width:ie+it.width,height:ne+it.height,color:O.backdropColor}}y.push({label:b,font:P,textOffset:D,options:{rotation:p,color:R,strokeColor:Q,strokeWidth:et,textAlign:gt,textBaseline:E,translation:[_,w],backdrop:Tt}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ae(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width;let c,h;return e==="left"?s?(h=this.right+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");ut.route(r,s,l,a)})}function CP(n){return"id"in n&&"defaults"in n}let DP=class{constructor(){this.controllers=new cr(dn,"datasets",!0),this.elements=new cr(Ve,"elements"),this.plugins=new cr(Object,"plugins"),this.scales=new cr(Xs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):q(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=Dc(t);nt(i["before"+s],[],i),e[t](i),nt(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;er.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function LP(n){const t={},e=[],i=Object.keys(ge.plugins.items);for(let r=0;r1&&Rf(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function $f(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function zP(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return $f(n,"x",e[0])||$f(n,"y",e[0])}return{}}function NP(n,t){const e=Nn[n.type]||{scales:{}},i=t.scales||{},s=El(n.type,t),r=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!j(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Ll(o,a,zP(o,n),ut.scales[a.type]),c=IP(l,s),h=e.scales||{};r[o]=_s(Object.create(null),[{axis:l},a,h[l],h[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||El(a,t),h=(Nn[a]||{}).scales||{};Object.keys(h).forEach(u=>{const f=FP(u,l),d=o[f+"AxisID"]||f;r[d]=r[d]||Object.create(null),_s(r[d],[{axis:f},i[d],h[u]])})}),Object.keys(r).forEach(o=>{const a=r[o];_s(a,[ut.scales[a.type],ut.scale])}),r}function ib(n){const t=n.options||(n.options={});t.plugins=B(t.plugins,{}),t.scales=NP(n,t)}function sb(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function WP(n){return n=n||{},n.data=sb(n.data),ib(n),n}const Ff=new Map,rb=new Set;function hr(n,t){let e=Ff.get(n);return e||(e=t(),Ff.set(n,e),rb.add(e)),e}const Fi=(n,t,e)=>{const i=rn(t,e);i!==void 0&&n.add(i)};let VP=class{constructor(t){this._config=WP(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=sb(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ib(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return hr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return hr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return hr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return hr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Fi(l,t,u))),h.forEach(u=>Fi(l,s,u)),h.forEach(u=>Fi(l,Nn[r]||{},u)),h.forEach(u=>Fi(l,ut,u)),h.forEach(u=>Fi(l,Cl,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),rb.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Nn[e]||{},ut.datasets[e]||{},{type:e},ut,Cl]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=If(this._resolverCache,t,s);let l=o;if(HP(o,e)){r.$shared=!1,i=on(i)?i():i;const c=this.createResolver(t,i,a);l=bi(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=If(this._resolverCache,t,i);return j(e)?bi(r,e,void 0,s):r}};function If(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:Fc(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const jP=n=>j(n)&&Object.getOwnPropertyNames(n).some(t=>on(n[t]));function HP(n,t){const{isScriptable:e,isIndexable:i}=Fm(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(on(a)||jP(a))||o&&st(a))return!0}return!1}var YP="4.4.2";const UP=["top","bottom","left","right","chartArea"];function Bf(n,t){return n==="top"||n==="bottom"||UP.indexOf(n)===-1&&t==="x"}function zf(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Nf(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),nt(e&&e.onComplete,[n],t)}function XP(n){const t=n.chart,e=t.options.animation;nt(e&&e.onProgress,[n],t)}function ob(n){return zc()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Gr={},Wf=n=>{const t=ob(n);return Object.values(Gr).filter(e=>e.canvas===t).pop()};function GP(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function qP(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function ur(n,t,e){return n.options.clip?n[e]:t[e]}function KP(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:ur(e,t,"left"),right:ur(e,t,"right"),top:ur(i,t,"top"),bottom:ur(i,t,"bottom")}:t}var Ye;let as=(Ye=class{static register(...t){ge.add(...t),Vf()}static unregister(...t){ge.remove(...t),Vf()}constructor(t,e){const i=this.config=new VP(e),s=ob(t),r=Wf(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||dP(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=US(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new EP,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=lM(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],Gr[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ae.listen(this,"complete",Nf),Ae.listen(this,"progress",XP),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return U(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ge}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():cf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return of(this.canvas,this.ctx),this}stop(){return Ae.stop(this),this}resize(t,e){Ae.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,cf(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),nt(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};q(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=Ll(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),q(r,o=>{const a=o.options,l=a.id,c=Ll(l,a),h=B(a.type,o.dtype);(a.position===void 0||Bf(a.position,c)!==Bf(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=ge.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),q(s,(o,a)=>{o||delete i[a]}),q(i,o=>{Ct.configure(this,o,o.options),Ct.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(zf("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){q(this.scales,t=>{Ct.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Ku(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;GP(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ct.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],q(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=KP(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&Ko(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&Jo(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ze(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=Uk.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=fn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);Es(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ae.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};q(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){q(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},q(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!bo(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=ZS(t),c=qP(t,this._lastEvent,i,l);i&&(this._lastEvent=null,nt(r.onHover,[t,a,this],this),l&&nt(r.onClick,[t,a,this],this));const h=!bo(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},C(Ye,"defaults",ut),C(Ye,"instances",Gr),C(Ye,"overrides",Nn),C(Ye,"registry",ge),C(Ye,"version",YP),C(Ye,"getChart",Wf),Ye);function Vf(){return q(as.instances,n=>n._plugins.invalidate())}function JP(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+mt,i-mt),n.closePath(),n.clip()}function ZP(n){return $c(n,["outerStart","outerEnd","innerStart","innerEnd"])}function QP(n,t,e,i){const s=ZP(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return xt(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:xt(s.innerStart,0,o),innerEnd:xt(s.innerEnd,0,o)}}function Jn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function So(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,L=u>0?u-i:0,R=(O+L)/2,Q=R!==0?g*R/(R+i):g;d=(g-Q)/2}const p=Math.max(.001,g*u-e/ot)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=QP(t,f,u,m-x),S=u-v,M=u-b,P=x+v/S,A=m-b/M,k=f+_,D=f+w,E=x+_/k,T=m-w/D;if(n.beginPath(),r){const O=(P+A)/2;if(n.arc(o,a,u,P,O),n.arc(o,a,u,O,A),b>0){const et=Jn(M,A,o,a);n.arc(et.x,et.y,b,A,m+mt)}const L=Jn(D,m,o,a);if(n.lineTo(L.x,L.y),w>0){const et=Jn(D,T,o,a);n.arc(et.x,et.y,w,m+mt,T+Math.PI)}const R=(m-w/f+(x+_/f))/2;if(n.arc(o,a,f,m-w/f,R,!0),n.arc(o,a,f,R,x+_/f,!0),_>0){const et=Jn(k,E,o,a);n.arc(et.x,et.y,_,E+Math.PI,x-mt)}const Q=Jn(S,x,o,a);if(n.lineTo(Q.x,Q.y),v>0){const et=Jn(S,P,o,a);n.arc(et.x,et.y,v,x-mt,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,L=Math.sin(P)*u+a;n.lineTo(O,L);const R=Math.cos(A)*u+o,Q=Math.sin(A)*u+a;n.lineTo(R,Q)}n.closePath()}function tA(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){So(n,t,e,i,l,s);for(let c=0;c=rt||Ls(o,l,c),y=Ie(a,h+d,u+d);return p&&y}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(r+o)/2,f=(a+l+h+c)/2;return{x:i+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,o=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>rt?Math.floor(s/rt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(ot,s||0)),h=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,tA(e,this,h,o,a),eA(e,this,h,o,a),e.restore()}},C(ii,"id","arc"),C(ii,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),C(ii,"defaultRoutes",{backgroundColor:"backgroundColor"}),C(ii,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),ii);function ab(n,t,e=t){n.lineCap=B(e.borderCapStyle,t.borderCapStyle),n.setLineDash(B(e.borderDash,t.borderDash)),n.lineDashOffset=B(e.borderDashOffset,t.borderDashOffset),n.lineJoin=B(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=B(e.borderWidth,t.borderWidth),n.strokeStyle=B(e.borderColor,t.borderColor)}function iA(n,t,e){n.lineTo(e.x,e.y)}function sA(n){return n.stepped?vM:n.tension||n.cubicInterpolationMode==="monotone"?xM:iA}function lb(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function Tl(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?oA:rA}function aA(n){return n.stepped?QM:n.tension||n.cubicInterpolationMode==="monotone"?tk:Sn}function lA(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),ab(n,t.options),n.stroke(s)}function cA(n,t,e,i){const{segments:s,options:r}=t,o=Tl(t);for(const a of s)ab(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const hA=typeof Path2D=="function";function uA(n,t,e,i){hA&&!t.options.segment?lA(n,t,e,i):cA(n,t,e,i)}var si;let Qo=(si=class extends Ve{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;YM(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ok(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=Um(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=aA(i);let c,h;for(c=0,h=o.length;ct!=="borderDash"&&t!=="fill"}),si);function jf(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)n.replace("rgb(","rgba(").replace(")",", 0.5)"));function hb(n){return Rl[n%Rl.length]}function ub(n){return Hf[n%Hf.length]}function vA(n,t){return n.borderColor=hb(t),n.backgroundColor=ub(t),++t}function xA(n,t){return n.backgroundColor=n.data.map(()=>hb(t++)),t}function wA(n,t){return n.backgroundColor=n.data.map(()=>ub(t++)),t}function SA(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof Wc?t=xA(e,t):s instanceof Km?t=wA(e,t):s&&(t=vA(e,t))}}function Yf(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function MA(n){return n&&(n.borderColor||n.backgroundColor)}var kA={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(Yf(i)||MA(s)||r&&Yf(r)))return;const o=SA(n);i.forEach(o)}};function PA(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const o=[],a=(e-2)/(r-2);let l=0;const c=t+e-1;let h=t,u,f,d,g,p;for(o[l++]=n[h],u=0;ud&&(d=g,f=n[m],p=m);o[l++]=f,h=p}return o[l++]=n[c],o}function AA(n,t,e,i){let s=0,r=0,o,a,l,c,h,u,f,d,g,p;const y=[],x=t+e-1,m=n[t].x,b=n[x].x-m;for(o=t;op&&(p=c,f=o),s=(r*s+a.x)/++r;else{const w=o-1;if(!U(u)&&!U(f)){const S=Math.min(u,f),M=Math.max(u,f);S!==d&&S!==w&&y.push({...n[S],x:s}),M!==d&&M!==w&&y.push({...n[M],x:s})}o>0&&w!==d&&y.push(n[w]),y.push(a),h=_,r=0,g=p=c,u=f=d=o}}return y}function fb(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Uf(n){n.data.datasets.forEach(t=>{fb(t)})}function OA(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=xt(Be(t,r.axis,o).lo,0,e-1)),c?s=xt(Be(t,r.axis,a).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var CA={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){Uf(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:o,indexAxis:a}=s,l=n.getDatasetMeta(r),c=o||s.data;if(rs([a,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=n.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||n.options.parsing)return;let{start:u,count:f}=OA(l,c);const d=e.threshold||4*i;if(f<=d){fb(s);return}U(o)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=PA(c,u,f,i,e);break;case"min-max":g=AA(c,u,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(n){Uf(n)}};function DA(n,t,e){const i=n.segments,s=n.points,r=t.points,o=[];for(const a of i){let{start:l,end:c}=a;c=jc(l,c,s);const h=$l(e,s[l],s[c],a.loop);if(!t.segments){o.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=Um(t,h);for(const f of u){const d=$l(e,r[f.start],r[f.end],f.loop),g=Ym(a,s,d);for(const p of g)o.push({source:p,target:f,start:{[e]:Xf(h,d,"start",Math.max)},end:{[e]:Xf(h,d,"end",Math.min)}})}}return o}function $l(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=jt(s),r=jt(r)),{property:n,start:s,end:r}}function EA(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=jc(o,a,s);const l=s[o],c=s[a];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function jc(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Xf(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function db(n,t){let e=[],i=!1;return st(n)?(i=!0,e=n):e=EA(n,t),e.length?new Qo({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Gf(n){return n&&n.fill!==!1}function LA(n,t,e){let s=n[t].fill;const r=[t];let o;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!ht(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function TA(n,t,e){const i=IA(n);if(j(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return ht(s)&&Math.floor(s)===s?RA(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function RA(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function $A(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:j(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function FA(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:j(n)?i=n.value:i=t.getBaseValue(),i}function IA(n){const t=n.options,e=t.fill;let i=B(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function BA(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,o=i.points,a=zA(t,e);a.push(db({x:null,y:t.bottom},i));for(let l=0;l=0;--o){const a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),i&&a.fill&&Wa(n.ctx,a,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;Gf(r)&&Wa(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!Gf(i)||e.drawTime!=="beforeDatasetDraw"||Wa(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Zf=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},KA=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Qf extends Ve{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=nt(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=bt(i.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Zf(i,r);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(o,r,a,l)+10):(h=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;r.textAlign="left",r.textBaseline="middle";let f=-1,d=-h;return this.legendItems.forEach((g,p)=>{const y=i+e/2+r.measureText(g.text).width;(p===0||c[c.length-1]+y+2*a>o)&&(u+=h,c[c.length-(p>0?0:1)]=0,d+=h,f++),l[p]={left:0,top:d,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,e,i,s){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=o-t;let u=a,f=0,d=0,g=0,p=0;return this.legendItems.forEach((y,x)=>{const{itemWidth:m,itemHeight:v}=JA(i,e,r,y,s);x>0&&d+v+2*a>h&&(u+=f+a,c.push({width:f,height:d}),g+=f+a,p++,f=d=0),l[x]={left:g,top:d,col:p,width:m,height:v},f=Math.max(f,m),d+=v+a}),u+=f,c.push({width:f,height:d}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,o=ci(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ot(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=Ot(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=Ot(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=Ot(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ko(t,this),this._draw(),Jo(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:o}=t,a=ut.color,l=ci(t.rtl,this.left,this.width),c=bt(o.font),{padding:h}=o,u=c.size,f=u/2;let d;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:y}=Zf(o,u),x=function(w,S,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const P=B(M.lineWidth,1);if(s.fillStyle=B(M.fillStyle,a),s.lineCap=B(M.lineCap,"butt"),s.lineDashOffset=B(M.lineDashOffset,0),s.lineJoin=B(M.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=B(M.strokeStyle,a),s.setLineDash(B(M.lineDash,[])),o.usePointStyle){const A={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:P},k=l.xPlus(w,g/2),D=S+f;Rm(s,A,k,D,o.pointStyleWidth&&g)}else{const A=S+Math.max((u-p)/2,0),k=l.leftForLtr(w,g),D=Fn(M.borderRadius);s.beginPath(),Object.values(D).some(E=>E!==0)?Ts(s,{x:k,y:A,w:g,h:p,radius:D}):s.rect(k,A,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},m=function(w,S,M){Wn(s,M.text,w,S+y/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},v=this.isHorizontal(),b=this._computeTitleHeight();v?d={x:Ot(r,this.left+h,this.right-i[0]),y:this.top+h+b,line:0}:d={x:this.left+h,y:Ot(r,this.top+b+h,this.bottom-e[0].height),line:0},Vm(this.ctx,t.textDirection);const _=y+h;this.legendItems.forEach((w,S)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const M=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=o.textAlign)),A=g+f+M;let k=d.x,D=d.y;l.setWidth(this.width),v?S>0&&k+A+h>this.right&&(D=d.y+=_,d.line++,k=d.x=Ot(r,this.left+h,this.right-i[d.line])):S>0&&D+_>this.bottom&&(k=d.x=k+e[d.line].width+h,d.line++,D=d.y=Ot(r,this.top+b+h,this.bottom-e[d.line].height));const E=l.x(k);if(x(E,D,w),k=cM(P,k+g+f,v?k+A:this.right,t.rtl),m(l.x(k),D,w),v)d.x+=A+h;else if(typeof w.text!="string"){const T=c.lineHeight;d.y+=pb(w,T)+h}else d.y+=_}),jm(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=bt(e.font),s=Lt(e.padding);if(!e.display)return;const r=ci(t.rtl,this.left,this.width),o=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let h,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,u=Ot(t.align,u,this.right-f);else{const g=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);h=c+Ot(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const d=Ot(a,u,u+f);o.textAlign=r.textAlign(Tc(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Wn(o,e.text,d,h,i)}_computeTitleHeight(){const t=this.options.title,e=bt(t.font),i=Lt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Ie(t,this.left,this.right)&&Ie(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;ir.length>o.length?r:o)),t+e.size/2+i.measureText(s).width}function QA(n,t,e){let i=n;return typeof t.text!="string"&&(i=pb(t,e)),i}function pb(n,t){const e=n.text?n.text.length:0;return t*e}function tO(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var eO={id:"legend",_element:Qf,start(n,t,e){const i=n.legend=new Qf({ctx:n.ctx,options:e,chart:n});Ct.configure(n,i,e),Ct.addBox(n,i)},stop(n){Ct.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;Ct.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=Lt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class Hc extends Ve{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=st(i.text)?i.text.length:1;this._padding=Lt(i.padding);const r=s*bt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:o}=this,a=o.align;let l=0,c,h,u;return this.isHorizontal()?(h=Ot(a,i,r),u=e+t,c=r-i):(o.position==="left"?(h=i+t,u=Ot(a,s,e),l=ot*-.5):(h=r-t,u=Ot(a,e,s),l=ot*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=bt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);Wn(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Tc(e.align),textBaseline:"middle",translation:[o,a]})}}function nO(n,t){const e=new Hc({ctx:n.ctx,options:t,chart:n});Ct.configure(n,e,t),Ct.addBox(n,e),n.titleBlock=e}var iO={id:"title",_element:Hc,start(n,t,e){nO(n,e)},stop(n){const t=n.titleBlock;Ct.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;Ct.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const fr=new WeakMap;var sO={id:"subtitle",start(n,t,e){const i=new Hc({ctx:n.ctx,options:e,chart:n});Ct.configure(n,i,e),Ct.addBox(n,i),fr.set(n,i)},stop(n){Ct.removeBox(n,fr.get(n)),fr.delete(n)},beforeUpdate(n,t,e){const i=fr.get(n);Ct.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ls={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;ta+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;r-1?n.split(` +`):n}function rO(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function td(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=bt(t.bodyFont),c=bt(t.titleFont),h=bt(t.footerFont),u=r.length,f=s.length,d=i.length,g=Lt(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,q(n.title,v),e.font=l.string,q(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,q(i,b=>{q(b.before,v),q(b.lines,v),q(b.after,v)}),m=0,e.font=h.string,q(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function oO(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function aO(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function lO(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),aO(c,n,t,e)&&(c="center"),c}function ed(n,t,e){const i=e.yAlign||t.yAlign||oO(n,e);return{xAlign:e.xAlign||t.xAlign||lO(n,t,e,i),yAlign:i}}function cO(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function hO(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function nd(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=Fn(o);let g=cO(t,a);const p=hO(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:xt(g,0,i.width-t.width),y:xt(p,0,i.height-t.height)}}function dr(n,t,e){const i=Lt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function id(n){return fe([],Oe(n))}function uO(n,t,e){return fn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function sd(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const mb={beforeTitle:Pe,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?mb[t].call(e,i):s}var nl;let rd=(nl=class extends Ve{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new Xm(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=uO(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Ft(i,"beforeTitle",this,t),r=Ft(i,"title",this,t),o=Ft(i,"afterTitle",this,t);let a=[];return a=fe(a,Oe(s)),a=fe(a,Oe(r)),a=fe(a,Oe(o)),a}getBeforeBody(t,e){return id(Ft(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return q(t,r=>{const o={before:[],lines:[],after:[]},a=sd(i,r);fe(o.before,Oe(Ft(a,"beforeLabel",this,r))),fe(o.lines,Ft(a,"label",this,r)),fe(o.after,Oe(Ft(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return id(Ft(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ft(i,"beforeFooter",this,t),r=Ft(i,"footer",this,t),o=Ft(i,"afterFooter",this,t);let a=[];return a=fe(a,Oe(s)),a=fe(a,Oe(r)),a=fe(a,Oe(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),q(a,h=>{const u=sd(t.callbacks,h);s.push(Ft(u,"labelColor",this,h)),r.push(Ft(u,"labelPointStyle",this,h)),o.push(Ft(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=ls[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=td(this,i),c=Object.assign({},a,l),h=ed(this.chart,i,c),u=nd(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=Fn(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=ci(i.rtl,this.x,this.width);for(t.x=dr(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=bt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lm!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Ts(t,{x:p,y:g,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Ts(t,{x:y,y:g+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=o.backgroundColor,t.fillRect(y,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=bt(i.bodyFont);let f=u.lineHeight,d=0;const g=ci(i.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,S;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=dr(this,y,i),e.fillStyle=i.bodyColor,q(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=ls[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=td(this,t),l=Object.assign({},o,this._size),c=ed(e,t,l),h=nd(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Lt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),Vm(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),jm(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!bo(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!bo(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=ls[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}},C(nl,"positioners",ls),nl);var fO={id:"tooltip",_element:rd,positioners:ls,afterInit(n,t,e){e&&(n.tooltip=new rd({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:mb},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},dO=Object.freeze({__proto__:null,Colors:kA,Decimation:CA,Filler:qA,Legend:eO,SubTitle:sO,Title:iO,Tooltip:fO});const gO=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function pO(n,t,e,i){const s=n.indexOf(t);if(s===-1)return gO(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const mO=(n,t)=>n===null?null:xt(Math.round(n),0,t);function od(n){const t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},C(Er,"id","category"),C(Er,"defaults",{ticks:{callback:od}}),Er);function yO(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!U(o),m=!U(a),v=!U(c),b=(y-p)/(u+1);let _=Zu((y-p)/g/d)*d,w,S,M,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=Zu(P*_/g/d)*d),U(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(S=Math.floor(p/_)*_,M=Math.ceil(y/_)*_):(S=p,M=y),x&&m&&r&&nM((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,S=o,M=a):v?(S=x?o:S,M=m?a:M,P=c-1,_=(M-S)/P):(P=(M-S)/_,vs(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(Qu(_),Qu(S));w=Math.pow(10,U(l)?A:l),S=Math.round(S*w)/w,M=Math.round(M*w)/w;let k=0;for(x&&(f&&S!==o?(e.push({value:o}),Sa)break;e.push({value:D})}return m&&f&&M!==a?e.length&&vs(e[e.length-1].value,a,ad(a,b,n))?e[e.length-1].value=a:e.push({value:a}):(!m||M===a)&&e.push({value:M}),e}function ad(n,t,{horizontal:e,minRotation:i}){const s=ae(i),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+n).length;return Math.min(t/r,o)}let Mo=class extends Xs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return U(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=e?s:l,a=l=>r=i?r:l;if(t){const l=ye(s),c=ye(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=yO(s,r);return t.bounds==="ticks"&&km(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ys(t,this.chart.options.locale,this.options.ticks.format)}};var Lr;let _O=(Lr=class extends Mo{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?t:0,this.max=ht(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=ae(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},C(Lr,"id","linear"),C(Lr,"defaults",{ticks:{callback:qo.formatters.numeric}}),Lr);const $s=n=>Math.floor(Ze(n)),_n=(n,t)=>Math.pow(10,$s(n)+t);function ld(n){return n/Math.pow(10,$s(n))===1}function cd(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function vO(n,t){const e=t-n;let i=$s(e);for(;cd(n,t,i)>10;)i++;for(;cd(n,t,i)<10;)i--;return Math.min(i,$s(n))}function xO(n,{min:t,max:e}){t=Vt(n.min,t);const i=[],s=$s(t);let r=vO(t,e),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,r)),f=Vt(n.min,Math.round((l+h+u*Math.pow(10,r))*o)/o);for(;f=10?u=u<15?15:20:u++,u>=20&&(r++,u=2,o=r>=0?1:o),f=Math.round((l+h+u*Math.pow(10,r))*o)/o;const d=Vt(n.max,f);return i.push({value:d,major:ld(d),significand:u}),i}var Tr;let wO=(Tr=class extends Xs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Mo.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return ht(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?Math.max(0,t):null,this.max=ht(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ht(this._userMin)&&(this.min=t===_n(this.min,0)?_n(this.min,-1):_n(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=a=>i=t?i:a,o=a=>s=e?s:a;i===s&&(i<=0?(r(1),o(10)):(r(_n(i,-1)),o(_n(s,1)))),i<=0&&r(_n(s,-1)),s<=0&&o(_n(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=xO(e,this);return t.bounds==="ticks"&&km(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Ys(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ze(t),this._valueRange=Ze(this.max)-Ze(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ze(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},C(Tr,"id","logarithmic"),C(Tr,"defaults",{ticks:{callback:qo.formatters.logarithmic,major:{enabled:!0}}}),Tr);function Fl(n){const t=n.ticks;if(t.display&&n.display){const e=Lt(t.backdropPadding);return B(t.font&&t.font.size,ut.font.size)+e.height}return 0}function SO(n,t,e){return e=st(e)?e:[e],{w:_M(n,t.string,e),h:e.length*t.lineHeight}}function hd(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function MO(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?ot/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function PO(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=n.getPointPosition(t,i+s+o,r),c=Math.round(Ec(jt(l.angle+mt))),h=EO(l.y,a.h,c),u=CO(c),f=DO(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:f,top:h,right:f+a.w,bottom:h+a.h}}function AO(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(ze({x:e,y:i},t)||ze({x:e,y:r},t)||ze({x:s,y:i},t)||ze({x:s,y:r},t))}function OO(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:Fl(r)/2,additionalAngle:o?ot/s:0};let c;for(let h=0;h270||e<90)&&(n-=t),n}function LO(n,t,e){const{left:i,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!U(a)){const l=Fn(t.borderRadius),c=Lt(t.backdropPadding);n.fillStyle=a;const h=i-c.left,u=s-c.top,f=r-i+c.width,d=o-s+c.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),Ts(n,{x:h,y:u,w:f,h:d,radius:l}),n.fill()):n.fillRect(h,u,f,d)}}function TO(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const o=i.setContext(n.getPointLabelContext(s));LO(e,o,r);const a=bt(o.font),{x:l,y:c,textAlign:h}=r;Wn(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}function bb(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,rt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=nt(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?MO(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=rt/(this._pointLabels.length||1),i=this.options.startAngle||0;return jt(t*e+ae(i))}getDistanceFromCenterForValue(t){if(U(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(U(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(u),d=s.setContext(f),g=r.setContext(f);RO(this,d,l,o,g)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:f}=h;!f||!u||(t.lineWidth=f,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=bt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Lt(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}Wn(t,a.label,0,-r,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},C(ri,"id","radialLinear"),C(ri,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:qo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),C(ri,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),C(ri,"descriptors",{angleLines:{_fallback:"grid"}}),ri);const ta={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},zt=Object.keys(ta);function ud(n,t){return n-t}function fd(n,t){if(U(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),ht(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(mi(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function dd(n,t,e,i){const s=zt.length;for(let r=zt.indexOf(n);r=zt.indexOf(e);r--){const o=zt[r];if(ta[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return zt[e?zt.indexOf(e):0]}function BO(n){for(let t=zt.indexOf(n)+1,e=zt.length;t=t?e[i]:e[s];n[r]=!0}}function zO(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function pd(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=xt(e,0,o),i=xt(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||dd(r.minUnit,e,i,this._getLabelCapacity(e)),a=B(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=mi(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;f+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.ticks.callback;if(o)return nt(o,[t,e,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],f=i[e],d=c&&u&&f&&f.major;return this._adapter.format(t,s||(d?u:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Be(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Be(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}var $r;let NO=($r=class extends Il{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=gr(e,this.min),this._tableRange=gr(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;os-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(gr(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return gr(this._table,i*this._tableRange+this._minPos,!0)}},C($r,"id","timeseries"),C($r,"defaults",Il.defaults),$r);var WO=Object.freeze({__proto__:null,CategoryScale:bO,LinearScale:_O,LogarithmicScale:wO,RadialLinearScale:FO,TimeScale:Il,TimeSeriesScale:NO});const VO=[Nk,_A,dO,WO];/*! + * Chart.js v3.9.1 + * https://www.chartjs.org + * (c) 2022 Chart.js Contributors + * Released under the MIT License + */const jO=function(){let n=0;return function(){return n++}}();function J(n){return n===null||typeof n>"u"}function at(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function X(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const kt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Xt(n,t){return kt(n)?n:t}function Y(n,t){return typeof n>"u"?t:n}const HO=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,yb=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ct(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function K(n,t,e,i){let s,r,o;if(at(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function an(n,t){return(md[t]||(md[t]=XO(t)))(n)}function XO(n){const t=GO(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function GO(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Yc(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Qt=n=>typeof n<"u",ln=n=>typeof n=="function",bd=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function qO(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const dt=Math.PI,tt=2*dt,KO=tt+dt,Ao=Number.POSITIVE_INFINITY,JO=dt/180,ft=dt/2,Ii=dt/4,yd=dt*2/3,qt=Math.log10,_e=Math.sign;function _d(n){const t=Math.round(n);n=Ms(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(qt(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function ZO(n){const t=[],e=Math.sqrt(n);let i;for(i=1;is-r).pop(),t}function _i(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Ms(n,t,e){return Math.abs(n-t)=n}function vb(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Xc(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Cn=(n,t,e,i)=>Xc(n,e,i?s=>n[s][t]<=e:s=>n[s][t]Xc(n,e,i=>n[i][t]>=e);function iC(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+Yc(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function xd(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(wb.forEach(r=>{delete n[r]}),delete n._chartjs)}function Sb(n){const t=new Set;let e,i;for(e=0,i=n.length;e"u"?function(n){return n()}:window.requestAnimationFrame}();function kb(n,t,e){const i=e||(o=>Array.prototype.slice.call(o));let s=!1,r=[];return function(...o){r=i(o),s||(s=!0,Mb.call(window,()=>{s=!1,n.apply(t,r)}))}}function rC(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const oC=n=>n==="start"?"left":n==="end"?"right":"center",wd=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2;function Pb(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=Dt(Math.min(Cn(a,o.axis,c).lo,e?i:Cn(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=Dt(Math.max(Cn(a,o.axis,h,!0).hi+1,e?0:Cn(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Ab(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const pr=n=>n===0||n===1,Sd=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*tt/e)),Md=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*tt/e)+1,ks={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*ft)+1,easeOutSine:n=>Math.sin(n*ft),easeInOutSine:n=>-.5*(Math.cos(dt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>pr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>pr(n)?n:Sd(n,.075,.3),easeOutElastic:n=>pr(n)?n:Md(n,.075,.3),easeInOutElastic(n){return pr(n)?n:n<.5?.5*Sd(n*2,.1125,.45):.5+.5*Md(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-ks.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?ks.easeInBounce(n*2)*.5:ks.easeOutBounce(n*2-1)*.5+.5};/*! + * @kurkle/color v0.2.1 + * https://github.com/kurkle/color#readme + * (c) 2022 Jukka Kurkela + * Released under the MIT License + */function Gs(n){return n+.5|0}const tn=(n,t,e)=>Math.max(Math.min(n,e),t);function cs(n){return tn(Gs(n*2.55),0,255)}function sn(n){return tn(Gs(n*255),0,255)}function Te(n){return tn(Gs(n/2.55)/100,0,1)}function kd(n){return tn(Gs(n*100),0,100)}const Ut={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},zl=[..."0123456789ABCDEF"],aC=n=>zl[n&15],lC=n=>zl[(n&240)>>4]+zl[n&15],mr=n=>(n&240)>>4===(n&15),cC=n=>mr(n.r)&&mr(n.g)&&mr(n.b)&&mr(n.a);function hC(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Ut[n[1]]*17,g:255&Ut[n[2]]*17,b:255&Ut[n[3]]*17,a:t===5?Ut[n[4]]*17:255}:(t===7||t===9)&&(e={r:Ut[n[1]]<<4|Ut[n[2]],g:Ut[n[3]]<<4|Ut[n[4]],b:Ut[n[5]]<<4|Ut[n[6]],a:t===9?Ut[n[7]]<<4|Ut[n[8]]:255})),e}const uC=(n,t)=>n<255?t(n):"";function fC(n){var t=cC(n)?aC:lC;return n?"#"+t(n.r)+t(n.g)+t(n.b)+uC(n.a,t):void 0}const dC=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ob(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function gC(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function pC(n,t,e){const i=Ob(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function mC(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=mC(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function qc(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(sn)}function Kc(n,t,e){return qc(Ob,n,t,e)}function bC(n,t,e){return qc(pC,n,t,e)}function yC(n,t,e){return qc(gC,n,t,e)}function Cb(n){return(n%360+360)%360}function _C(n){const t=dC.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?cs(+t[5]):sn(+t[5]));const s=Cb(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=bC(s,r,o):t[1]==="hsv"?i=yC(s,r,o):i=Kc(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function vC(n,t){var e=Gc(n);e[0]=Cb(e[0]+t),e=Kc(e),n.r=e[0],n.g=e[1],n.b=e[2]}function xC(n){if(!n)return;const t=Gc(n),e=t[0],i=kd(t[1]),s=kd(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Te(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Pd={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ad={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function wC(){const n={},t=Object.keys(Ad),e=Object.keys(Pd);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let br;function SC(n){br||(br=wC(),br.transparent=[0,0,0,0]);const t=br[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const MC=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function kC(n){const t=MC.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?cs(o):tn(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?cs(i):tn(i,0,255)),s=255&(t[4]?cs(s):tn(s,0,255)),r=255&(t[6]?cs(r):tn(r,0,255)),{r:i,g:s,b:r,a:e}}}function PC(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Te(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Va=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Zn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function AC(n,t,e){const i=Zn(Te(n.r)),s=Zn(Te(n.g)),r=Zn(Te(n.b));return{r:sn(Va(i+e*(Zn(Te(t.r))-i))),g:sn(Va(s+e*(Zn(Te(t.g))-s))),b:sn(Va(r+e*(Zn(Te(t.b))-r))),a:n.a+e*(t.a-n.a)}}function yr(n,t,e){if(n){let i=Gc(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Kc(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Db(n,t){return n&&Object.assign(t||{},n)}function Od(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=sn(n[3]))):(t=Db(n,{r:0,g:0,b:0,a:1}),t.a=sn(t.a)),t}function OC(n){return n.charAt(0)==="r"?kC(n):_C(n)}class Co{constructor(t){if(t instanceof Co)return t;const e=typeof t;let i;e==="object"?i=Od(t):e==="string"&&(i=hC(t)||SC(t)||OC(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Db(this._rgb);return t&&(t.a=Te(t.a)),t}set rgb(t){this._rgb=Od(t)}rgbString(){return this._valid?PC(this._rgb):void 0}hexString(){return this._valid?fC(this._rgb):void 0}hslString(){return this._valid?xC(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=AC(this._rgb,t._rgb,e)),this}clone(){return new Co(this.rgb)}alpha(t){return this._rgb.a=sn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Gs(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return yr(this._rgb,2,t),this}darken(t){return yr(this._rgb,2,-t),this}saturate(t){return yr(this._rgb,1,t),this}desaturate(t){return yr(this._rgb,1,-t),this}rotate(t){return vC(this._rgb,t),this}}function Eb(n){return new Co(n)}function Lb(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Cd(n){return Lb(n)?n:Eb(n)}function ja(n){return Lb(n)?n:Eb(n).saturate(.5).darken(.1).hexString()}const Vn=Object.create(null),Nl=Object.create(null);function Ps(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ie.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,i)=>ja(i.backgroundColor),this.hoverBorderColor=(e,i)=>ja(i.borderColor),this.hoverColor=(e,i)=>ja(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return Ha(this,t,e)}get(t){return Ps(this,t)}describe(t,e){return Ha(Nl,t,e)}override(t,e){return Ha(Vn,t,e)}route(t,e,i,s){const r=Ps(this,t),o=Ps(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return X(l)?Object.assign({},c,l):Y(l,c)},set(l){this[a]=l}}})}}var H=new CC({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function DC(n){return!n||J(n.size)||J(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Do(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function EC(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function Bs(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,$C(n,r),l=0;l+n||0;function Jc(n,t){const e={},i=X(t),s=i?Object.keys(t):t,r=X(n)?i?o=>Y(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=NC(r(o));return e}function $b(n){return Jc(n,{top:"y",right:"x",bottom:"y",left:"x"})}function hi(n){return Jc(n,["topLeft","topRight","bottomLeft","bottomRight"])}function te(n){const t=$b(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ht(n,t){n=n||{},t=t||H.font;let e=Y(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=Y(n.style,t.style);i&&!(""+i).match(BC)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:Y(n.family,t.family),lineHeight:zC(Y(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:Y(n.weight,t.weight),string:""};return s.string=DC(s),s}function _r(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function gn(n,t){return Object.assign(Object.create(n),t)}function Zc(n,t=[""],e=n,i,s=()=>n[0]){Qt(i)||(i=zb("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:e,_fallback:i,_getTarget:s,override:o=>Zc([o,...n],t,e,i)};return new Proxy(r,{deleteProperty(o,a){return delete o[a],delete o._keys,delete n[0][a],!0},get(o,a){return Ib(o,a,()=>qC(a,t,n,o))},getOwnPropertyDescriptor(o,a){return Reflect.getOwnPropertyDescriptor(o._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,a){return Ld(o).includes(a)},ownKeys(o){return Ld(o)},set(o,a,l){const c=o._storage||(o._storage=s());return o[a]=c[a]=l,delete o._keys,!0}})}function vi(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:Fb(n,i),setContext:r=>vi(n,r,e,i),override:r=>vi(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return Ib(r,o,()=>jC(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function Fb(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:ln(e)?e:()=>e,isIndexable:ln(i)?i:()=>i}}const VC=(n,t)=>n?n+Yc(t):t,Qc=(n,t)=>X(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ib(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function jC(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return ln(a)&&o.isScriptable(t)&&(a=HC(t,a,n,e)),at(a)&&a.length&&(a=YC(t,a,n,o.isIndexable)),Qc(t,a)&&(a=vi(a,s,r&&r[t],o)),a}function HC(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);return a.add(n),t=t(r,o||i),a.delete(n),Qc(n,t)&&(t=th(s._scopes,s,n,t)),t}function YC(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(Qt(r.index)&&i(n))t=t[r.index%t.length];else if(X(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=th(c,s,n,h);t.push(vi(u,r,o&&o[n],a))}}return t}function Bb(n,t,e){return ln(n)?n(t,e):n}const UC=(n,t)=>n===!0?t:typeof n=="string"?an(t,n):void 0;function XC(n,t,e,i,s){for(const r of t){const o=UC(e,r);if(o){n.add(o);const a=Bb(o._fallback,e,s);if(Qt(a)&&a!==e&&a!==i)return a}else if(o===!1&&Qt(i)&&e!==i)return null}return!1}function th(n,t,e,i){const s=t._rootScopes,r=Bb(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=Ed(a,o,e,r||e,i);return l===null||Qt(r)&&r!==e&&(l=Ed(a,o,r,l,i),l===null)?!1:Zc(Array.from(a),[""],s,r,()=>GC(t,e,i))}function Ed(n,t,e,i,s){for(;e;)e=XC(n,t,e,i,s);return e}function GC(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return at(s)&&X(e)?e:s}function qC(n,t,e,i){let s;for(const r of t)if(s=zb(VC(r,n),e),Qt(s))return Qc(n,s)?th(e,i,n,s):s}function zb(n,t){for(const e of t){if(!e)continue;const i=e[n];if(Qt(i))return i}}function Ld(n){let t=n._keys;return t||(t=n._keys=KC(n._scopes)),t}function KC(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Nb(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function ZC(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=Bl(r,s),l=Bl(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function QC(n,t,e){const i=n.length;let s,r,o,a,l,c=xi(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")eD(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rwindow.getComputedStyle(n,null);function sD(n,t){return ea(n).getPropertyValue(t)}const rD=["top","right","bottom","left"];function Bn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=rD[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const oD=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function aD(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(oD(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Mn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=ea(e),r=s.boxSizing==="border-box",o=Bn(s,"padding"),a=Bn(s,"border","width"),{x:l,y:c,box:h}=aD(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function lD(n,t,e){let i,s;if(t===void 0||e===void 0){const r=eh(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=ea(r),l=Bn(a,"border","width"),c=Bn(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=To(a.maxWidth,r,"clientWidth"),s=To(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||Ao,maxHeight:s||Ao}}const Ya=n=>Math.round(n*10)/10;function cD(n,t,e,i){const s=ea(n),r=Bn(s,"margin"),o=To(s.maxWidth,n,"clientWidth")||Ao,a=To(s.maxHeight,n,"clientHeight")||Ao,l=lD(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=Bn(s,"border","width"),f=Bn(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?Math.floor(c/i):h-r.height),c=Ya(Math.min(c,o,l.maxWidth)),h=Ya(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Ya(c/2)),{width:c,height:h}}function Td(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=s/i,n.width=r/i;const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const hD=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return n}();function Rd(n,t){const e=sD(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function kn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function uD(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function fD(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=kn(n,s,e),a=kn(s,r,e),l=kn(r,t,e),c=kn(o,a,e),h=kn(a,l,e);return kn(c,h,e)}const $d=new Map;function dD(n,t){t=t||{};const e=n+JSON.stringify(t);let i=$d.get(e);return i||(i=new Intl.NumberFormat(n,t),$d.set(e,i)),i}function qs(n,t,e){return dD(t,e).format(n)}const gD=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},pD=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Ua(n,t,e){return n?gD(t,e):pD()}function mD(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function bD(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function jb(n){return n==="angle"?{between:Is,compare:tC,normalize:oe}:{between:Oo,compare:(t,e)=>t-e,normalize:t=>t}}function Fd({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function yD(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=jb(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),S=()=>!p||_();for(let M=h,P=h;M<=u;++M)m=t[M%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?M:P),y!==null&&S()&&(g.push(Fd({start:y,end:M,loop:f,count:o,style:d})),y=null),P=M,v=x));return y!==null&&g.push(Fd({start:y,end:u,loop:f,count:o,style:d})),g}function vD(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function wD(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function SD(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=xD(e,s,r,i);if(i===!0)return Id(n,[{start:o,end:a,loop:r}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Mb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ce=new PD;const zd="transparent",AD={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Cd(n||zd),s=i.valid&&Cd(t||zd);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class OD{constructor(t,e,i,s){const r=e[i];s=_r([t.to,s,r,t.from]);const o=_r([t.from,r,s]);this._active=!0,this._fn=t.fn||AD[t.type||typeof o],this._easing=ks[t.easing]||ks.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=_r([t.to,e,s,t.from]),this._from=_r([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});H.set("animations",{colors:{type:"color",properties:DD},numbers:{type:"number",properties:CD}});H.describe("animations",{_fallback:"animation"});H.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class Hb{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!X(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const s=t[i];if(!X(s))return;const r={};for(const o of ED)r[o]=s[o];(at(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!e.has(o))&&e.set(o,r)})})}_animateOptions(t,e){const i=e.options,s=TD(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&LD(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new OD(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Ce.add(this._chart,i),!0}}function LD(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function Hd(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=ID(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function ND(n,t){return gn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function WD(n,t,e){return gn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Bi(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e]}}}const Ga=n=>n==="reset"||n==="none",Yd=(n,t)=>t?n:Object.assign({},n),VD=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Yb(e,!0),values:null};class he{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Vd(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Bi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=Y(i.xAxisID,Xa(t,"x")),o=e.yAxisID=Y(i.yAxisID,Xa(t,"y")),a=e.rAxisID=Y(i.rAxisID,Xa(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&xd(this._data,this),t._stacked&&Bi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(X(e))this._data=FD(e);else if(i!==e){if(i){xd(i,this);const s=this._cachedMeta;Bi(s),s._parsed=[]}e&&Object.isExtensible(e)&&sC(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Vd(e.vScale,e),e.stack!==i.stack&&(s=!0,Bi(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Hd(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{at(s[t])?f=this.parseArrayData(i,s,t,e):X(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(Yd(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new Hb(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ga(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){Ga(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ga(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function HD(n){const t=n.iScale,e=jD(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(Qt(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function Ub(n,t,e,i){return at(n)?XD(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ud(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function qD(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(J(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,r=this.getParsed(t),o=i.getLabelForValue(r.x),a=s.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+o+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fIs(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>Is(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(ft,h,f),x=g(dt,c,u),m=g(dt+ft,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}class Ks extends he{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(X(i[t])){const{key:l="value"}=this._parsing;r=c=>+an(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?tt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=qs(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Ks.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let t=n.label;const e=": "+n.formattedValue;return at(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class sh extends he{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=Pb(e,s,o);this._drawStart=a,this._drawCount=l,Ab(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=_i(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none";let m=e>0&&this.getParsed(e-1);for(let v=e;v0&&Math.abs(_[f]-m[f])>y,p&&(w.parsed=_,w.raw=c.data[v]),u&&(w.options=h||this.resolveDataElementOptions(v,b.active?"active":s)),x||this.updateElement(b,v,w,s),m=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}sh.id="line";sh.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};sh.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class rh extends he{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=qs(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return Nb.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*dt;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?le(this.resolveDataElementOptions(t,e).angle||i):0}}rh.id="polarArea";rh.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};rh.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Xb extends Ks{}Xb.id="pie";Xb.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class oh extends he{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Nb.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}je.defaults={};je.defaultRoutes=void 0;const Gb={values(n){return at(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=t2(n,e)}const o=qt(Math.abs(r)),a=Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),qs(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(qt(n)));return i===1||i===2||i===5?Gb.numeric.call(this,n,t,e):""}};function t2(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var na={formatters:Gb};H.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,t)=>t.lineWidth,tickColor:(n,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:na.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});H.route("scale.ticks","color","","color");H.route("scale.grid","color","","borderColor");H.route("scale.grid","borderColor","","borderColor");H.route("scale.title","color","","color");H.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});H.describe("scales",{_fallback:"scale"});H.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function e2(n,t){const e=n.options.ticks,i=e.maxTicksLimit||n2(n),s=e.major.enabled?s2(t):[],r=s.length,o=s[0],a=s[r-1],l=[];if(r>i)return r2(t,l,s,r/i),l;const c=i2(s,t,i);if(r>0){let h,u;const f=r>1?Math.round((a-o)/(r-1)):null;for(xr(t,l,c,J(f)?0:o-f,o),h=0,u=r-1;hs)return l}return Math.max(s,1)}function s2(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,qd=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e;function Kd(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function c2(n,t){K(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:Xt(e,Xt(i,e)),max:Xt(i,Xt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ct(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=WC(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=Dt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-zi(t.grid)-e.padding-Jd(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=Uc(Math.min(Math.asin(Dt((h.highest.height+6)/a,-1,1)),Math.asin(Dt(l/c,-1,1))-Math.asin(Dt(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ct(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ct(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Jd(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=zi(r)+l):(t.height=this.maxHeight,t.width=zi(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=le(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ct(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[S]||0,height:o[S]||0});return{first:w(0),last:w(e-1),widest:w(b),highest:w(_),widths:r,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return eC(this._alignToPixels?vn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o}=s,a=r.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=zi(r),f=[],d=r.setContext(this.getContext()),g=d.drawBorder?d.borderWidth:0,p=g/2,y=function(O){return vn(i,O,g)};let x,m,v,b,_,w,S,M,P,A,k,D;if(o==="top")x=y(this.bottom),w=this.bottom-u,M=x-p,A=y(t.top)+p,D=t.bottom;else if(o==="bottom")x=y(this.top),A=t.top,D=y(t.bottom)-p,w=x+p,M=this.top+u;else if(o==="left")x=y(this.right),_=this.right-u,S=x-p,P=y(t.left)+p,k=t.right;else if(o==="right")x=y(this.left),P=t.left,k=y(t.right)-p,_=x+p,S=this.left+u;else if(e==="x"){if(o==="center")x=y((t.top+t.bottom)/2+.5);else if(X(o)){const O=Object.keys(o)[0],L=o[O];x=y(this.chart.scales[O].getPixelForValue(L))}A=t.top,D=t.bottom,w=x+p,M=w+u}else if(e==="y"){if(o==="center")x=y((t.left+t.right)/2);else if(X(o)){const O=Object.keys(o)[0],L=o[O];x=y(this.chart.scales[O].getPixelForValue(L))}_=x-p,S=_-u,P=t.left,k=t.right}const E=Y(s.ticks.maxTicksLimit,h),T=Math.max(1,Math.ceil(h/E));for(m=0;mr.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");H.route(r,s,l,a)})}function m2(n){return"id"in n&&"defaults"in n}class b2{constructor(){this.controllers=new wr(he,"datasets",!0),this.elements=new wr(je,"elements"),this.plugins=new wr(Object,"plugins"),this.scales=new wr(Yn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):K(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=Yc(t);ct(i["before"+s],[],i),e[t](i),ct(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(S.parsed=w,S.raw=c.data[b]),f&&(S.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,S,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}}ah.id="scatter";ah.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};ah.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function xn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vl{constructor(t){this.options=t||{}}init(t){}formats(){return xn()}parse(t,e){return xn()}format(t,e){return xn()}add(t,e,i){return xn()}diff(t,e,i){return xn()}startOf(t,e,i){return xn()}endOf(t,e){return xn()}}Vl.override=function(n){Object.assign(Vl.prototype,n)};var y2={_date:Vl};function _2(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?nC:Cn;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Js(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var S2={evaluateInteractionItems:Js,modes:{index(n,t,e,i){const s=Mn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?Ka(n,s,r,i,o):Ja(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=Mn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?Ka(n,s,r,i,o):Ja(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Qd(n,t){return n.filter(e=>qb.indexOf(e.pos)===-1&&e.box.axis===t)}function Wi(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function M2(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=Wi(Ni(t,"left"),!0),s=Wi(Ni(t,"right")),r=Wi(Ni(t,"top"),!0),o=Wi(Ni(t,"bottom")),a=Qd(t,"x"),l=Qd(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Ni(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function tg(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Kb(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function O2(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!X(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&Kb(o,r.getPadding());const a=Math.max(0,t.outerWidth-tg(o,n,"left","right")),l=Math.max(0,t.outerHeight-tg(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function C2(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function D2(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function hs(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);Kb(f,te(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=P2(l.concat(c),u);hs(a.fullSize,d,u,g),hs(l,d,u,g),hs(c,d,u,g)&&hs(l,d,u,g),C2(d),eg(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,eg(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},K(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class Jb{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class E2 extends Jb{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qr="$chartjs",L2={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ng=n=>n===null||n==="";function T2(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[qr]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",ng(s)){const r=Rd(n,"width");r!==void 0&&(n.width=r)}if(ng(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=Rd(n,"height");r!==void 0&&(n.height=r)}return n}const Zb=hD?{passive:!0}:!1;function R2(n,t,e){n.addEventListener(t,e,Zb)}function $2(n,t,e){n.canvas.removeEventListener(t,e,Zb)}function F2(n,t){const e=L2[n.type]||n.type,{x:i,y:s}=Mn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ro(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function I2(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Ro(a.addedNodes,i),o=o&&!Ro(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function B2(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Ro(a.removedNodes,i),o=o&&!Ro(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const zs=new Map;let ig=0;function Qb(){const n=window.devicePixelRatio;n!==ig&&(ig=n,zs.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function z2(n,t){zs.size||window.addEventListener("resize",Qb),zs.set(n,t)}function N2(n){zs.delete(n),zs.size||window.removeEventListener("resize",Qb)}function W2(n,t,e){const i=n.canvas,s=i&&eh(i);if(!s)return;const r=kb((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),z2(n,r),o}function Za(n,t,e){e&&e.disconnect(),t==="resize"&&N2(n)}function V2(n,t,e){const i=n.canvas,s=kb(r=>{n.ctx!==null&&e(F2(r,n))},n,r=>{const o=r[0];return[o,o.offsetX,o.offsetY]});return R2(i,t,s),s}class j2 extends Jb{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(T2(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[qr])return!1;const i=e[qr].initial;["height","width"].forEach(r=>{const o=i[r];J(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[qr],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:I2,detach:B2,resize:W2}[e]||V2;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Za,detach:Za,resize:Za}[e]||$2)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return cD(t,e,i,s)}isAttached(t){const e=eh(t);return!!(e&&e.isConnected)}}function H2(n){return!Vb()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?E2:j2}class Y2{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const r of t){const o=r.plugin,a=o[i],l=[e,s,r.options];if(ct(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){J(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=Y(i.options&&i.options.plugins,{}),r=U2(i);return s===!1&&!e?[]:G2(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function U2(n){const t={},e=[],i=Object.keys(be.plugins.items);for(let r=0;r{const l=i[a];if(!X(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=Hl(a,l),h=J2(c,s),u=e.scales||{};r[c]=r[c]||a,o[a]=Ss(Object.create(null),[{axis:c},l,u[c],u[h]])}),n.data.datasets.forEach(a=>{const l=a.type||n.type,c=a.indexAxis||jl(l,t),u=(Vn[l]||{}).scales||{};Object.keys(u).forEach(f=>{const d=K2(f,c),g=a[d+"AxisID"]||r[d]||d;o[g]=o[g]||Object.create(null),Ss(o[g],[{axis:d},i[g],u[f]])})}),Object.keys(o).forEach(a=>{const l=o[a];Ss(l,[H.scales[l.type],H.scale])}),o}function ty(n){const t=n.options||(n.options={});t.plugins=Y(t.plugins,{}),t.scales=Q2(n,t)}function ey(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function tE(n){return n=n||{},n.data=ey(n.data),ty(n),n}const sg=new Map,ny=new Set;function kr(n,t){let e=sg.get(n);return e||(e=t(),sg.set(n,e),ny.add(e)),e}const Vi=(n,t,e)=>{const i=an(t,e);i!==void 0&&n.add(i)};class eE{constructor(t){this._config=tE(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=ey(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ty(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return kr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return kr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return kr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return kr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Vi(l,t,u))),h.forEach(u=>Vi(l,s,u)),h.forEach(u=>Vi(l,Vn[r]||{},u)),h.forEach(u=>Vi(l,H,u)),h.forEach(u=>Vi(l,Nl,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ny.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Vn[e]||{},H.datasets[e]||{},{type:e},H,Nl]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=rg(this._resolverCache,t,s);let l=o;if(iE(o,e)){r.$shared=!1,i=ln(i)?i():i;const c=this.createResolver(t,i,a);l=vi(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=rg(this._resolverCache,t,i);return X(e)?vi(r,e,void 0,s):r}}function rg(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:Zc(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const nE=n=>X(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||ln(n[e]),!1);function iE(n,t){const{isScriptable:e,isIndexable:i}=Fb(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(ln(a)||nE(a))||o&&at(a))return!0}return!1}var sE="3.9.1";const rE=["top","bottom","left","right","chartArea"];function og(n,t){return n==="top"||n==="bottom"||rE.indexOf(n)===-1&&t==="x"}function ag(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function lg(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ct(e&&e.onComplete,[n],t)}function oE(n){const t=n.chart,e=t.options.animation;ct(e&&e.onProgress,[n],t)}function iy(n){return Vb()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const $o={},sy=n=>{const t=iy(n);return Object.values($o).filter(e=>e.canvas===t).pop()};function aE(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function lE(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}class lh{constructor(t,e){const i=this.config=new eE(e),s=iy(t),r=sy(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||H2(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=jO(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Y2,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=rC(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],$o[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ce.listen(this,"complete",lg),Ce.listen(this,"progress",oE),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return J(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Td(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Dd(this.canvas,this.ctx),this}stop(){return Ce.stop(this),this}resize(t,e){Ce.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Td(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ct(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};K(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=Hl(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),K(r,o=>{const a=o.options,l=a.id,c=Hl(l,a),h=Y(a.type,o.dtype);(a.position===void 0||og(a.position,c)!==og(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=be.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),K(s,(o,a)=>{o||delete i[a]}),K(i,o=>{Mr.configure(this,o,o.options),Mr.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ag("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){K(this.scales,t=>{Mr.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!bd(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;aE(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Mr.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],K(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=this.chartArea,o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&Tb(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&Rb(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Bs(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=S2.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=gn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);Qt(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ce.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};K(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){K(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},K(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!ko(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=qO(t),c=lE(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ct(r.onHover,[t,a,this],this),l&&ct(r.onClick,[t,a,this],this));const h=!ko(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}}const cg=()=>K(lh.instances,n=>n._plugins.invalidate()),He=!0;Object.defineProperties(lh,{defaults:{enumerable:He,value:H},instances:{enumerable:He,value:$o},overrides:{enumerable:He,value:Vn},registry:{enumerable:He,value:be},version:{enumerable:He,value:sE},getChart:{enumerable:He,value:sy},register:{enumerable:He,value:(...n)=>{be.add(...n),cg()}},unregister:{enumerable:He,value:(...n)=>{be.remove(...n),cg()}}});function ry(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+ft,i-ft),n.closePath(),n.clip()}function cE(n){return Jc(n,["outerStart","outerEnd","innerStart","innerEnd"])}function hE(n,t,e,i){const s=cE(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return Dt(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Dt(s.innerStart,0,o),innerEnd:Dt(s.innerEnd,0,o)}}function Qn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function Yl(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,L=u>0?u-i:0,R=(O+L)/2,Q=R!==0?g*R/(R+i):g;d=(g-Q)/2}const p=Math.max(.001,g*u-e/dt)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=hE(t,f,u,m-x),S=u-v,M=u-b,P=x+v/S,A=m-b/M,k=f+_,D=f+w,E=x+_/k,T=m-w/D;if(n.beginPath(),r){if(n.arc(o,a,u,P,A),b>0){const R=Qn(M,A,o,a);n.arc(R.x,R.y,b,A,m+ft)}const O=Qn(D,m,o,a);if(n.lineTo(O.x,O.y),w>0){const R=Qn(D,T,o,a);n.arc(R.x,R.y,w,m+ft,T+Math.PI)}if(n.arc(o,a,f,m-w/f,x+_/f,!0),_>0){const R=Qn(k,E,o,a);n.arc(R.x,R.y,_,E+Math.PI,x-ft)}const L=Qn(S,x,o,a);if(n.lineTo(L.x,L.y),v>0){const R=Qn(S,P,o,a);n.arc(R.x,R.y,v,x-ft,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,L=Math.sin(P)*u+a;n.lineTo(O,L);const R=Math.cos(A)*u+o,Q=Math.sin(A)*u+a;n.lineTo(R,Q)}n.closePath()}function uE(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){Yl(n,t,e,i,o+tt,s);for(let c=0;c=tt||Is(r,a,l),p=Oo(o,c+f,h+f);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+r)/2,u=(o+a+c+l)/2;return{x:e+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,r=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>tt?Math.floor(i/tt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=dt&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=uE(t,this,a,r,o);dE(t,this,a,r,l,o),t.restore()}}ch.id="arc";ch.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};ch.defaultRoutes={backgroundColor:"backgroundColor"};function oy(n,t,e=t){n.lineCap=Y(e.borderCapStyle,t.borderCapStyle),n.setLineDash(Y(e.borderDash,t.borderDash)),n.lineDashOffset=Y(e.borderDashOffset,t.borderDashOffset),n.lineJoin=Y(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=Y(e.borderWidth,t.borderWidth),n.strokeStyle=Y(e.borderColor,t.borderColor)}function gE(n,t,e){n.lineTo(e.x,e.y)}function pE(n){return n.stepped?TC:n.tension||n.cubicInterpolationMode==="monotone"?RC:gE}function ay(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function Ul(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?bE:mE}function yE(n){return n.stepped?uD:n.tension||n.cubicInterpolationMode==="monotone"?fD:kn}function _E(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),oy(n,t.options),n.stroke(s)}function vE(n,t,e,i){const{segments:s,options:r}=t,o=Ul(t);for(const a of s)oy(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const xE=typeof Path2D=="function";function wE(n,t,e,i){xE&&!t.options.segment?_E(n,t,e,i):vE(n,t,e,i)}class ia extends je{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;iD(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=SD(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=vD(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=yE(i);let c,h;for(c=0,h=o.length;cn!=="borderDash"&&n!=="fill"};function hg(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)-1?n.split(` +`):n}function OE(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function ug(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Ht(t.bodyFont),c=Ht(t.titleFont),h=Ht(t.footerFont),u=r.length,f=s.length,d=i.length,g=te(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,K(n.title,v),e.font=l.string,K(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,K(i,b=>{K(b.before,v),K(b.lines,v),K(b.after,v)}),m=0,e.font=h.string,K(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function CE(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function DE(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function EE(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),DE(c,n,t,e)&&(c="center"),c}function fg(n,t,e){const i=e.yAlign||t.yAlign||CE(n,e);return{xAlign:e.xAlign||t.xAlign||EE(n,t,e,i),yAlign:i}}function LE(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function TE(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function dg(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=hi(o);let g=LE(t,a);const p=TE(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:Dt(g,0,i.width-t.width),y:Dt(p,0,i.height-t.height)}}function Pr(n,t,e){const i=te(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function gg(n){return de([],De(n))}function RE(n,t,e){return gn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function pg(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}class $E extends je{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new Hb(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=RE(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=de(a,De(s)),a=de(a,De(r)),a=de(a,De(o)),a}getBeforeBody(t,e){return gg(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return K(t,r=>{const o={before:[],lines:[],after:[]},a=pg(i,r);de(o.before,De(a.beforeLabel.call(this,r))),de(o.lines,a.label.call(this,r)),de(o.after,De(a.afterLabel.call(this,r))),s.push(o)}),s}getAfterBody(t,e){return gg(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=de(a,De(s)),a=de(a,De(r)),a=de(a,De(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),K(a,h=>{const u=pg(t.callbacks,h);s.push(u.labelColor.call(this,h)),r.push(u.labelPointStyle.call(this,h)),o.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=Kr[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=ug(this,i),c=Object.assign({},a,l),h=fg(this.chart,i,c),u=dg(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=hi(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Ua(i.rtl,this.x,this.width);for(t.x=Pr(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=Ht(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Lo(t,{x:y,y:p,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Lo(t,{x,y:p+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=Ht(i.bodyFont);let f=u.lineHeight,d=0;const g=Ua(i.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,S;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=Pr(this,y,i),e.fillStyle=i.bodyColor,K(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=Kr[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=ug(this,t),l=Object.assign({},o,this._size),c=fg(e,t,l),h=dg(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=te(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),mD(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),bD(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!ko(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!ko(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=Kr[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}}$E.positioners=Kr;const FE=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function IE(n,t,e,i){const s=n.indexOf(t);if(s===-1)return FE(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const BE=(n,t)=>n===null?null:Dt(Math.round(n),0,t);class Xl extends Yn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(J(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:IE(i,t,Y(e,t),this._addedLabels),BE(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Xl.id="category";Xl.defaults={ticks:{callback:Xl.prototype.getLabelForValue}};function zE(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!J(o),m=!J(a),v=!J(c),b=(y-p)/(u+1);let _=_d((y-p)/g/d)*d,w,S,M,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=_d(P*_/g/d)*d),J(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(S=Math.floor(p/_)*_,M=Math.ceil(y/_)*_):(S=p,M=y),x&&m&&r&&QO((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,S=o,M=a):v?(S=x?o:S,M=m?a:M,P=c-1,_=(M-S)/P):(P=(M-S)/_,Ms(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(vd(_),vd(S));w=Math.pow(10,J(l)?A:l),S=Math.round(S*w)/w,M=Math.round(M*w)/w;let k=0;for(x&&(f&&S!==o?(e.push({value:o}),Ss=e?s:l,a=l=>r=i?r:l;if(t){const l=_e(s),c=_e(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=1;(r>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(r*.05)),a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=zE(s,r);return t.bounds==="ticks"&&vb(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return qs(t,this.chart.options.locale,this.options.ticks.format)}}class cy extends Fo{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?t:0,this.max=kt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=le(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}cy.id="linear";cy.defaults={ticks:{callback:na.formatters.numeric}};function bg(n){return n/Math.pow(10,Math.floor(qt(n)))===1}function NE(n,t){const e=Math.floor(qt(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),s=[];let r=Xt(n.min,Math.pow(10,Math.floor(qt(t.min)))),o=Math.floor(qt(r)),a=Math.floor(r/Math.pow(10,o)),l=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:r,major:bg(r)}),++a,a===10&&(a=1,++o,l=o>=0?1:l),r=Math.round(a*Math.pow(10,o)*l)/l;while(o0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?Math.max(0,t):null,this.max=kt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=l=>i=t?i:l,o=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(qt(l))+c);i===s&&(i<=0?(r(1),o(10)):(r(a(i,-1)),o(a(s,1)))),i<=0&&r(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&r(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=NE(e,this);return t.bounds==="ticks"&&vb(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":qs(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=qt(t),this._valueRange=qt(this.max)-qt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(qt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}hy.id="logarithmic";hy.defaults={ticks:{callback:na.formatters.logarithmic,major:{enabled:!0}}};function Gl(n){const t=n.ticks;if(t.display&&n.display){const e=te(t.backdropPadding);return Y(t.font&&t.font.size,H.font.size)+e.height}return 0}function WE(n,t,e){return e=at(e)?e:[e],{w:EC(n,t.string,e),h:e.length*t.lineHeight}}function yg(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function VE(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?dt/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function HE(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,o=Gl(r)/2,a=n.drawingArea,l=r.pointLabels.centerPointLabels?dt/s:0;for(let c=0;c270||e<90)&&(n-=t),n}function GE(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=i.setContext(n.getPointLabelContext(s)),o=Ht(r.font),{x:a,y:l,textAlign:c,left:h,top:u,right:f,bottom:d}=n._pointLabelItems[s],{backdropColor:g}=r;if(!J(g)){const p=hi(r.borderRadius),y=te(r.backdropPadding);e.fillStyle=g;const x=h-y.left,m=u-y.top,v=f-h+y.width,b=d-u+y.height;Object.values(p).some(_=>_!==0)?(e.beginPath(),Lo(e,{x,y:m,w:v,h:b,radius:p}),e.fill()):e.fillRect(x,m,v,b)}Eo(e,n._pointLabels[s],a,l+o.lineHeight/2,o,{color:r.color,textAlign:c,textBaseline:"middle"})}}function uy(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,tt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=ct(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?VE(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=tt/(this._pointLabels.length||1),i=this.options.startAngle||0;return oe(t*e+le(i))}getDistanceFromCenterForValue(t){if(J(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(J(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));qE(this,u,a,r)}}),i.display){for(t.save(),o=r-1;o>=0;o--){const c=i.setContext(this.getPointLabelContext(o)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=Ht(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=te(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}Eo(t,a.label,0,-r,h,{color:c.color})}),t.restore()}drawTitle(){}}sa.id="radialLinear";sa.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:na.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};sa.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};sa.descriptors={angleLines:{_fallback:"grid"}};const ra={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Nt=Object.keys(ra);function JE(n,t){return n-t}function _g(n,t){if(J(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),kt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(_i(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function vg(n,t,e,i){const s=Nt.length;for(let r=Nt.indexOf(n);r=Nt.indexOf(e);r--){const o=Nt[r];if(ra[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return Nt[e?Nt.indexOf(e):0]}function QE(n){for(let t=Nt.indexOf(n)+1,e=Nt.length;t=t?e[i]:e[s];n[r]=!0}}function tL(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function wg(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Dt(e,0,o),i=Dt(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||vg(r.minUnit,e,i,this._getLabelCapacity(e)),a=Y(r.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=_i(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;fp-y).map(p=>+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&o[a],h=l&&o[l],u=i[e],f=l&&h&&u&&u.major,d=this._adapter.format(t,s||(f?h:c)),g=r.ticks.callback;return g?ct(g,[d,e,i],this):d}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Cn(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Cn(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class fy extends oa{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ar(e,this.min),this._tableRange=Ar(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o{}};function dy(){for(var n,t=0,e=arguments.length,i={};t=0&&(i=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}function iL(n,t){for(var e,i=0,s=n.length;i0)for(var e,i,s=new Array(e),r=0;r=0&&(t=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),Mg.hasOwnProperty(t)?{space:Mg[t],local:n}:n}function sL(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===ql&&t.documentElement.namespaceURI===ql?t.createElement(n):t.createElementNS(e,n)}}function rL(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function kg(n){var t=gy(n);return(t.local?rL:sL)(t)}function oL(){}function Pg(n){return n==null?oL:function(){return this.querySelector(n)}}function aL(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function lL(){return[]}function Ag(n){return function(t){return t.matches(n)}}var cL=Array.prototype.find;function hL(){return this.firstElementChild}var uL=Array.prototype.filter;function fL(){return Array.from(this.children)}function Og(n){return new Array(n.length)}function Io(n,t){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=t}function dL(n){return function(){return n}}function gL(n,t,e,i,s,r){for(var o,a=0,l=t.length,c=r.length;at?1:n>=t?0:NaN}function _L(n){return function(){this.removeAttribute(n)}}function vL(n){return function(){this.removeAttributeNS(n.space,n.local)}}function xL(n,t){return function(){this.setAttribute(n,t)}}function wL(n,t){return function(){this.setAttributeNS(n.space,n.local,t)}}function SL(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function ML(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function py(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function kL(n){return function(){this.style.removeProperty(n)}}function PL(n,t,e){return function(){this.style.setProperty(n,t,e)}}function AL(n,t,e){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,e)}}function OL(n,t){return n.style.getPropertyValue(t)||py(n).getComputedStyle(n,null).getPropertyValue(t)}function CL(n){return function(){delete this[n]}}function DL(n,t){return function(){this[n]=t}}function EL(n,t){return function(){var e=t.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function my(n){return n.trim().split(/^|\s+/)}function fh(n){return n.classList||new by(n)}function by(n){this._node=n,this._names=my(n.getAttribute("class")||"")}function yy(n,t){for(var e=fh(n),i=-1,s=t.length;++i=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}function GL(n){return function(){var t=this.__on;if(t){for(var e,i=0,s=-1,r=t.length;i=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var ZL=[null];function Gt(n,t){this._groups=n,this._parents=t}function us(n){return typeof n=="string"?new Gt([[document.querySelector(n)]],[document.documentElement]):new Gt([[n]],ZL)}function Cg(n,t){if(n=function(r){let o;for(;o=r.sourceEvent;)r=o;return r}(n),t===void 0&&(t=n.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop]}}return[n.pageX,n.pageY]}Gt.prototype={constructor:Gt,select:function(n){typeof n!="function"&&(n=Pg(n));for(var t=this._groups,e=t.length,i=new Array(e),s=0;s=_&&(_=b+1);!(v=y[_])&&++_=0;)(i=s[r])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(n){function t(u,f){return u&&f?n(u.__data__,f.__data__):!u-!f}n||(n=yL);for(var e=this._groups,i=e.length,s=new Array(i),r=0;r1?this.each((t==null?kL:typeof t=="function"?AL:PL)(n,t,e??"")):OL(this.node(),n)},property:function(n,t){return arguments.length>1?this.each((t==null?CL:typeof t=="function"?EL:DL)(n,t)):this.node()[n]},classed:function(n,t){var e=my(n+"");if(arguments.length<2){for(var i=fh(this.node()),s=-1,r=e.length;++s()=>n;function Kl(n,{sourceEvent:t,subject:e,target:i,identifier:s,active:r,x:o,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function tT(n){return!n.ctrlKey&&!n.button}function eT(){return this.parentNode}function nT(n,t){return t??{x:n.x,y:n.y}}function iT(){return navigator.maxTouchPoints||"ontouchstart"in this}function sT(){var n,t,e,i,s=tT,r=eT,o=nT,a=iT,l={},c=dy("start","drag","end"),h=0,u=0;function f(b){b.on("mousedown.drag",d).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,QL).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(b,_){if(!i&&s.call(this,b,_)){var w=v(this,r.call(this,b,_),b,_,"mouse");w&&(us(b.view).on("mousemove.drag",g,ji).on("mouseup.drag",p,ji),function(S){var M=S.document.documentElement,P=us(S).on("dragstart.drag",ti,ji);"onselectstart"in M?P.on("selectstart.drag",ti,ji):(M.__noselect=M.style.MozUserSelect,M.style.MozUserSelect="none")}(b.view),el(b),e=!1,n=b.clientX,t=b.clientY,w("start",b))}}function g(b){if(ti(b),!e){var _=b.clientX-n,w=b.clientY-t;e=_*_+w*w>u}l.mouse("drag",b)}function p(b){us(b.view).on("mousemove.drag mouseup.drag",null),function(_,w){var S=_.document.documentElement,M=us(_).on("dragstart.drag",null);w&&(M.on("click.drag",ti,ji),setTimeout(function(){M.on("click.drag",null)},0)),"onselectstart"in S?M.on("selectstart.drag",null):(S.style.MozUserSelect=S.__noselect,delete S.__noselect)}(b.view,e),ti(b),l.mouse("end",b)}function y(b,_){if(s.call(this,b,_)){var w,S,M=b.changedTouches,P=r.call(this,b,_),A=M.length;for(w=0;wt.scales[me].max?t.scales[me].max:r,r=rt.scales[Re].max?t.scales[Re].max:o,o=o{if(It){ei=It.datasetIndex,Pn=It.index,Jl=!0;let s=t.data.datasets[ei].data[Pn];Bo==="radar"||Bo==="polarArea"?s=function(r,o){let a,l,c;r.touches?(a=r.touches[0].clientX-o.canvas.getBoundingClientRect().left,l=r.touches[0].clientY-o.canvas.getBoundingClientRect().top):(a=r.clientX-o.canvas.getBoundingClientRect().left,l=r.clientY-o.canvas.getBoundingClientRect().top);let h=o.scales[Xe],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),f=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/f:h.min+u/f,c=zo(c,o.config.options.plugins.dragData.round),c=c>o.scales[Xe].max?o.scales[Xe].max:c,c=c((i,s,r)=>{if(It=s.getElementsAtEventForMode(i,"nearest",{intersect:!0},!1)[0],Bo=s.config.type,It){let o=It.datasetIndex,a=It.index;Dg=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[o],c=s.getDatasetMeta(o);let h=l.data[a];if(me=c.xAxisID,Re=c.yAxisID,Xe=c.rAxisID,l.dragData===!1||s.config.options.scales[me]&&s.config.options.scales[me].dragData===!1||s.config.options.scales[Re]&&s.config.options.scales[Re].dragData===!1||s.config.options.scales[Xe]&&s.config.options.scales[Xe].rAxisID===!1||l.data[It.index].dragData===!1)return void(It=null);if(Bo==="bar"){xy=s.config.options.scales[me].stacked;const u=s.data.datasets[0].data[0];wy=u!==null&&Array.isArray(u)&&u.length==2,Sy=Zl(i,s,o,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof r=="function"&&It&&r(i,o,a,h)===!1&&(It=null)}})(e.sourceEvent,n,t.onDragStart)).on("drag",e=>rT(e.sourceEvent,n,t,t.onDrag)).on("end",e=>((i,s,r)=>{if(Pn=void 0,Jl=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=Dg,s.update("none")),typeof r=="function"&&It){const o=It.datasetIndex,a=It.index;let l=function(c,h,u){const f=c.config.options.plugins.dragData;if(!f.magnet)return c.data.datasets[h].data[u];{const d=f.magnet;if(d.to&&typeof d.to=="function"){let g=c.data.datasets[h].data[u];return g=d.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,o,a);return r(i,o,a,l)}})(e.sourceEvent,n,t.onDragEnd)))}},beforeEvent:function(n){if(Jl)return n.tooltip&&n.tooltip.update(),!1}};lh.register(My);function oT(n){let t,e,i,s,r;return{c(){t=I("canvas"),e=pt(),i=I("canvas"),Ge(t,"width","100%"),Ge(t,"height","400px"),Ge(i,"width","100%"),Ge(i,"height","300px")},m(o,a){z(o,t,a),z(o,e,a),z(o,i,a),s||(r=[gh(n[0].call(null,t)),gh(n[1].call(null,i))],s=!0)},p:yt,i:yt,o:yt,d(o){o&&(N(t),N(e),N(i)),s=!1,cn(r)}}}function aT(n,t,e){as.register(...VO),as.register(My);let{lts:i}=t,{nearbyAmenities:s}=t,{greenspace:r}=t;const o=Hg();let a=null,l=["red","blue","green"];c();function c(){let f=i+s+r;e(2,i=100*i/f),e(3,s=100*s/f),e(4,r=100*r/f),a&&(a.data.datasets[0].data=[i,s,r],a.update())}function h(f){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],pointHitRadius:25}]},options:{responsive:!1,onHover(g){const p=g.chart.getElementsAtEventForMode(g,"nearest",{intersect:!0},!1);g.native.target.style.cursor=p.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(g){g.target.style.cursor="grabbing"},onDragEnd(g,p,y,x){g.target.style.cursor="default",y==0?e(2,i=x):y==1?e(3,s=x):y==2&&e(4,r=x),c(),o("change","")}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:l,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new as(f.getContext("2d"),d)}function u(f){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],backgroundColor:l}]},options:{indexAxis:"y"}};a=new as(f.getContext("2d"),d)}return n.$$set=f=>{"lts"in f&&e(2,i=f.lts),"nearbyAmenities"in f&&e(3,s=f.nearbyAmenities),"greenspace"in f&&e(4,r=f.greenspace)},[h,u,i,s,r]}class lT extends Ne{constructor(t){super(),We(this,t,aT,oT,xe,{lts:2,nearbyAmenities:3,greenspace:4})}}function Eg(n,t,e){const i=n.slice();return i[24]=t[e],i[29]=t,i[30]=e,i}function Lg(n,t,e){const i=n.slice();return i[24]=t[e],i[27]=t,i[28]=e,i}function Tg(n,t,e){const i=n.slice();return i[24]=t[e],i[25]=t,i[26]=e,i}function cT(n){let t,e,i,s,r,o,a,l,c,h,u,f,d,g;function p(_){n[15](_)}function y(_){n[16](_)}function x(_){n[17](_)}let m={};n[3].tradeoff_lts!==void 0&&(m.lts=n[3].tradeoff_lts),n[3].tradeoff_amenities!==void 0&&(m.nearbyAmenities=n[3].tradeoff_amenities),n[3].tradeoff_greenspace!==void 0&&(m.greenspace=n[3].tradeoff_greenspace),t=new lT({props:m}),fs.push(()=>Fr(t,"lts",p)),fs.push(()=>Fr(t,"nearbyAmenities",y)),fs.push(()=>Fr(t,"greenspace",x)),t.$on("change",n[18]);let v=ui(n[6]),b=[];for(let _=0;_e=!1)),!i&&w&8&&(i=!0,S.nearbyAmenities=_[3].tradeoff_amenities,Ir(()=>i=!1)),!s&&w&8&&(s=!0,S.greenspace=_[3].tradeoff_greenspace,Ir(()=>s=!1)),t.$set(S),w&73){v=ui(_[6]);let M;for(M=0;Mconfig.json + file`,g=pt(),p=I("pre"),y=$t('"cost": '),m=$t(x),v=pt(),b=I("button"),b.textContent="See cost function JSON",_=pt(),S&&S.c(),M=Ns(),r.__value="Distance",vt(r,r.__value),o.__value="Generalized",vt(o,o.__value),a.__value="ByLTS",vt(a,a.__value),l.__value="OsmHighwayType",vt(l,l.__value),n[1]===void 0&&Yg(()=>n[7].call(s))},m(O,L){z(O,t,L),F(t,e),F(e,i),F(e,s),F(s,r),F(s,o),F(s,a),F(s,l),Zr(s,n[1],!0),z(O,c,L),z(O,h,L),F(h,u),F(h,f),F(h,d),F(h,g),F(h,p),F(p,y),F(p,m),n[9](h),z(O,v,L),z(O,b,L),z(O,_,L),~w&&E[w].m(O,L),z(O,M,L),P=!0,A||(k=[St(s,"change",n[7]),St(u,"click",n[8]),St(b,"click",n[10])],A=!0)},p(O,[L]){L&2&&Zr(s,O[1]),(!P||L&1)&&x!==(x=JSON.stringify(O[0],null,2)+"")&&Ws(m,x);let R=w;w=T(O),w===R?~w&&E[w].p(O,L):(S&&(No(),Mt(E[R],1,1,()=>{E[R]=null}),Wo()),~w?(S=E[w],S?S.p(O,L):(S=E[w]=D[w](O),S.c()),wt(S,1),S.m(M.parentNode,M)):S=null)},i(O){P||(wt(S),P=!0)},o(O){Mt(S),P=!1},d(O){O&&(N(t),N(c),N(h),N(v),N(b),N(_),N(M)),n[9](null),~w&&E[w].d(O),A=!1,cn(k)}}}function dT(n,t,e){let{cost:i}=t,s,r="Distance",o={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},a=["lts1","lts2","lts3","lts4"],l={lts1:1,lts2:1,lts3:1,lts4:1},c={};for(let k of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])c[k]=1;function h(k){k=="OsmHighwayType"?e(0,i={OsmHighwayType:c}):k=="ByLTS"?e(0,i={ByLTS:l}):k=="Generalized"?e(0,i={Generalized:o}):e(0,i=k)}function u(){r=Ug(this),e(1,r)}const f=()=>s.close();function d(k){fs[k?"unshift":"push"](()=>{s=k,e(2,s)})}const g=()=>s.showModal();function p(k){c[k]=On(this.value),e(5,c)}const y=()=>e(0,i);function x(k){l[k]=On(this.value),e(4,l)}const m=()=>e(0,i);function v(k){n.$$.not_equal(o.tradeoff_lts,k)&&(o.tradeoff_lts=k,e(3,o))}function b(k){n.$$.not_equal(o.tradeoff_amenities,k)&&(o.tradeoff_amenities=k,e(3,o))}function _(k){n.$$.not_equal(o.tradeoff_greenspace,k)&&(o.tradeoff_greenspace=k,e(3,o))}const w=()=>e(0,i);function S(k){o[k]=On(this.value),e(3,o)}const M=()=>e(0,i);function P(){o.minimum_amenities=On(this.value),e(3,o)}const A=()=>e(0,i);return n.$$set=k=>{"cost"in k&&e(0,i=k.cost)},n.$$.update=()=>{n.$$.dirty&2&&h(r)},[i,r,s,o,l,c,a,u,f,d,g,p,y,x,m,v,b,_,w,S,M,P,A]}class nR extends Ne{constructor(t){super(),We(this,t,dT,fT,xe,{cost:0})}}export{xT as C,jy as G,vT as J,bT as L,_T as O,yT as P,xS as _,nR as a}; diff --git a/assets/CostFunction-a1f3b94f.js b/assets/CostFunction-a1f3b94f.js deleted file mode 100644 index 5cd103d..0000000 --- a/assets/CostFunction-a1f3b94f.js +++ /dev/null @@ -1,48 +0,0 @@ -var vd=Object.defineProperty;var wd=(i,t,e)=>t in i?vd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var D=(i,t,e)=>(wd(i,typeof t!="symbol"?t+"":t,e),e);import{S as ke,i as Se,s as he,X as Md,x as Cn,y as Hs,c as ci,a as hi,A as js,t as yt,b as vt,d as ui,Y as Nh,G as Vh,J as Wh,K as Hh,N as jh,Z as vi,aj as kd,ak as Sd,D as Jn,l as $,r as ko,u as So,v as N,al as Pd,T as An,ac as Cd,U as $o,am as $a,E as mt,e as B,g as Ot,h as Dt,n as I,ab as Zn,an as Ad,ao as Yh,ap as Dd,$ as Xh,f as dt,z as Le,q as xt,w as je,a3 as Od,a5 as Ld,Q as Uh,j as bt,k as qh,p as Js,C as Gh,I as Na,V as ai,aq as Fi,ar as Yr,ag as Kh}from"./Layout-663a57a0.js";function Td(i){let t;const e=i[15].default,n=Vh(e,i,i[23],null);return{c(){n&&n.c()},m(s,o){n&&n.m(s,o),t=!0},p(s,o){n&&n.p&&(!t||o&8388608)&&Wh(n,e,s,s[23],t?jh(e,s[23],o,null):Hh(s[23]),null)},i(s){t||(yt(n,s),t=!0)},o(s){vt(n,s),t=!1},d(s){n&&n.d(s)}}}function Ed(i){let t,e,n;function s(r){i[16](r)}let o={id:i[1],type:"fill",source:i[2],sourceLayer:i[3],beforeId:i[4],beforeLayerType:i[5],paint:i[6],layout:i[7],filter:i[8],minzoom:i[9],maxzoom:i[10],hoverCursor:i[11],manageHoverState:i[12],eventsIfTopMost:i[13],interactive:i[14],$$slots:{default:[Td]},$$scope:{ctx:i}};return i[0]!==void 0&&(o.hovered=i[0]),t=new Md({props:o}),Cn.push(()=>Hs(t,"hovered",s)),t.$on("click",i[17]),t.$on("dblclick",i[18]),t.$on("contextmenu",i[19]),t.$on("mouseenter",i[20]),t.$on("mousemove",i[21]),t.$on("mouseleave",i[22]),{c(){ci(t.$$.fragment)},m(r,a){hi(t,r,a),n=!0},p(r,[a]){const l={};a&2&&(l.id=r[1]),a&4&&(l.source=r[2]),a&8&&(l.sourceLayer=r[3]),a&16&&(l.beforeId=r[4]),a&32&&(l.beforeLayerType=r[5]),a&64&&(l.paint=r[6]),a&128&&(l.layout=r[7]),a&256&&(l.filter=r[8]),a&512&&(l.minzoom=r[9]),a&1024&&(l.maxzoom=r[10]),a&2048&&(l.hoverCursor=r[11]),a&4096&&(l.manageHoverState=r[12]),a&8192&&(l.eventsIfTopMost=r[13]),a&16384&&(l.interactive=r[14]),a&8388608&&(l.$$scope={dirty:a,ctx:r}),!e&&a&1&&(e=!0,l.hovered=r[0],js(()=>e=!1)),t.$set(l)},i(r){n||(yt(t.$$.fragment,r),n=!0)},o(r){vt(t.$$.fragment,r),n=!1},d(r){ui(t,r)}}}function Rd(i,t,e){let{$$slots:n={},$$scope:s}=t,{id:o=Nh("fill")}=t,{source:r=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:_=!1}=t,{hovered:v=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:x=!0}=t;function b(S){v=S,e(0,v)}function y(S){vi.call(this,i,S)}function w(S){vi.call(this,i,S)}function M(S){vi.call(this,i,S)}function k(S){vi.call(this,i,S)}function P(S){vi.call(this,i,S)}function C(S){vi.call(this,i,S)}return i.$$set=S=>{"id"in S&&e(1,o=S.id),"source"in S&&e(2,r=S.source),"sourceLayer"in S&&e(3,a=S.sourceLayer),"beforeId"in S&&e(4,l=S.beforeId),"beforeLayerType"in S&&e(5,c=S.beforeLayerType),"paint"in S&&e(6,h=S.paint),"layout"in S&&e(7,u=S.layout),"filter"in S&&e(8,f=S.filter),"minzoom"in S&&e(9,d=S.minzoom),"maxzoom"in S&&e(10,g=S.maxzoom),"hoverCursor"in S&&e(11,p=S.hoverCursor),"manageHoverState"in S&&e(12,_=S.manageHoverState),"hovered"in S&&e(0,v=S.hovered),"eventsIfTopMost"in S&&e(13,m=S.eventsIfTopMost),"interactive"in S&&e(14,x=S.interactive),"$$scope"in S&&e(23,s=S.$$scope)},[v,o,r,a,l,c,h,u,f,d,g,p,_,m,x,n,b,y,w,M,k,P,C,s]}class Fd extends ke{constructor(t){super(),Se(this,t,Rd,Ed,he,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function Id(i,t,e,n,s){let o=!1;i.getSource(t)&&(o=!0,i.removeSource(t));const r=()=>{n(t)&&(i.addSource(t,e),s())};if(o){const a=()=>{t&&(i.getSource(t)?setTimeout(a,1):r())};a()}else r()}function Bd(i,t,e){kd().then(()=>{let n=Sd(i);if(!n)return;n.getSource(t)===e&&n.removeSource(t)})}function Va(i){let t=i[0],e,n,s=Wa(i);return{c(){s.c(),e=Jn()},m(o,r){s.m(o,r),$(o,e,r),n=!0},p(o,r){r&1&&he(t,t=o[0])?(ko(),vt(s,1,1,mt),So(),s=Wa(o),s.c(),yt(s,1),s.m(e.parentNode,e)):s.p(o,r)},i(o){n||(yt(s),n=!0)},o(o){vt(s),n=!1},d(o){o&&N(e),s.d(o)}}}function Wa(i){let t;const e=i[15].default,n=Vh(e,i,i[14],null);return{c(){n&&n.c()},m(s,o){n&&n.m(s,o),t=!0},p(s,o){n&&n.p&&(!t||o&16384)&&Wh(n,e,s,s[14],t?jh(e,s[14],o,null):Hh(s[14]),null)},i(s){t||(yt(n,s),t=!0)},o(s){vt(n,s),t=!1},d(s){n&&n.d(s)}}}function zd(i){let t,e,n=i[0]&&Va(i);return{c(){n&&n.c(),t=Jn()},m(s,o){n&&n.m(s,o),$(s,t,o),e=!0},p(s,[o]){s[0]?n?(n.p(s,o),o&1&&yt(n,1)):(n=Va(s),n.c(),yt(n,1),n.m(t.parentNode,t)):n&&(ko(),vt(n,1,1,()=>{n=null}),So())},i(s){e||(yt(n),e=!0)},o(s){vt(n),e=!1},d(s){s&&N(t),n&&n.d(s)}}}function $d(i,t,e){let n,s,o,{$$slots:r={},$$scope:a}=t,{id:l=Nh("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:_,self:v}=Pd();An(i,p,b=>e(13,s=b)),An(i,_,b=>e(16,o=b)),An(i,v,b=>e(0,n=b));let m,x=!0;return Cd(()=>{n&&m&&s&&(Bd(p,n,m),$o(v,n=null,n),e(11,m=void 0))}),i.$$set=b=>{"id"in b&&e(4,l=b.id),"data"in b&&e(5,c=b.data),"generateId"in b&&e(6,h=b.generateId),"promoteId"in b&&e(7,u=b.promoteId),"filter"in b&&e(8,f=b.filter),"lineMetrics"in b&&e(9,d=b.lineMetrics),"cluster"in b&&e(10,g=b.cluster),"$$scope"in b&&e(14,a=b.$$scope)},i.$$.update=()=>{i.$$.dirty&1024&&$o(_,o=g,o),i.$$.dirty&12273&&s&&n!==l&&($o(v,n=l,n),Id(s,n,$a({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),b=>s&&b===n,()=>{n&&(e(11,m=s==null?void 0:s.getSource(n)),e(12,x=!0))})),i.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,m=s==null?void 0:s.getSource(l))})),i.$$.dirty&6176&&m&&(x?e(12,x=!1):m.setData(c)),i.$$.dirty&3072&&(m==null||m.setClusterOptions($a({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[n,p,_,v,l,c,h,u,f,d,g,m,x,s,a,r]}class Nd extends ke{constructor(t){super(),Se(this,t,$d,zd,he,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function Ha(i){let t,e;return{c(){t=B("div"),e=Ot(i[0]),Dt(t,"class","svelte-1uuov7f")},m(n,s){$(n,t,s),I(t,e)},p(n,s){s&1&&Zn(e,n[0])},d(n){n&&N(t)}}}function Vd(i){let t,e=i[0]&&Ha(i);return{c(){e&&e.c(),t=Jn()},m(n,s){e&&e.m(n,s),$(n,t,s)},p(n,[s]){n[0]?e?e.p(n,s):(e=Ha(n),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:mt,o:mt,d(n){n&&N(t),e&&e.d(n)}}}function Wd(i,t,e){let{loading:n}=t;return i.$$set=s=>{"loading"in s&&e(0,n=s.loading)},[n]}class qM extends ke{constructor(t){super(),Se(this,t,Wd,Vd,he,{loading:0})}}var Mt=63710088e-1,Xr={centimeters:Mt*100,centimetres:Mt*100,degrees:Mt/111325,feet:Mt*3.28084,inches:Mt*39.37,kilometers:Mt/1e3,kilometres:Mt/1e3,meters:Mt,metres:Mt,miles:Mt/1609.344,millimeters:Mt*1e3,millimetres:Mt*1e3,nauticalmiles:Mt/1852,radians:1,yards:Mt*1.0936},Hd={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/Mt,yards:1.0936133},pr={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Xt(i,t,e){e===void 0&&(e={});var n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=i,n}function jd(i,t,e){switch(i){case"Point":return Et(t).geometry;case"LineString":return jt(t).geometry;case"Polygon":return Ur(t).geometry;case"MultiPoint":return Zh(t).geometry;case"MultiLineString":return Jh(t).geometry;case"MultiPolygon":return Qh(t).geometry;default:throw new Error(i+" is invalid")}}function Et(i,t,e){if(e===void 0&&(e={}),!i)throw new Error("coordinates is required");if(!Array.isArray(i))throw new Error("coordinates must be an Array");if(i.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Zs(i[0])||!Zs(i[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:i};return Xt(n,t,e)}function Yd(i,t,e){return e===void 0&&(e={}),mi(i.map(function(n){return Et(n,t)}),e)}function Ur(i,t,e){e===void 0&&(e={});for(var n=0,s=i;n=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(i*e)/e}function qr(i,t){t===void 0&&(t="kilometers");var e=Xr[t];if(!e)throw new Error(t+" units is invalid");return i*e}function Po(i,t){t===void 0&&(t="kilometers");var e=Xr[t];if(!e)throw new Error(t+" units is invalid");return i/e}function Kd(i,t){return $n(Po(i,t))}function Jd(i){var t=i%360;return t<0&&(t+=360),t}function $n(i){var t=i%(2*Math.PI);return t*180/Math.PI}function Yt(i){var t=i%360;return t*Math.PI/180}function Zd(i,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(i>=0))throw new Error("length must be a positive number");return qr(Po(i,t),e)}function Qd(i,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(i>=0))throw new Error("area must be a positive number");var n=pr[t];if(!n)throw new Error("invalid original units");var s=pr[e];if(!s)throw new Error("invalid final units");return i/n*s}function Zs(i){return!isNaN(i)&&i!==null&&!Array.isArray(i)}function Gr(i){return!!i&&i.constructor===Object}function tg(i){if(!i)throw new Error("bbox is required");if(!Array.isArray(i))throw new Error("bbox must be an Array");if(i.length!==4&&i.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");i.forEach(function(t){if(!Zs(t))throw new Error("bbox must only contain numbers")})}function eg(i){if(!i)throw new Error("id is required");if(["string","number"].indexOf(typeof i)===-1)throw new Error("id must be a number or a string")}const ig=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:pr,bearingToAzimuth:Jd,convertArea:Qd,convertLength:Zd,degreesToRadians:Yt,earthRadius:Mt,factors:Xr,feature:Xt,featureCollection:mi,geometry:jd,geometryCollection:qd,isNumber:Zs,isObject:Gr,lengthToDegrees:Kd,lengthToRadians:Po,lineString:jt,lineStrings:Ud,multiLineString:Jh,multiPoint:Zh,multiPolygon:Qh,point:Et,points:Yd,polygon:Ur,polygons:Xd,radiansToDegrees:$n,radiansToLength:qr,round:Gd,unitsFactors:Hd,validateBBox:tg,validateId:eg},Symbol.toStringTag,{value:"Module"}));function Nn(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return i.geometry.coordinates;if(i.type==="Point")return i.coordinates}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return i;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Ii(i){if(Array.isArray(i))return i;if(i.type==="Feature"){if(i.geometry!==null)return i.geometry.coordinates}else if(i.coordinates)return i.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function tu(i,t,e){if(e===void 0&&(e={}),e.final===!0)return ng(i,t);var n=Nn(i),s=Nn(t),o=Yt(n[0]),r=Yt(s[0]),a=Yt(n[1]),l=Yt(s[1]),c=Math.sin(r-o)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(r-o);return $n(Math.atan2(c,h))}function ng(i,t){var e=tu(t,i);return e=(e+180)%360,e}function ji(i,t,e){e===void 0&&(e={});var n=Nn(i),s=Nn(t),o=Yt(s[1]-n[1]),r=Yt(s[0]-n[0]),a=Yt(n[1]),l=Yt(s[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(r/2),2)*Math.cos(a)*Math.cos(l);return qr(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),e.units)}function ja(i,t,e,n){n===void 0&&(n={});var s=Nn(i),o=Yt(s[0]),r=Yt(s[1]),a=Yt(e),l=Po(t,n.units),c=Math.asin(Math.sin(r)*Math.cos(l)+Math.cos(r)*Math.sin(l)*Math.cos(a)),h=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(r),Math.cos(l)-Math.sin(r)*Math.sin(c)),u=$n(h),f=$n(c);return Et([u,f],n.properties)}function Qn(i,t,e){if(i!==null)for(var n,s,o,r,a,l,c,h=0,u=0,f,d=i.type,g=d==="FeatureCollection",p=d==="Feature",_=g?i.features.length:1,v=0;v<_;v++){c=g?i.features[v].geometry:p?i.geometry:i,f=c?c.type==="GeometryCollection":!1,a=f?c.geometries.length:1;for(var m=0;ml||g>c||p>h){a=u,l=n,c=g,h=p,o=0;return}var _=jt([a,u],e.properties);if(t(_,n,s,p,o)===!1)return!1;o++,a=u})===!1)return!1}}})}function hg(i,t,e){var n=e,s=!1;return iu(i,function(o,r,a,l,c){s===!1&&e===void 0?n=o:n=t(n,o,r,a,l,c),s=!0}),n}function nu(i,t){if(!i)throw new Error("geojson is required");Hi(i,function(e,n,s){if(e.geometry!==null){var o=e.geometry.type,r=e.geometry.coordinates;switch(o){case"LineString":if(t(e,n,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;as?e:s,c=n>o?n:o;return[r,a,l,c]}var Jr={exports:{}},su={exports:{}};(function(i,t){(function(e,n){i.exports=n()})(Ad,function(){function e(m,x,b,y,w){(function M(k,P,C,S,O){for(;S>C;){if(S-C>600){var T=S-C+1,E=P-C+1,A=Math.log(T),L=.5*Math.exp(2*A/3),R=.5*Math.sqrt(A*L*(T-L)/T)*(E-T/2<0?-1:1),J=Math.max(C,Math.floor(P-E*L/T+R)),Q=Math.min(S,Math.floor(P+(T-E)*L/T+R));M(k,P,J,Q,O)}var ft=k[P],At=C,et=S;for(n(k,C,P),O(k[S],ft)>0&&n(k,C,S);At0;)et--}O(k[C],ft)===0?n(k,C,et):n(k,++et,S),et<=P&&(C=et+1),P<=et&&(S=et-1)}})(m,x,b||0,y||m.length-1,w||s)}function n(m,x,b){var y=m[x];m[x]=m[b],m[b]=y}function s(m,x){return mx?1:0}var o=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(m,x,b){if(!b)return x.indexOf(m);for(var y=0;y=m.minX&&x.maxY>=m.minY}function _(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(m,x,b,y,w){for(var M=[x,b];M.length;)if(!((b=M.pop())-(x=M.pop())<=y)){var k=x+Math.ceil((b-x)/y/2)*y;e(m,k,x,b,w),M.push(x,k,k,b)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(m){var x=this.data,b=[];if(!p(m,x))return b;for(var y=this.toBBox,w=[];x;){for(var M=0;M=0&&w[x].children.length>this._maxEntries;)this._split(w,x),x--;this._adjustParentBBoxes(y,w,x)},o.prototype._split=function(m,x){var b=m[x],y=b.children.length,w=this._minEntries;this._chooseSplitAxis(b,w,y);var M=this._chooseSplitIndex(b,w,y),k=_(b.children.splice(M,b.children.length-M));k.height=b.height,k.leaf=b.leaf,a(b,this.toBBox),a(k,this.toBBox),x?m[x-1].children.push(k):this._splitRoot(b,k)},o.prototype._splitRoot=function(m,x){this.data=_([m,x]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(m,x,b){for(var y,w,M,k,P,C,S,O=1/0,T=1/0,E=x;E<=b-x;E++){var A=l(m,0,E,this.toBBox),L=l(m,E,b,this.toBBox),R=(w=A,M=L,k=void 0,P=void 0,C=void 0,S=void 0,k=Math.max(w.minX,M.minX),P=Math.max(w.minY,M.minY),C=Math.min(w.maxX,M.maxX),S=Math.min(w.maxY,M.maxY),Math.max(0,C-k)*Math.max(0,S-P)),J=f(A)+f(L);R=x;O--){var T=m.children[O];c(k,m.leaf?w(T):T),P+=d(k)}return P},o.prototype._adjustParentBBoxes=function(m,x,b){for(var y=b;y>=0;y--)c(x[y],m)},o.prototype._condense=function(m){for(var x=m.length-1,b=void 0;x>=0;x--)m[x].children.length===0?x>0?(b=m[x-1].children).splice(b.indexOf(m[x]),1):this.clear():a(m[x],this.toBBox)},o})})(su);var _g=su.exports;const yg=Yh(ig),ou=Yh(gg);var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});var xg=ou;function mr(i){var t=[1/0,1/0,-1/0,-1/0];return xg.coordEach(i,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2] line1 must only contain 2 coordinates");if(n.length!==2)throw new Error(" line2 must only contain 2 coordinates");var s=e[0][0],o=e[0][1],r=e[1][0],a=e[1][1],l=n[0][0],c=n[0][1],h=n[1][0],u=n[1][1],f=(u-c)*(r-s)-(h-l)*(a-o),d=(h-l)*(o-c)-(u-c)*(s-l),g=(r-s)*(o-c)-(a-o)*(s-l);if(f===0)return null;var p=d/f,_=g/f;if(p>=0&&p<=1&&_>=0&&_<=1){var v=s+p*(r-s),m=o+p*(a-o);return Et([v,m])}return null}function Sg(i,t,e){e===void 0&&(e={});var n=Et([1/0,1/0],{dist:1/0}),s=0;return Hi(i,function(o){for(var r=Ii(o),a=0;a0&&(_=p.features[0],_.properties.dist=ji(t,_,e),_.properties.location=s+ji(l,_,e)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let e=this.dragFrom[0]-t.lngLat.lng,n=this.dragFrom[1]-t.lngLat.lat;for(let s of this.points)s[0]-=e,s[1]-=n}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});D(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let e=[];if(qa(this.points).forEach((n,s)=>{e.push([s+1,Sg(n,this.cursor).properties.dist])}),e.sort((n,s)=>n[1]-s[1]),e.length>0){let n=e[0][0];this.points.splice(n,0,this.cursor.geometry.coordinates),this.hover=n}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});D(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=No(t.lngLat.toArray()),this.onClick(t),this.finish())});D(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});D(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});D(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});D(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersSuccess)e(t);else for(let e of this.eventListenersFailure)e();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((s,o)=>{let r=No(s);r.properties.hover=this.hover==o,r.properties.idx=o,t.features.push(r)}),t.features=t.features.concat(qa(this.points));let e=this.polygonFeature();e&&(e.properties.hover=this.hover=="polygon",t.features.push(e)),hu.set(t);let n="crosshair";this.hover!=null&&(n=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=n,uu.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersUpdated)e(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let e of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(e.geometry.type=="Polygon"){this.hover="polygon";break}else if(e.geometry.type=="Point"&&Object.hasOwn(e.properties,"idx")){this.hover=e.properties.idx;break}this.hover==null&&(this.cursor=No(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(cu),e=[JSON.parse(JSON.stringify(t))];return e[0].push(JSON.parse(JSON.stringify(e[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:e},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Dg&&this.previousStates.shift()}}function qa(i){let t=[];for(let e=0;e=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[i[i.length-1],i[0]]},properties:{}}),t}function Lg(i){let t,e,n;return{c(){t=Ot("Undo ("),e=Ot(i[1]),n=Ot(")")},m(s,o){$(s,t,o),$(s,e,o),$(s,n,o)},p(s,o){o&2&&Zn(e,s[1])},d(s){s&&(N(t),N(e),N(n))}}}function Tg(i){let t;return{c(){t=Ot("Undo")},m(e,n){$(e,t,n)},p:mt,d(e){e&&N(t)}}}function Eg(i){let t,e,n,s,o,r,a,l,c,h,u;function f(p,_){return p[1]==0?Tg:Lg}let d=f(i),g=d(i);return{c(){t=B("div"),e=B("button"),e.textContent="Finish",n=dt(),s=B("button"),s.textContent="Cancel",o=dt(),r=B("button"),g.c(),l=dt(),c=B("ul"),c.innerHTML=`
  • Click - the map to add a vertex
  • Click - a vertex to delete it
  • Drag - a vertex or the polygon to move it
  • Press Control+Z - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `,r.disabled=a=i[1]==0,Le(t,"display","flex"),Le(t,"justify-content","space-between")},m(p,_){$(p,t,_),I(t,e),I(t,n),I(t,s),I(t,o),I(t,r),g.m(r,null),$(p,l,_),$(p,c,_),h||(u=[xt(e,"click",i[2]),xt(s,"click",i[3]),xt(r,"click",i[4])],h=!0)},p(p,[_]){d===(d=f(p))&&g?g.p(p,_):(g.d(1),g=d(p),g&&(g.c(),g.m(r,null))),_&2&&a!==(a=p[1]==0)&&(r.disabled=a)},i:mt,o:mt,d(p){p&&(N(t),N(l),N(c)),g.d(),h=!1,je(u)}}}function Rg(i,t,e){let n;An(i,uu,l=>e(1,n=l));let{polygonTool:s}=t;const o=()=>s.finish(),r=()=>s.cancel(),a=()=>s.undo();return i.$$set=l=>{"polygonTool"in l&&e(0,s=l.polygonTool)},[s,n,o,r,a]}class Fg extends ke{constructor(t){super(),Se(this,t,Rg,Eg,he,{polygonTool:0})}}function Ig(i){let t,e,n,s,o,r;return t=new Fd({props:{id:"edit-polygon-fill",filter:Pg,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),n=new Od({props:{id:"edit-polygon-lines",filter:Cg,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),o=new Ld({props:{id:"edit-polygon-vertices",filter:Ag,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){ci(t.$$.fragment),e=dt(),ci(n.$$.fragment),s=dt(),ci(o.$$.fragment)},m(a,l){hi(t,a,l),$(a,e,l),hi(n,a,l),$(a,s,l),hi(o,a,l),r=!0},p:mt,i(a){r||(yt(t.$$.fragment,a),yt(n.$$.fragment,a),yt(o.$$.fragment,a),r=!0)},o(a){vt(t.$$.fragment,a),vt(n.$$.fragment,a),vt(o.$$.fragment,a),r=!1},d(a){a&&(N(e),N(s)),ui(t,a),ui(n,a),ui(o,a)}}}function Bg(i){let t,e;return t=new Nd({props:{data:i[0],$$slots:{default:[Ig]},$$scope:{ctx:i}}}),{c(){ci(t.$$.fragment)},m(n,s){hi(t,n,s),e=!0},p(n,[s]){const o={};s&1&&(o.data=n[0]),s&2&&(o.$$scope={dirty:s,ctx:n}),t.$set(o)},i(n){e||(yt(t.$$.fragment,n),e=!0)},o(n){vt(t.$$.fragment,n),e=!1},d(n){ui(t,n)}}}function zg(i,t,e){let n;return An(i,hu,s=>e(0,n=s)),[n]}class GM extends ke{constructor(t){super(),Se(this,t,zg,Bg,he,{})}}function $g(i){let t,e,n,s,o,r,a;return{c(){t=B("button"),t.textContent="Import current view",e=dt(),n=B("i"),n.textContent="or...",s=dt(),o=B("button"),o.textContent="Draw an area to import on the map",Dt(t,"type","button"),Dt(o,"type","button")},m(l,c){$(l,t,c),$(l,e,c),$(l,n,c),$(l,s,c),$(l,o,c),r||(a=[xt(t,"click",i[1]),xt(o,"click",i[2])],r=!0)},p:mt,i:mt,o:mt,d(l){l&&(N(t),N(e),N(n),N(s),N(o)),r=!1,je(a)}}}function Ng(i){let t,e;return t=new Fg({props:{polygonTool:i[0]}}),{c(){ci(t.$$.fragment)},m(n,s){hi(t,n,s),e=!0},p(n,s){const o={};s&1&&(o.polygonTool=n[0]),t.$set(o)},i(n){e||(yt(t.$$.fragment,n),e=!0)},o(n){vt(t.$$.fragment,n),e=!1},d(n){ui(t,n)}}}function Vg(i){let t,e,n,s;const o=[Ng,$g],r=[];function a(l,c){return l[0]?0:1}return t=a(i),e=r[t]=o[t](i),{c(){e.c(),n=Jn()},m(l,c){r[t].m(l,c),$(l,n,c),s=!0},p(l,[c]){let h=t;t=a(l),t===h?r[t].p(l,c):(ko(),vt(r[h],1,1,()=>{r[h]=null}),So(),e=r[t],e?e.p(l,c):(e=r[t]=o[t](l),e.c()),yt(e,1),e.m(n.parentNode,n))},i(l){s||(yt(e),s=!0)},o(l){vt(e),s=!1},d(l){l&&N(n),r[t].d(l)}}}function Yi(i){return[i.lng,i.lat]}function Wg(i,t,e){let{map:n}=t;const s=Uh();let o=null;async function r(h){try{s("loading","Loading from Overpass");let f=await(await fetch(Hg(h))).text();s("gotXml",f)}catch(u){s("error",u.toString())}}function a(){let h=n.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Yi(h.getSouthWest()),Yi(h.getNorthWest()),Yi(h.getNorthEast()),Yi(h.getSouthEast()),Yi(h.getSouthWest())]],type:"Polygon"}}}async function l(){if(n){if(n.getZoom()<13){s("error","Zoom in more to import");return}await r(a())}}function c(){n&&(e(0,o=new Og(n)),o.startNew(),o.addEventListenerSuccess(async h=>{e(0,o=null),await r(h)}),o.addEventListenerFailure(()=>{e(0,o=null)}))}return i.$$set=h=>{"map"in h&&e(3,n=h.map)},[o,l,c,n]}class KM extends ke{constructor(t){super(),Se(this,t,Wg,Vg,he,{map:3})}}function Hg(i){let t='poly:"';for(let[n,s]of i.geometry.coordinates[0])t+=`${s} ${n} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}let V;const fu=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&fu.decode();let pn=null;function Dn(){return(pn===null||pn.byteLength===0)&&(pn=new Uint8Array(V.memory.buffer)),pn}function ri(i,t){return i=i>>>0,fu.decode(Dn().subarray(i,i+t))}const xe=new Array(128).fill(void 0);xe.push(void 0,null,!0,!1);let On=xe.length;function U(i){On===xe.length&&xe.push(xe.length+1);const t=On;return On=xe[t],xe[t]=i,t}function F(i){return xe[i]}let fi=0;const Ys=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},jg=typeof Ys.encodeInto=="function"?function(i,t){return Ys.encodeInto(i,t)}:function(i,t){const e=Ys.encode(i);return t.set(e),{read:i.length,written:e.length}};function Vo(i,t,e){if(e===void 0){const a=Ys.encode(i),l=t(a.length,1)>>>0;return Dn().subarray(l,l+a.length).set(a),fi=a.length,l}let n=i.length,s=t(n,1)>>>0;const o=Dn();let r=0;for(;r127)break;o[s+r]=a}if(r!==n){r!==0&&(i=i.slice(r)),s=e(s,n,n=r+i.length*3,1)>>>0;const a=Dn().subarray(s+r,s+n),l=jg(i,a);r+=l.written,s=e(s,n,r,1)>>>0}return fi=r,s}function Xi(i){return i==null}let mn=null;function rt(){return(mn===null||mn.byteLength===0)&&(mn=new Int32Array(V.memory.buffer)),mn}function Yg(i){i<132||(xe[i]=On,On=i)}function Te(i){const t=F(i);return Yg(i),t}let bn=null;function du(){return(bn===null||bn.byteLength===0)&&(bn=new Float64Array(V.memory.buffer)),bn}let _n=null;function Xg(){return(_n===null||_n.byteLength===0)&&(_n=new BigInt64Array(V.memory.buffer)),_n}function br(i){const t=typeof i;if(t=="number"||t=="boolean"||i==null)return`${i}`;if(t=="string")return`"${i}"`;if(t=="symbol"){const s=i.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=i.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(i)){const s=i.length;let o="[";s>0&&(o+=br(i[0]));for(let r=1;r1)n=e[1];else return toString.call(i);if(n=="Object")try{return"Object("+JSON.stringify(i)+")"}catch{return"Object"}return i instanceof Error?`${i.name}: ${i.message} -${i.stack}`:n}function Ug(i,t){const e=t(i.length*1,1)>>>0;return Dn().set(i,e/1),fi=i.length,e}function qg(i,t){return i=i>>>0,du().subarray(i/8,i/8+t)}function qe(i,t){try{return i.apply(this,t)}catch(e){V.__wbindgen_exn_store(U(e))}}const Gg=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>V.__wbg_jsnetwork_free(i>>>0));class JM{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Gg.unregister(this),t}free(){const t=this.__destroy_into_raw();V.__wbg_jsnetwork_free(t)}constructor(t){try{const o=V.__wbindgen_add_to_stack_pointer(-16),r=Ug(t,V.__wbindgen_malloc),a=fi;V.jsnetwork_new(o,r,a);var e=rt()[o/4+0],n=rt()[o/4+1],s=rt()[o/4+2];if(s)throw Te(n);return this.__wbg_ptr=e>>>0,this}finally{V.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,n;try{const h=V.__wbindgen_add_to_stack_pointer(-16);V.jsnetwork_recalculate(h,this.__wbg_ptr,U(t));var s=rt()[h/4+0],o=rt()[h/4+1],r=rt()[h/4+2],a=rt()[h/4+3],l=s,c=o;if(a)throw l=0,c=0,Te(r);return e=l,n=c,ri(l,c)}finally{V.__wbindgen_add_to_stack_pointer(16),V.__wbindgen_free(e,n,1)}}updateCostFunction(t){try{const s=V.__wbindgen_add_to_stack_pointer(-16);V.jsnetwork_updateCostFunction(s,this.__wbg_ptr,U(t));var e=rt()[s/4+0],n=rt()[s/4+1];if(n)throw Te(e)}finally{V.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=V.__wbindgen_add_to_stack_pointer(-16);V.jsnetwork_getBounds(s,this.__wbg_ptr);var t=rt()[s/4+0],e=rt()[s/4+1],n=qg(t,e).slice();return V.__wbindgen_free(t,e*8,8),n}finally{V.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=V.__wbindgen_add_to_stack_pointer(-16);V.jsnetwork_debugNetwork(c,this.__wbg_ptr);var n=rt()[c/4+0],s=rt()[c/4+1],o=rt()[c/4+2],r=rt()[c/4+3],a=n,l=s;if(r)throw a=0,l=0,Te(o);return t=a,e=l,ri(a,l)}finally{V.__wbindgen_add_to_stack_pointer(16),V.__wbindgen_free(t,e,1)}}}async function Kg(i,t){if(typeof Response=="function"&&i instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(n){if(i.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const e=await i.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(i,t);return e instanceof WebAssembly.Instance?{instance:e,module:i}:e}}function Jg(){const i={};return i.wbg={},i.wbg.__wbindgen_string_new=function(t,e){const n=ri(t,e);return U(n)},i.wbg.__wbindgen_string_get=function(t,e){const n=F(e),s=typeof n=="string"?n:void 0;var o=Xi(s)?0:Vo(s,V.__wbindgen_malloc,V.__wbindgen_realloc),r=fi;rt()[t/4+1]=r,rt()[t/4+0]=o},i.wbg.__wbindgen_object_drop_ref=function(t){Te(t)},i.wbg.__wbindgen_is_bigint=function(t){return typeof F(t)=="bigint"},i.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return U(e)},i.wbg.__wbindgen_jsval_eq=function(t,e){return F(t)===F(e)},i.wbg.__wbindgen_error_new=function(t,e){const n=new Error(ri(t,e));return U(n)},i.wbg.__wbindgen_number_get=function(t,e){const n=F(e),s=typeof n=="number"?n:void 0;du()[t/8+1]=Xi(s)?0:s,rt()[t/4+0]=!Xi(s)},i.wbg.__wbindgen_is_string=function(t){return typeof F(t)=="string"},i.wbg.__wbindgen_is_object=function(t){const e=F(t);return typeof e=="object"&&e!==null},i.wbg.__wbindgen_is_undefined=function(t){return F(t)===void 0},i.wbg.__wbindgen_in=function(t,e){return F(t)in F(e)},i.wbg.__wbindgen_jsval_loose_eq=function(t,e){return F(t)==F(e)},i.wbg.__wbindgen_boolean_get=function(t){const e=F(t);return typeof e=="boolean"?e?1:0:2},i.wbg.__wbindgen_as_number=function(t){return+F(t)},i.wbg.__wbindgen_number_new=function(t){return U(t)},i.wbg.__wbindgen_object_clone_ref=function(t){const e=F(t);return U(e)},i.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,e){const n=F(t)[F(e)];return U(n)},i.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return U(t)},i.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const n=F(e).stack,s=Vo(n,V.__wbindgen_malloc,V.__wbindgen_realloc),o=fi;rt()[t/4+1]=o,rt()[t/4+0]=s},i.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let n,s;try{n=t,s=e,console.error(ri(t,e))}finally{V.__wbindgen_free(n,s,1)}},i.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const n=F(t)[F(e)];return U(n)},i.wbg.__wbg_set_841ac57cff3d672b=function(t,e,n){F(t)[Te(e)]=Te(n)},i.wbg.__wbg_now_4e659b3d15f470d9=function(t){return F(t).now()},i.wbg.__wbg_debug_5fb96680aecf5dc8=function(t){console.debug(F(t))},i.wbg.__wbg_error_8e3928cfb8a43e2b=function(t){console.error(F(t))},i.wbg.__wbg_info_530a29cb2e4e3304=function(t){console.info(F(t))},i.wbg.__wbg_log_5bb5f88f245d7762=function(t){console.log(F(t))},i.wbg.__wbg_warn_63bbae1730aead09=function(t){console.warn(F(t))},i.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,e){const n=F(t)[e>>>0];return U(n)},i.wbg.__wbg_length_cd7af8117672b8b8=function(t){return F(t).length},i.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const t=new Array;return U(t)},i.wbg.__wbindgen_is_function=function(t){return typeof F(t)=="function"},i.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,e){const n=new Function(ri(t,e));return U(n)},i.wbg.__wbg_next_40fc327bfc8770e6=function(t){const e=F(t).next;return U(e)},i.wbg.__wbg_next_196c84450b364254=function(){return qe(function(t){const e=F(t).next();return U(e)},arguments)},i.wbg.__wbg_done_298b57d23c0fc80c=function(t){return F(t).done},i.wbg.__wbg_value_d93c65011f51a456=function(t){const e=F(t).value;return U(e)},i.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return U(Symbol.iterator)},i.wbg.__wbg_get_e3c254076557e348=function(){return qe(function(t,e){const n=Reflect.get(F(t),F(e));return U(n)},arguments)},i.wbg.__wbg_call_27c0f87801dedf93=function(){return qe(function(t,e){const n=F(t).call(F(e));return U(n)},arguments)},i.wbg.__wbg_new_72fb9a18b5ae2624=function(){const t=new Object;return U(t)},i.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return qe(function(){const t=self.self;return U(t)},arguments)},i.wbg.__wbg_window_c6fb939a7f436783=function(){return qe(function(){const t=window.window;return U(t)},arguments)},i.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return qe(function(){const t=globalThis.globalThis;return U(t)},arguments)},i.wbg.__wbg_global_207b558942527489=function(){return qe(function(){const t=global.global;return U(t)},arguments)},i.wbg.__wbg_set_d4638f722068f043=function(t,e,n){F(t)[e>>>0]=Te(n)},i.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let e;try{e=F(t)instanceof ArrayBuffer}catch{e=!1}return e},i.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger(F(t))},i.wbg.__wbg_entries_95cc2c823b285a09=function(t){const e=Object.entries(F(t));return U(e)},i.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const e=F(t).buffer;return U(e)},i.wbg.__wbg_new_63b92bc8671ed464=function(t){const e=new Uint8Array(F(t));return U(e)},i.wbg.__wbg_set_a47bac70306a19a7=function(t,e,n){F(t).set(F(e),n>>>0)},i.wbg.__wbg_length_c20a40f15020d68a=function(t){return F(t).length},i.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let e;try{e=F(t)instanceof Uint8Array}catch{e=!1}return e},i.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const n=F(e),s=typeof n=="bigint"?n:void 0;Xg()[t/8+1]=Xi(s)?BigInt(0):s,rt()[t/4+0]=!Xi(s)},i.wbg.__wbindgen_debug_string=function(t,e){const n=br(F(e)),s=Vo(n,V.__wbindgen_malloc,V.__wbindgen_realloc),o=fi;rt()[t/4+1]=o,rt()[t/4+0]=s},i.wbg.__wbindgen_throw=function(t,e){throw new Error(ri(t,e))},i.wbg.__wbindgen_memory=function(){const t=V.memory;return U(t)},i}function Zg(i,t){return V=i.exports,Qg.__wbindgen_wasm_module=t,_n=null,bn=null,mn=null,pn=null,V}async function Qg(i){if(V!==void 0)return V;typeof i>"u"&&(i="/od2net/assets/wasm_od2net_bg.wasm");const t=Jg();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));const{instance:e,module:n}=await Kg(await i,t);return Zg(e,n)}function tp(i){let t,e,n,s,o,r,a,l,c,h,u,f;return{c(){t=B("div"),e=B("label"),n=Ot(`Or load an example: - `),s=B("select"),o=B("option"),o.textContent="Custom file loaded",r=B("option"),r.textContent="Antwerp",a=B("option"),a.textContent="Berlin",l=B("option"),l.textContent="South London",c=B("option"),c.textContent="Paris",h=B("option"),h.textContent="Seattle",o.__value="",bt(o,o.__value),r.__value="antwerp",bt(r,r.__value),a.__value="berlin",bt(a,a.__value),l.__value="london",bt(l,l.__value),c.__value="paris",bt(c,c.__value),h.__value="seattle",bt(h,h.__value),i[0]===void 0&&qh(()=>i[1].call(s))},m(d,g){$(d,t,g),I(t,e),I(e,n),I(e,s),I(s,o),I(s,r),I(s,a),I(s,l),I(s,c),I(s,h),Js(s,i[0],!0),u||(f=xt(s,"change",i[1]),u=!0)},p(d,[g]){g&1&&Js(s,d[0])},i:mt,o:mt,d(d){d&&N(t),u=!1,f()}}}function ep(i,t,e){let{example:n}=t;function s(){n=Gh(this),e(0,n)}return i.$$set=o=>{"example"in o&&e(0,n=o.example)},[n,s]}class ZM extends ke{constructor(t){super(),Se(this,t,ep,tp,he,{example:0})}}/*! - * @kurkle/color v0.3.2 - * https://github.com/kurkle/color#readme - * (c) 2023 Jukka Kurkela - * Released under the MIT License - */function ts(i){return i+.5|0}const Ee=(i,t,e)=>Math.max(Math.min(i,e),t);function yn(i){return Ee(ts(i*2.55),0,255)}function ze(i){return Ee(ts(i*255),0,255)}function be(i){return Ee(ts(i/2.55)/100,0,1)}function Ga(i){return Ee(ts(i*100),0,100)}const $t={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},_r=[..."0123456789ABCDEF"],ip=i=>_r[i&15],np=i=>_r[(i&240)>>4]+_r[i&15],ls=i=>(i&240)>>4===(i&15),sp=i=>ls(i.r)&&ls(i.g)&&ls(i.b)&&ls(i.a);function op(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&$t[i[1]]*17,g:255&$t[i[2]]*17,b:255&$t[i[3]]*17,a:t===5?$t[i[4]]*17:255}:(t===7||t===9)&&(e={r:$t[i[1]]<<4|$t[i[2]],g:$t[i[3]]<<4|$t[i[4]],b:$t[i[5]]<<4|$t[i[6]],a:t===9?$t[i[7]]<<4|$t[i[8]]:255})),e}const rp=(i,t)=>i<255?t(i):"";function ap(i){var t=sp(i)?ip:np;return i?"#"+t(i.r)+t(i.g)+t(i.b)+rp(i.a,t):void 0}const lp=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function gu(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function cp(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function hp(i,t,e){const n=gu(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function up(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=up(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function ta(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(ze)}function ea(i,t,e){return ta(gu,i,t,e)}function fp(i,t,e){return ta(hp,i,t,e)}function dp(i,t,e){return ta(cp,i,t,e)}function pu(i){return(i%360+360)%360}function gp(i){const t=lp.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?yn(+t[5]):ze(+t[5]));const s=pu(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=fp(s,o,r):t[1]==="hsv"?n=dp(s,o,r):n=ea(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function pp(i,t){var e=Qr(i);e[0]=pu(e[0]+t),e=ea(e),i.r=e[0],i.g=e[1],i.b=e[2]}function mp(i){if(!i)return;const t=Qr(i),e=t[0],n=Ga(t[1]),s=Ga(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${be(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const Ka={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ja={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function bp(){const i={},t=Object.keys(Ja),e=Object.keys(Ka);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let cs;function _p(i){cs||(cs=bp(),cs.transparent=[0,0,0,0]);const t=cs[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const yp=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function xp(i){const t=yp.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?yn(r):Ee(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?yn(n):Ee(n,0,255)),s=255&(t[4]?yn(s):Ee(s,0,255)),o=255&(t[6]?yn(o):Ee(o,0,255)),{r:n,g:s,b:o,a:e}}}function vp(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${be(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const Wo=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Mi=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function wp(i,t,e){const n=Mi(be(i.r)),s=Mi(be(i.g)),o=Mi(be(i.b));return{r:ze(Wo(n+e*(Mi(be(t.r))-n))),g:ze(Wo(s+e*(Mi(be(t.g))-s))),b:ze(Wo(o+e*(Mi(be(t.b))-o))),a:i.a+e*(t.a-i.a)}}function hs(i,t,e){if(i){let n=Qr(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=ea(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function mu(i,t){return i&&Object.assign(t||{},i)}function Za(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=ze(i[3]))):(t=mu(i,{r:0,g:0,b:0,a:1}),t.a=ze(t.a)),t}function Mp(i){return i.charAt(0)==="r"?xp(i):gp(i)}let bu=class yr{constructor(t){if(t instanceof yr)return t;const e=typeof t;let n;e==="object"?n=Za(t):e==="string"&&(n=op(t)||_p(t)||Mp(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=mu(this._rgb);return t&&(t.a=be(t.a)),t}set rgb(t){this._rgb=Za(t)}rgbString(){return this._valid?vp(this._rgb):void 0}hexString(){return this._valid?ap(this._rgb):void 0}hslString(){return this._valid?mp(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=wp(this._rgb,t._rgb,e)),this}clone(){return new yr(this.rgb)}alpha(t){return this._rgb.a=ze(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=ts(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return hs(this._rgb,2,t),this}darken(t){return hs(this._rgb,2,-t),this}saturate(t){return hs(this._rgb,1,t),this}desaturate(t){return hs(this._rgb,1,-t),this}rotate(t){return pp(this._rgb,t),this}};/*! - * Chart.js v4.4.2 - * https://www.chartjs.org - * (c) 2024 Chart.js Contributors - * Released under the MIT License - */function fe(){}const kp=(()=>{let i=0;return()=>i++})();function Y(i){return i===null||typeof i>"u"}function it(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function W(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function lt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function It(i,t){return lt(i)?i:t}function z(i,t){return typeof i>"u"?t:i}const Sp=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,_u=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function tt(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function q(i,t,e,n){let s,o,r;if(it(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function Ap(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function Dp(i){const t=Ap(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function Ne(i,t){return(Qa[t]||(Qa[t]=Dp(t)))(i)}function ia(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Wn=i=>typeof i<"u",Ve=i=>typeof i=="function",tl=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Op(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const st=Math.PI,nt=2*st,Lp=nt+st,io=Number.POSITIVE_INFINITY,Tp=st/180,gt=st/2,Ge=st/4,el=st*2/3,Re=Math.log10,le=Math.sign;function Tn(i,t,e){return Math.abs(i-t)s-o).pop(),t}function Bi(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Rp(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function xu(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function sa(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const we=(i,t,e,n)=>sa(i,e,n?s=>{const o=i[s][t];return oi[s][t]sa(i,e,n=>i[n][t]>=e);function zp(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+ia(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function sl(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(wu.forEach(o=>{delete i[o]}),delete i._chartjs)}function Mu(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const ku=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Su(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,ku.call(window,()=>{n=!1,i.apply(t,e)}))}}function Np(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const oa=i=>i==="start"?"left":i==="end"?"right":"center",kt=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Vp=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function Pu(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:f}=r.getUserBounds();u&&(s=_t(Math.min(we(a,l,c).lo,e?n:we(t,l,r.getPixelForValue(c)).lo),0,n-1)),f?o=_t(Math.max(we(a,r.axis,h,!0).hi+1,e?0:we(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function Cu(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const us=i=>i===0||i===1,ol=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*nt/e)),rl=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*nt/e)+1,En={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*gt)+1,easeOutSine:i=>Math.sin(i*gt),easeInOutSine:i=>-.5*(Math.cos(st*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>us(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>us(i)?i:ol(i,.075,.3),easeOutElastic:i=>us(i)?i:rl(i,.075,.3),easeInOutElastic(i){return us(i)?i:i<.5?.5*ol(i*2,.1125,.45):.5+.5*rl(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-En.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?En.easeInBounce(i*2)*.5:En.easeOutBounce(i*2-1)*.5+.5};function ra(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function al(i){return ra(i)?i:new bu(i)}function Ho(i){return ra(i)?i:new bu(i).saturate(.5).darken(.1).hexString()}const Wp=["x","y","borderWidth","radius","tension"],Hp=["color","borderColor","backgroundColor"];function jp(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Hp},numbers:{type:"number",properties:Wp}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Yp(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ll=new Map;function Xp(i,t){t=t||{};const e=i+JSON.stringify(t);let n=ll.get(e);return n||(n=new Intl.NumberFormat(i,t),ll.set(e,n)),n}function es(i,t,e){return Xp(t,e).format(i)}const Au={values(i){return it(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Up(i,e)}const r=Re(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),es(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=e[t].significand||i/Math.pow(10,Math.floor(Re(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?Au.numeric.call(this,i,t,e):""}};function Up(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Co={formatters:Au};function qp(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Co.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const bi=Object.create(null),vr=Object.create(null);function Rn(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;nn.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>Ho(s.backgroundColor),this.hoverBorderColor=(n,s)=>Ho(s.borderColor),this.hoverColor=(n,s)=>Ho(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return jo(this,t,e)}get(t){return Rn(this,t)}describe(t,e){return jo(vr,t,e)}override(t,e){return jo(bi,t,e)}route(t,e,n,s){const o=Rn(this,t),r=Rn(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return W(l)?Object.assign({},c,l):z(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var ct=new Gp({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[jp,Yp,qp]);function Kp(i){return!i||Y(i.size)||Y(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function no(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function Jp(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function Me(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,tm(i,o),l=0;l+i||0;function aa(i,t){const e={},n=W(t),s=n?Object.keys(t):t,o=W(i)?n?r=>z(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=rm(o(r));return e}function Ou(i){return aa(i,{top:"y",right:"x",bottom:"y",left:"x"})}function di(i){return aa(i,["topLeft","topRight","bottomLeft","bottomRight"])}function Ct(i){const t=Ou(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function pt(i,t){i=i||{},t=t||ct.font;let e=z(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=z(i.style,t.style);n&&!(""+n).match(sm)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:z(i.family,t.family),lineHeight:om(z(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:z(i.weight,t.weight),string:""};return s.string=Kp(s),s}function xn(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Ye(i,t){return Object.assign(Object.create(i),t)}function la(i,t=[""],e,n,s=()=>i[0]){const o=e||i;typeof n>"u"&&(n=Ru("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:a=>la([a,...i],t,o,n)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Tu(a,l,()=>pm(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return ul(a).includes(l)},ownKeys(a){return ul(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function zi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Lu(i,n),setContext:o=>zi(i,o,e,n),override:o=>zi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Tu(o,r,()=>cm(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Lu(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Ve(e)?e:()=>e,isIndexable:Ve(n)?n:()=>n}}const lm=(i,t)=>i?i+ia(t):t,ca=(i,t)=>W(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Tu(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function cm(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return Ve(a)&&r.isScriptable(t)&&(a=hm(t,a,i,e)),it(a)&&a.length&&(a=um(t,a,i,r.isIndexable)),ca(t,a)&&(a=zi(a,s,o&&o[t],r)),a}function hm(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||n);return a.delete(i),ca(i,l)&&(l=ha(s._scopes,s,i,l)),l}function um(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if(W(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=ha(c,s,i,h);t.push(zi(u,o,r&&r[i],a))}}return t}function Eu(i,t,e){return Ve(i)?i(t,e):i}const fm=(i,t)=>i===!0?t:typeof i=="string"?Ne(t,i):void 0;function dm(i,t,e,n,s){for(const o of t){const r=fm(e,o);if(r){i.add(r);const a=Eu(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==n)return a}else if(r===!1&&typeof n<"u"&&e!==n)return null}return!1}function ha(i,t,e,n){const s=t._rootScopes,o=Eu(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=hl(a,r,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=hl(a,r,o,l,n),l===null)?!1:la(Array.from(a),[""],s,o,()=>gm(t,e,n))}function hl(i,t,e,n,s){for(;e;)e=dm(i,t,e,n,s);return e}function gm(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return it(s)&&W(e)?e:s||{}}function pm(i,t,e,n){let s;for(const o of t)if(s=Ru(lm(o,i),e),typeof s<"u")return ca(i,s)?ha(e,n,i,s):s}function Ru(i,t){for(const e of t){if(!e)continue;const n=e[i];if(typeof n<"u")return n}}function ul(i){let t=i._keys;return t||(t=i._keys=mm(i._scopes)),t}function mm(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function Fu(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function _m(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=xr(o,s),l=xr(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,f=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+f*(r.x-s.x),y:o.y+f*(r.y-s.y)}}}function ym(i,t,e){const n=i.length;let s,o,r,a,l,c=$i(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")vm(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function km(i,t){return Oo(i).getPropertyValue(t)}const Sm=["top","right","bottom","left"];function gi(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=Sm[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const Pm=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Cm(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(Pm(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function ei(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=Oo(e),o=s.boxSizing==="border-box",r=gi(s,"padding"),a=gi(s,"border","width"),{x:l,y:c,box:h}=Cm(i,e),u=r.left+(h&&a.left),f=r.top+(h&&a.top);let{width:d,height:g}=t;return o&&(d-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/d*e.width/n),y:Math.round((c-f)/g*e.height/n)}}function Am(i,t,e){let n,s;if(t===void 0||e===void 0){const o=fa(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=Oo(o),l=gi(a,"border","width"),c=gi(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=so(a.maxWidth,o,"clientWidth"),s=so(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||io,maxHeight:s||io}}const ds=i=>Math.round(i*10)/10;function Dm(i,t,e,n){const s=Oo(i),o=gi(s,"margin"),r=so(s.maxWidth,i,"clientWidth")||io,a=so(s.maxHeight,i,"clientHeight")||io,l=Am(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const f=gi(s,"border","width"),d=gi(s,"padding");c-=d.width+f.width,h-=d.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?c/n:h-o.height),c=ds(Math.min(c,r,l.maxWidth)),h=ds(Math.min(h,a,l.maxHeight)),c&&!h&&(h=ds(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&h>l.height&&(h=l.height,c=ds(Math.floor(h*n))),{width:c,height:h}}function fl(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const Om=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ua()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function dl(i,t){const e=km(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function ii(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Lm(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Tm(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=ii(i,s,e),a=ii(s,o,e),l=ii(o,t,e),c=ii(r,a,e),h=ii(a,l,e);return ii(c,h,e)}const Em=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},Rm=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Ei(i,t,e){return i?Em(t,e):Rm()}function Bu(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function zu(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function $u(i){return i==="angle"?{between:Hn,compare:Fp,normalize:Bt}:{between:ve,compare:(t,e)=>t-e,normalize:t=>t}}function gl({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Fm(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=$u(n),l=t.length;let{start:c,end:h,loop:u}=i,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,x,v)&&a(s,x)!==0,y=()=>a(o,v)===0||l(o,x,v),w=()=>p||b(),M=()=>!p||y();for(let k=h,P=h;k<=u;++k)m=t[k%r],!m.skip&&(v=c(m[n]),v!==x&&(p=l(v,s,o),_===null&&w()&&(_=a(v,s)===0?k:P),_!==null&&M()&&(g.push(gl({start:_,end:k,loop:f,count:r,style:d})),_=null),P=k,x=v));return _!==null&&g.push(gl({start:_,end:u,loop:f,count:r,style:d})),g}function Vu(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Bm(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function zm(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=Im(e,s,o,n);if(n===!0)return pl(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=ku.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var de=new Vm;const bl="transparent",Wm={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=al(i||bl),s=n.valid&&al(t||bl);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};let Hm=class{constructor(t,e,n,s){const o=e[n];s=xn([t.to,s,o,t.from]);const r=xn([t.from,o,s]);this._active=!0,this._fn=t.fn||Wm[t.type||typeof r],this._easing=En[t.easing]||En.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=xn([t.to,e,s,t.from]),this._from=xn([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s{const o=t[s];if(!W(o))return;const r={};for(const a of e)r[a]=o[a];(it(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,e){const n=e.options,s=Ym(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&jm(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const f=n.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=u=new Hm(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return de.add(this._chart,n),!0}};function jm(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function wl(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=Gm(o,r,n),u=t.length;let f;for(let d=0;de[n].axis===t).shift()}function Zm(i,t){return Ye(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Qm(i,t,e){return Ye(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ui(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const Xo=i=>i==="reset"||i==="none",Ml=(i,t)=>t?i:Object.assign({},i),tb=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Hu(e,!0),values:null};var rn;let Xe=(rn=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=xl(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ui(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,o=e.xAxisID=z(n.xAxisID,Yo(t,"x")),r=e.yAxisID=z(n.yAxisID,Yo(t,"y")),a=e.rAxisID=z(n.rAxisID,Yo(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&sl(this._data,this),t._stacked&&Ui(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(W(e))this._data=qm(e);else if(n!==e){if(n){sl(n,this);const s=this._cachedMeta;Ui(s),s._parsed=[]}e&&Object.isExtensible(e)&&$p(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=xl(e.vScale,e),e.stack!==n.stack&&(s=!0,Ui(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&wl(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,f;if(this._parsing===!1)n._parsed=s,n._sorted=!0,f=s;else{it(s[t])?f=this.parseArrayData(n,s,t,e):W(s[t])?f=this.parseObjectData(n,s,t,e):f=this.parsePrimitiveData(n,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s,e),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(Ml(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,n,e))}const c=new Wu(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Xo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){Xo(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!Xo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function ib(i){const t=i.iScale,e=eb(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(Wn(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function ju(i,t,e,n){return it(i)?ob(i,t,e,n):t[e.axis]=e.parse(i,n),t}function kl(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,f;for(c=e,h=e+n;c=e?1:-1)}function ab(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(Y(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let f=e;fHn(x,a,l,!0)?1:Math.max(b,b*e,y,y*e),g=(x,b,y)=>Hn(x,a,l,!0)?-1:Math.min(b,b*e,y,y*e),p=d(0,c,u),_=d(gt,h,f),v=g(st,c,u),m=g(st+gt,h,f);n=(p-v)/2,s=(_-m)/2,o=-(p+v)/2,r=-(_+m)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}var Di;let da=(Di=class extends Xe{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(W(n[t])){const{key:l="value"}=this._parsing;o=c=>+Ne(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?nt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=es(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),D(Di,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}}),Di);var cn;let gb=(cn=class extends Xe{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=Pu(e,s,r);this._drawStart=a,this._drawCount=l,Cu(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=r.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,_=Bi(g)?g:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||s==="none",m=e+n,x=t.length;let b=e>0&&this.getParsed(e-1);for(let y=0;y=m){M.skip=!0;continue}const k=this.getParsed(y),P=Y(k[d]),C=M[f]=r.getPixelForValue(k[f],y),S=M[d]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[d],y);M.skip=isNaN(C)||isNaN(S)||P,M.stop=y>0&&Math.abs(k[f]-b[f])>_,p&&(M.parsed=k,M.raw=c.data[y]),u&&(M.options=h||this.resolveDataElementOptions(y,w.active?"active":s)),v||this.updateElement(w,y,M,s),b=k}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},D(cn,"id","line"),D(cn,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),D(cn,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),cn);var hn;let Yu=(hn=class extends Xe{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=es(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Fu.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*st;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Qt(this.resolveDataElementOptions(t,e).angle||n):0}},D(hn,"id","polarArea"),D(hn,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),D(hn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),hn);var Is;let pb=(Is=class extends da{},D(Is,"id","pie"),D(Is,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),Is);var un;let mb=(un=class extends Xe{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Fu.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-x[d])>v,_&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,y.active?"active":s)),m||this.updateElement(y,b,M,s),x=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}},D(fn,"id","scatter"),D(fn,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),D(fn,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),fn);var _b=Object.freeze({__proto__:null,BarController:ub,BubbleController:fb,DoughnutController:da,LineController:gb,PieController:pb,PolarAreaController:Yu,RadarController:mb,ScatterController:bb});function Je(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ga{constructor(t){D(this,"options");this.options=t||{}}static override(t){Object.assign(ga.prototype,t)}init(){}formats(){return Je()}parse(){return Je()}format(){return Je()}add(){return Je()}diff(){return Je()}startOf(){return Je()}endOf(){return Je()}}var yb={_date:ga};function xb(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Bp:we;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),f=l(o,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function is(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var kb={evaluateInteractionItems:is,modes:{index(i,t,e,n){const s=ei(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?qo(i,s,o,n,r):Go(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=ei(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?qo(i,s,o,n,r):Go(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Al(i,t){return i.filter(e=>Xu.indexOf(e.pos)===-1&&e.box.axis===t)}function Gi(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Sb(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=Gi(qi(t,"left"),!0),s=Gi(qi(t,"right")),o=Gi(qi(t,"top"),!0),r=Gi(qi(t,"bottom")),a=Al(t,"x"),l=Al(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:qi(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Dl(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Uu(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Db(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!W(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Uu(r,o.getPadding());const a=Math.max(0,t.outerWidth-Dl(r,i,"left","right")),l=Math.max(0,t.outerHeight-Dl(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Ob(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Lb(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function vn(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,_)=>_.box.options&&_.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),f=Object.assign({},s);Uu(f,Ct(n));const d=Object.assign({maxPadding:f,w:o,h:r,x:s.left,y:s.top},s),g=Cb(l.concat(c),u);vn(a.fullSize,d,u,g),vn(l,d,u,g),vn(c,d,u,g)&&vn(l,d,u,g),Ob(d),Ol(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,Ol(a.rightAndBottom,d,u,g),i.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},q(a.chartArea,p=>{const _=p.box;Object.assign(_,i.chartArea),_.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};let qu=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},Tb=class extends qu{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const Xs="$chartjs",Eb={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ll=i=>i===null||i==="";function Rb(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[Xs]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ll(s)){const o=dl(i,"width");o!==void 0&&(i.width=o)}if(Ll(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=dl(i,"height");o!==void 0&&(i.height=o)}return i}const Gu=Om?{passive:!0}:!1;function Fb(i,t,e){i&&i.addEventListener(t,e,Gu)}function Ib(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Gu)}function Bb(i,t){const e=Eb[i.type]||i.type,{x:n,y:s}=ei(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function oo(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function zb(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||oo(a.addedNodes,n),r=r&&!oo(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function $b(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||oo(a.removedNodes,n),r=r&&!oo(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Yn=new Map;let Tl=0;function Ku(){const i=window.devicePixelRatio;i!==Tl&&(Tl=i,Yn.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Nb(i,t){Yn.size||window.addEventListener("resize",Ku),Yn.set(i,t)}function Vb(i){Yn.delete(i),Yn.size||window.removeEventListener("resize",Ku)}function Wb(i,t,e){const n=i.canvas,s=n&&fa(n);if(!s)return;const o=Su((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),Nb(i,o),r}function Ko(i,t,e){e&&e.disconnect(),t==="resize"&&Vb(i)}function Hb(i,t,e){const n=i.canvas,s=Su(o=>{i.ctx!==null&&e(Bb(o,i))},i);return Fb(n,t,s),s}let jb=class extends qu{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Rb(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[Xs])return!1;const n=e[Xs].initial;["height","width"].forEach(o=>{const r=n[o];Y(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Xs],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:zb,detach:$b,resize:Wb}[e]||Hb;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:Ko,detach:Ko,resize:Ko}[e]||Ib)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return Dm(t,e,n,s)}isAttached(t){const e=fa(t);return!!(e&&e.isConnected)}};function Yb(i){return!ua()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Tb:jb}var Bs;let Pe=(Bs=class{constructor(){D(this,"x");D(this,"y");D(this,"active",!1);D(this,"options");D(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return Bi(this.x)&&Bi(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}},D(Bs,"defaults",{}),D(Bs,"defaultRoutes"),Bs);function Xb(i,t){const e=i.options.ticks,n=Ub(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?Gb(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Kb(t,c,o,r/s),c;const h=qb(o,t,s);if(r>0){let u,f;const d=r>1?Math.round((l-a)/(r-1)):null;for(ps(t,c,h,Y(d)?0:a-d,a),u=0,f=r-1;us)return l}return Math.max(s,1)}function Gb(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,El=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Rl=(i,t)=>Math.min(t||i,i);function Fl(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function t_(i,t){q(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:It(e,It(n,e)),max:It(n,It(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){tt(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=am(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=_t(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:d/(n-1),u+6>a&&(a=d/(n-(t.offset?.5:1)),l=this.maxHeight-Ki(t.grid)-e.padding-Il(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),r=na(Math.min(Math.asin(_t((h.highest.height+6)/a,-1,1)),Math.asin(_t(l/c,-1,1))-Math.asin(_t(f/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){tt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){tt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Il(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ki(o)+l):(t.height=this.maxHeight,t.width=Ki(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=n.padding*2,g=Qt(this.labelRotation),p=Math.cos(g),_=Math.sin(g);if(a){const v=n.mirror?0:_*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+v+d)}else{const v=n.mirror?0:p*u.width+_*f.height;t.width=Math.min(this.maxWidth,t.width+v+d)}this._calculatePadding(c,h,_,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=n*e.height):(f=n*t.height,d=s*e.width):o==="start"?d=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){tt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:r[P]||0,height:a[P]||0});return{first:k(0),last:k(e-1),widest:k(w),highest:k(M),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ip(this._alignToPixels?Ke(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=Ki(o),d=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,_=p/2,v=function(L){return Ke(n,L,p)};let m,x,b,y,w,M,k,P,C,S,O,T;if(r==="top")m=v(this.bottom),M=this.bottom-f,P=m-_,S=v(t.top)+_,T=t.bottom;else if(r==="bottom")m=v(this.top),S=t.top,T=v(t.bottom)-_,M=m+_,P=this.top+f;else if(r==="left")m=v(this.right),w=this.right-f,k=m-_,C=v(t.left)+_,O=t.right;else if(r==="right")m=v(this.left),C=t.left,O=v(t.right)-_,w=m+_,k=this.left+f;else if(e==="x"){if(r==="center")m=v((t.top+t.bottom)/2+.5);else if(W(r)){const L=Object.keys(r)[0],R=r[L];m=v(this.chart.scales[L].getPixelForValue(R))}S=t.top,T=t.bottom,M=m+_,P=M+f}else if(e==="y"){if(r==="center")m=v((t.left+t.right)/2);else if(W(r)){const L=Object.keys(r)[0],R=r[L];m=v(this.chart.scales[L].getPixelForValue(R))}w=m-_,k=w-f,C=t.left,O=t.right}const E=z(s.ticks.maxTicksLimit,u),A=Math.max(1,Math.ceil(u/E));for(x=0;x0&&(Jt-=Kt/2);break}At={left:Jt,top:ue,width:Kt+et.width,height:Gt+et.height,color:A.backdropColor}}_.push({label:b,font:P,textOffset:O,options:{rotation:p,color:R,strokeColor:J,strokeWidth:Q,textAlign:ft,textBaseline:T,translation:[y,w],backdrop:At}})}return _}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Qt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?s?(h=this.right+o,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+o,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");ct.route(o,s,l,a)})}function a_(i){return"id"in i&&"defaults"in i}let l_=class{constructor(){this.controllers=new ms(Xe,"datasets",!0),this.elements=new ms(Pe,"elements"),this.plugins=new ms(Object,"plugins"),this.scales=new ms(ns,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):q(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=ia(t);tt(n["before"+s],[],n),e[t](n),tt(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};function h_(i){const t={},e=[],n=Object.keys(oe.plugins.items);for(let o=0;o1&&Bl(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function zl(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function b_(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return zl(i,"x",e[0])||zl(i,"y",e[0])}return{}}function __(i,t){const e=bi[i.type]||{scales:{}},n=t.scales||{},s=Mr(i.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{const a=n[r];if(!W(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=kr(r,a,b_(r,i),ct.scales[a.type]),c=p_(l,s),h=e.scales||{};o[r]=Ln(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Mr(a,t),h=(bi[a]||{}).scales||{};Object.keys(h).forEach(u=>{const f=g_(u,l),d=r[f+"AxisID"]||f;o[d]=o[d]||Object.create(null),Ln(o[d],[{axis:f},n[d],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];Ln(a,[ct.scales[a.type],ct.scale])}),o}function Zu(i){const t=i.options||(i.options={});t.plugins=z(t.plugins,{}),t.scales=__(i,t)}function Qu(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function y_(i){return i=i||{},i.data=Qu(i.data),Zu(i),i}const $l=new Map,tf=new Set;function bs(i,t){let e=$l.get(i);return e||(e=t(),$l.set(i,e),tf.add(e)),e}const Ji=(i,t,e)=>{const n=Ne(t,e);n!==void 0&&i.add(n)};let x_=class{constructor(t){this._config=y_(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Qu(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Zu(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return bs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return bs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return bs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return bs(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Ji(l,t,u))),h.forEach(u=>Ji(l,s,u)),h.forEach(u=>Ji(l,bi[o]||{},u)),h.forEach(u=>Ji(l,ct,u)),h.forEach(u=>Ji(l,vr,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),tf.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,bi[e]||{},ct.datasets[e]||{},{type:e},ct,vr]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Nl(this._resolverCache,t,s);let l=r;if(w_(r,e)){o.$shared=!1,n=Ve(n)?n():n;const c=this.createResolver(t,n,a);l=zi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=Nl(this._resolverCache,t,n);return W(e)?zi(o,e,void 0,s):o}};function Nl(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:la(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const v_=i=>W(i)&&Object.getOwnPropertyNames(i).some(t=>Ve(i[t]));function w_(i,t){const{isScriptable:e,isIndexable:n}=Lu(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Ve(a)||v_(a))||r&&it(a))return!0}return!1}var M_="4.4.2";const k_=["top","bottom","left","right","chartArea"];function Vl(i,t){return i==="top"||i==="bottom"||k_.indexOf(i)===-1&&t==="x"}function Wl(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Hl(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),tt(e&&e.onComplete,[i],t)}function S_(i){const t=i.chart,e=t.options.animation;tt(e&&e.onProgress,[i],t)}function ef(i){return ua()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Us={},jl=i=>{const t=ef(i);return Object.values(Us).filter(e=>e.canvas===t).pop()};function P_(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function C_(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function _s(i,t,e){return i.options.clip?i[e]:t[e]}function A_(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:_s(e,t,"left"),right:_s(e,t,"right"),top:_s(n,t,"top"),bottom:_s(n,t,"bottom")}:t}var De;let wn=(De=class{static register(...t){oe.add(...t),Yl()}static unregister(...t){oe.remove(...t),Yl()}constructor(t,e){const n=this.config=new x_(e),s=ef(t),o=jl(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Yb(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=kp(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new c_,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Np(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Us[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}de.listen(this,"complete",Hl),de.listen(this,"progress",S_),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return Y(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return oe}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():fl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return cl(this.canvas,this.ctx),this}stop(){return de.stop(this),this}resize(t,e){de.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,fl(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),tt(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};q(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=kr(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),q(o,r=>{const a=r.options,l=a.id,c=kr(l,a),h=z(a.type,r.dtype);(a.position===void 0||Vl(a.position,c)!==Vl(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const f=oe.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),q(s,(r,a)=>{r||delete n[a]}),q(n,r=>{St.configure(this,r,r.options),St.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Wl("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){q(this.scales,t=>{St.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!tl(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;P_(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;St.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],q(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=A_(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Ao(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Do(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Me(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=kb.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ye(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Wn(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),de.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};q(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){q(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},q(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!to(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=Op(t),c=C_(t,this._lastEvent,n,l);n&&(this._lastEvent=null,tt(o.onHover,[t,a,this],this),l&&tt(o.onClick,[t,a,this],this));const h=!to(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},D(De,"defaults",ct),D(De,"instances",Us),D(De,"overrides",bi),D(De,"registry",oe),D(De,"version",M_),D(De,"getChart",jl),De);function Yl(){return q(wn.instances,i=>i._plugins.invalidate())}function D_(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+gt,n-gt),i.closePath(),i.clip()}function O_(i){return aa(i,["outerStart","outerEnd","innerStart","innerEnd"])}function L_(i,t,e,n){const s=O_(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return _t(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:_t(s.innerStart,0,r),innerEnd:_t(s.innerEnd,0,r)}}function ki(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function ro(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),f=h>0?h+n+e+c:0;let d=0;const g=s-l;if(n){const A=h>0?h-n:0,L=u>0?u-n:0,R=(A+L)/2,J=R!==0?g*R/(R+n):g;d=(g-J)/2}const p=Math.max(.001,g*u-e/st)/u,_=(g-p)/2,v=l+_+d,m=s-_-d,{outerStart:x,outerEnd:b,innerStart:y,innerEnd:w}=L_(t,f,u,m-v),M=u-x,k=u-b,P=v+x/M,C=m-b/k,S=f+y,O=f+w,T=v+y/S,E=m-w/O;if(i.beginPath(),o){const A=(P+C)/2;if(i.arc(r,a,u,P,A),i.arc(r,a,u,A,C),b>0){const Q=ki(k,C,r,a);i.arc(Q.x,Q.y,b,C,m+gt)}const L=ki(O,m,r,a);if(i.lineTo(L.x,L.y),w>0){const Q=ki(O,E,r,a);i.arc(Q.x,Q.y,w,m+gt,E+Math.PI)}const R=(m-w/f+(v+y/f))/2;if(i.arc(r,a,f,m-w/f,R,!0),i.arc(r,a,f,R,v+y/f,!0),y>0){const Q=ki(S,T,r,a);i.arc(Q.x,Q.y,y,T+Math.PI,v-gt)}const J=ki(M,v,r,a);if(i.lineTo(J.x,J.y),x>0){const Q=ki(M,P,r,a);i.arc(Q.x,Q.y,x,v-gt,P)}}else{i.moveTo(r,a);const A=Math.cos(P)*u+r,L=Math.sin(P)*u+a;i.lineTo(A,L);const R=Math.cos(C)*u+r,J=Math.sin(C)*u+a;i.lineTo(R,J)}i.closePath()}function T_(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){ro(i,t,e,n,l,s);for(let c=0;c=nt||Hn(r,l,c),_=ve(a,h+d,u+d);return p&&_}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(o+r)/2,f=(a+l+h+c)/2;return{x:n+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,r=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>nt?Math.floor(s/nt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(st,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,T_(e,this,h,r,a),E_(e,this,h,r,a),e.restore()}},D(Oi,"id","arc"),D(Oi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),D(Oi,"defaultRoutes",{backgroundColor:"backgroundColor"}),D(Oi,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),Oi);function nf(i,t,e=t){i.lineCap=z(e.borderCapStyle,t.borderCapStyle),i.setLineDash(z(e.borderDash,t.borderDash)),i.lineDashOffset=z(e.borderDashOffset,t.borderDashOffset),i.lineJoin=z(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=z(e.borderWidth,t.borderWidth),i.strokeStyle=z(e.borderColor,t.borderColor)}function F_(i,t,e){i.lineTo(e.x,e.y)}function I_(i){return i.stepped?Zp:i.tension||i.cubicInterpolationMode==="monotone"?Qp:F_}function sf(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-b:b))%o,x=()=>{p!==_&&(i.lineTo(h,_),i.lineTo(h,p),i.lineTo(h,v))};for(l&&(d=s[m(0)],i.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,y=d.y,w=b|0;w===g?(y_&&(_=y),h=(u*h+b)/++u):(x(),i.lineTo(b,y),g=w,u=0,p=_=y),v=y}x()}function Sr(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?z_:B_}function $_(i){return i.stepped?Lm:i.tension||i.cubicInterpolationMode==="monotone"?Tm:ii}function N_(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),nf(i,t.options),i.stroke(s)}function V_(i,t,e,n){const{segments:s,options:o}=t,r=Sr(t);for(const a of s)nf(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const W_=typeof Path2D=="function";function H_(i,t,e,n){W_&&!t.options.segment?N_(i,t,e,n):V_(i,t,e,n)}var Li;let Lo=(Li=class extends Pe{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;Mm(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zm(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=Vu(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=$_(n);let c,h;for(c=0,h=r.length;ct!=="borderDash"&&t!=="fill"}),Li);function Xl(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)i.replace("rgb(","rgba(").replace(")",", 0.5)"));function rf(i){return Pr[i%Pr.length]}function af(i){return Ul[i%Ul.length]}function Z_(i,t){return i.borderColor=rf(t),i.backgroundColor=af(t),++t}function Q_(i,t){return i.backgroundColor=i.data.map(()=>rf(t++)),t}function t0(i,t){return i.backgroundColor=i.data.map(()=>af(t++)),t}function e0(i){let t=0;return(e,n)=>{const s=i.getDatasetMeta(n).controller;s instanceof da?t=Q_(e,t):s instanceof Yu?t=t0(e,t):s&&(t=Z_(e,t))}}function ql(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function i0(i){return i&&(i.borderColor||i.backgroundColor)}var n0={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;const{data:{datasets:n},options:s}=i.config,{elements:o}=s;if(!e.forceOverride&&(ql(n)||i0(s)||o&&ql(o)))return;const r=e0(i);n.forEach(r)}};function s0(i,t,e,n,s){const o=s.samples||n;if(o>=e)return i.slice(t,t+e);const r=[],a=(e-2)/(o-2);let l=0;const c=t+e-1;let h=t,u,f,d,g,p;for(r[l++]=i[h],u=0;ud&&(d=g,f=i[m],p=m);r[l++]=f,h=p}return r[l++]=i[c],r}function o0(i,t,e,n){let s=0,o=0,r,a,l,c,h,u,f,d,g,p;const _=[],v=t+e-1,m=i[t].x,b=i[v].x-m;for(r=t;rp&&(p=c,f=r),s=(o*s+a.x)/++o;else{const w=r-1;if(!Y(u)&&!Y(f)){const M=Math.min(u,f),k=Math.max(u,f);M!==d&&M!==w&&_.push({...i[M],x:s}),k!==d&&k!==w&&_.push({...i[k],x:s})}r>0&&w!==d&&_.push(i[w]),_.push(a),h=y,o=0,g=p=c,u=f=d=r}}return _}function lf(i){if(i._decimated){const t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Gl(i){i.data.datasets.forEach(t=>{lf(t)})}function r0(i,t){const e=t.length;let n=0,s;const{iScale:o}=i,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=_t(we(t,o.axis,r).lo,0,e-1)),c?s=_t(we(t,o.axis,a).hi+1,n,e)-n:s=e-n,{start:n,count:s}}var a0={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){Gl(i);return}const n=i.width;i.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,l=i.getDatasetMeta(o),c=r||s.data;if(xn([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=i.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||i.options.parsing)return;let{start:u,count:f}=r0(l,c);const d=e.threshold||4*n;if(f<=d){lf(s);return}Y(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=s0(c,u,f,n,e);break;case"min-max":g=o0(c,u,f,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(i){Gl(i)}};function l0(i,t,e){const n=i.segments,s=i.points,o=t.points,r=[];for(const a of n){let{start:l,end:c}=a;c=pa(l,c,s);const h=Cr(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=Vu(t,h);for(const f of u){const d=Cr(e,o[f.start],o[f.end],f.loop),g=Nu(a,s,d);for(const p of g)r.push({source:p,target:f,start:{[e]:Kl(h,d,"start",Math.max)},end:{[e]:Kl(h,d,"end",Math.min)}})}}return r}function Cr(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=Bt(s),o=Bt(o)),{property:i,start:s,end:o}}function c0(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=pa(r,a,s);const l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function pa(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function Kl(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function cf(i,t){let e=[],n=!1;return it(i)?(n=!0,e=i):e=c0(i,t),e.length?new Lo({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function Jl(i){return i&&i.fill!==!1}function h0(i,t,e){let s=i[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!lt(s))return s;if(r=i[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function u0(i,t,e){const n=p0(i);if(W(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return lt(s)&&Math.floor(s)===s?f0(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function f0(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function d0(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:W(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function g0(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:W(i)?n=i.value:n=t.getBaseValue(),n}function p0(i){const t=i.options,e=t.fill;let n=z(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function m0(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,r=n.points,a=b0(t,e);a.push(cf({x:null,y:t.bottom},n));for(let l=0;l=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&Qo(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;Jl(o)&&Qo(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!Jl(n)||e.drawTime!=="beforeDatasetDraw"||Qo(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ec=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},A0=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class ic extends Pe{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=tt(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=pt(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ec(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,d=-h;return this.legendItems.forEach((g,p)=>{const _=n+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+_+2*a>r)&&(u+=h,c[c.length-(p>0?0:1)]=0,d+=h,f++),l[p]={left:0,top:d,row:f,width:_,height:s},c[c.length-1]+=_+a}),u}_fitCols(t,e,n,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,f=0,d=0,g=0,p=0;return this.legendItems.forEach((_,v)=>{const{itemWidth:m,itemHeight:x}=D0(n,e,o,_,s);v>0&&d+x+2*a>h&&(u+=f+a,c.push({width:f,height:d}),g+=f+a,p++,f=d=0),l[v]={left:g,top:d,col:p,width:m,height:x},f=Math.max(f,m),d+=x+a}),u+=f,c.push({width:f,height:d}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,r=Ei(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=kt(n,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=kt(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=kt(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=kt(n,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ao(t,this),this._draw(),Do(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:r}=t,a=ct.color,l=Ei(t.rtl,this.left,this.width),c=pt(r.font),{padding:h}=r,u=c.size,f=u/2;let d;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:_}=ec(r,u),v=function(w,M,k){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const P=z(k.lineWidth,1);if(s.fillStyle=z(k.fillStyle,a),s.lineCap=z(k.lineCap,"butt"),s.lineDashOffset=z(k.lineDashOffset,0),s.lineJoin=z(k.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=z(k.strokeStyle,a),s.setLineDash(z(k.lineDash,[])),r.usePointStyle){const C={radius:p*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:P},S=l.xPlus(w,g/2),O=M+f;Du(s,C,S,O,r.pointStyleWidth&&g)}else{const C=M+Math.max((u-p)/2,0),S=l.leftForLtr(w,g),O=di(k.borderRadius);s.beginPath(),Object.values(O).some(T=>T!==0)?jn(s,{x:S,y:C,w:g,h:p,radius:O}):s.rect(S,C,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},m=function(w,M,k){_i(s,k.text,w,M+_/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},x=this.isHorizontal(),b=this._computeTitleHeight();x?d={x:kt(o,this.left+h,this.right-n[0]),y:this.top+h+b,line:0}:d={x:this.left+h,y:kt(o,this.top+b+h,this.bottom-e[0].height),line:0},Bu(this.ctx,t.textDirection);const y=_+h;this.legendItems.forEach((w,M)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const k=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=r.textAlign)),C=g+f+k;let S=d.x,O=d.y;l.setWidth(this.width),x?M>0&&S+C+h>this.right&&(O=d.y+=y,d.line++,S=d.x=kt(o,this.left+h,this.right-n[d.line])):M>0&&O+y>this.bottom&&(S=d.x=S+e[d.line].width+h,d.line++,O=d.y=kt(o,this.top+b+h,this.bottom-e[d.line].height));const T=l.x(S);if(v(T,O,w),S=Vp(P,S+g+f,x?S+C:this.right,t.rtl),m(l.x(S),O,w),x)d.x+=C+h;else if(typeof w.text!="string"){const E=c.lineHeight;d.y+=uf(w,E)+h}else d.y+=y}),zu(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=pt(e.font),s=Ct(e.padding);if(!e.display)return;const o=Ei(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=n.size/2,c=s.top+l;let h,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,u=kt(t.align,u,this.right-f);else{const g=this.columnSizes.reduce((p,_)=>Math.max(p,_.height),0);h=c+kt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const d=kt(a,u,u+f);r.textAlign=o.textAlign(oa(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=n.string,_i(r,e.text,d,h,n)}_computeTitleHeight(){const t=this.options.title,e=pt(t.font),n=Ct(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(ve(t,this.left,this.right)&&ve(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;no.length>r.length?o:r)),t+e.size/2+n.measureText(s).width}function L0(i,t,e){let n=i;return typeof t.text!="string"&&(n=uf(t,e)),n}function uf(i,t){const e=i.text?i.text.length:0;return t*e}function T0(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var E0={id:"legend",_element:ic,start(i,t,e){const n=i.legend=new ic({ctx:i.ctx,options:e,chart:i});St.configure(i,n,e),St.addBox(i,n)},stop(i){St.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;St.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=Ct(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class ma extends Pe{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=it(n.text)?n.text.length:1;this._padding=Ct(n.padding);const o=s*pt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=kt(a,n,o),u=e+t,c=o-n):(r.position==="left"?(h=n+t,u=kt(a,s,e),l=st*-.5):(h=o-t,u=kt(a,e,s),l=st*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=pt(e.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);_i(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:oa(e.align),textBaseline:"middle",translation:[r,a]})}}function R0(i,t){const e=new ma({ctx:i.ctx,options:t,chart:i});St.configure(i,e,t),St.addBox(i,e),i.titleBlock=e}var F0={id:"title",_element:ma,start(i,t,e){R0(i,e)},stop(i){const t=i.titleBlock;St.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;St.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ys=new WeakMap;var I0={id:"subtitle",start(i,t,e){const n=new ma({ctx:i.ctx,options:e,chart:i});St.configure(i,n,e),St.addBox(i,n),ys.set(i,n)},stop(i){St.removeBox(i,ys.get(i)),ys.delete(i)},beforeUpdate(i,t,e){const n=ys.get(i);St.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Mn={average(i){if(!i.length)return!1;let t,e,n=new Set,s=0,o=0;for(t=0,e=i.length;ta+l)/n.size,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o-1?i.split(` -`):i}function B0(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function nc(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=pt(t.bodyFont),c=pt(t.titleFont),h=pt(t.footerFont),u=o.length,f=s.length,d=n.length,g=Ct(t.padding);let p=g.height,_=0,v=n.reduce((b,y)=>b+y.before.length+y.lines.length+y.after.length,0);if(v+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),v){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(v-d)*l.lineHeight+(v-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const x=function(b){_=Math.max(_,e.measureText(b).width+m)};return e.save(),e.font=c.string,q(i.title,x),e.font=l.string,q(i.beforeBody.concat(i.afterBody),x),m=t.displayColors?r+2+t.boxPadding:0,q(n,b=>{q(b.before,x),q(b.lines,x),q(b.after,x)}),m=0,e.font=h.string,q(i.footer,x),e.restore(),_+=g.width,{width:_,height:p}}function z0(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function $0(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function N0(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),$0(c,i,t,e)&&(c="center"),c}function sc(i,t,e){const n=e.yAlign||t.yAlign||z0(i,e);return{xAlign:e.xAlign||t.xAlign||N0(i,t,e,n),yAlign:n}}function V0(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function W0(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function oc(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=di(r);let g=V0(t,a);const p=W0(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:_t(g,0,n.width-t.width),y:_t(p,0,n.height-t.height)}}function xs(i,t,e){const n=Ct(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function rc(i){return ne([],ge(i))}function H0(i,t,e){return Ye(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function ac(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ff={beforeTitle:fe,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex"u"?ff[t].call(e,n):s}var gr;let lc=(gr=class extends Pe{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Wu(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=H0(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=Lt(n,"beforeTitle",this,t),o=Lt(n,"title",this,t),r=Lt(n,"afterTitle",this,t);let a=[];return a=ne(a,ge(s)),a=ne(a,ge(o)),a=ne(a,ge(r)),a}getBeforeBody(t,e){return rc(Lt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return q(t,o=>{const r={before:[],lines:[],after:[]},a=ac(n,o);ne(r.before,ge(Lt(a,"beforeLabel",this,o))),ne(r.lines,Lt(a,"label",this,o)),ne(r.after,ge(Lt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return rc(Lt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=Lt(n,"beforeFooter",this,t),o=Lt(n,"footer",this,t),r=Lt(n,"afterFooter",this,t);let a=[];return a=ne(a,ge(s)),a=ne(a,ge(o)),a=ne(a,ge(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),q(a,h=>{const u=ac(t.callbacks,h);s.push(Lt(u,"labelColor",this,h)),o.push(Lt(u,"labelPointStyle",this,h)),r.push(Lt(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Mn[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=nc(this,n),c=Object.assign({},a,l),h=sc(this.chart,n,c),u=oc(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=di(a),{x:f,y:d}=t,{width:g,height:p}=e;let _,v,m,x,b,y;return o==="center"?(b=d+p/2,s==="left"?(_=f,v=_-r,x=b+r,y=b-r):(_=f+g,v=_+r,x=b-r,y=b+r),m=_):(s==="left"?v=f+Math.max(l,h)+r:s==="right"?v=f+g-Math.max(c,u)-r:v=this.caretX,o==="top"?(x=d,b=x-r,_=v-r,m=v+r):(x=d+p,b=x+r,_=v+r,m=v-r),y=x),{x1:_,x2:v,x3:m,y1:x,y2:b,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ei(n.rtl,this.x,this.width);for(t.x=xs(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=pt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lm!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,jn(t,{x:p,y:g,w:c,h:l,radius:v}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),jn(t,{x:_,y:g+1,w:c-2,h:l-2,radius:v}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(_,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=pt(n.bodyFont);let f=u.lineHeight,d=0;const g=Ei(n.rtl,this.x,this.width),p=function(k){e.fillText(k,g.x(t.x+d),t.y+f/2),t.y+=f+o},_=g.textAlign(r);let v,m,x,b,y,w,M;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=xs(this,_,n),e.fillStyle=n.bodyColor,q(this.beforeBody,p),d=a&&_!=="right"?r==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=Mn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=nc(this,t),l=Object.assign({},r,this._size),c=sc(e,t,l),h=oc(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=Ct(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),Bu(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),zu(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!to(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!to(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=Mn[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}},D(gr,"positioners",Mn),gr);var j0={id:"tooltip",_element:lc,positioners:Mn,afterInit(i,t,e){e&&(i.tooltip=new lc({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ff},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Y0=Object.freeze({__proto__:null,Colors:n0,Decimation:a0,Filler:C0,Legend:E0,SubTitle:I0,Title:F0,Tooltip:j0});const X0=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function U0(i,t,e,n){const s=i.indexOf(t);if(s===-1)return X0(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const q0=(i,t)=>i===null?null:_t(Math.round(i),0,t);function cc(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},D(zs,"id","category"),D(zs,"defaults",{ticks:{callback:cc}}),zs);function K0(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=i,d=o||1,g=h-1,{min:p,max:_}=t,v=!Y(r),m=!Y(a),x=!Y(c),b=(_-p)/(u+1);let y=il((_-p)/g/d)*d,w,M,k,P;if(y<1e-14&&!v&&!m)return[{value:p},{value:_}];P=Math.ceil(_/y)-Math.floor(p/y),P>g&&(y=il(P*y/g/d)*d),Y(l)||(w=Math.pow(10,l),y=Math.ceil(y*w)/w),s==="ticks"?(M=Math.floor(p/y)*y,k=Math.ceil(_/y)*y):(M=p,k=_),v&&m&&o&&Rp((a-r)/o,y/1e3)?(P=Math.round(Math.min((a-r)/y,h)),y=(a-r)/P,M=r,k=a):x?(M=v?r:M,k=m?a:k,P=c-1,y=(k-M)/P):(P=(k-M)/y,Tn(P,Math.round(P),y/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(nl(y),nl(M));w=Math.pow(10,Y(l)?C:l),M=Math.round(M*w)/w,k=Math.round(k*w)/w;let S=0;for(v&&(f&&M!==r?(e.push({value:r}),Ma)break;e.push({value:O})}return m&&f&&k!==a?e.length&&Tn(e[e.length-1].value,a,hc(a,b,i))?e[e.length-1].value=a:e.push({value:a}):(!m||k===a)&&e.push({value:k}),e}function hc(i,t,{horizontal:e,minRotation:n}){const s=Qt(n),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}let ao=class extends ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Y(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=n?o:l;if(t){const l=le(s),c=le(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=K0(s,o);return t.bounds==="ticks"&&xu(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return es(t,this.chart.options.locale,this.options.ticks.format)}};var $s;let J0=($s=class extends ao{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=lt(t)?t:0,this.max=lt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=Qt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},D($s,"id","linear"),D($s,"defaults",{ticks:{callback:Co.formatters.numeric}}),$s);const Xn=i=>Math.floor(Re(i)),Ze=(i,t)=>Math.pow(10,Xn(i)+t);function uc(i){return i/Math.pow(10,Xn(i))===1}function fc(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Z0(i,t){const e=t-i;let n=Xn(e);for(;fc(i,t,n)>10;)n++;for(;fc(i,t,n)<10;)n--;return Math.min(n,Xn(i))}function Q0(i,{min:t,max:e}){t=It(i.min,t);const n=[],s=Xn(t);let o=Z0(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,o)),f=It(i.min,Math.round((l+h+u*Math.pow(10,o))*r)/r);for(;f=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),f=Math.round((l+h+u*Math.pow(10,o))*r)/r;const d=It(i.max,f);return n.push({value:d,major:uc(d),significand:u}),n}var Ns;let ty=(Ns=class extends ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=ao.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return lt(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=lt(t)?Math.max(0,t):null,this.max=lt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!lt(this._userMin)&&(this.min=t===Ze(this.min,0)?Ze(this.min,-1):Ze(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=a=>n=t?n:a,r=a=>s=e?s:a;n===s&&(n<=0?(o(1),r(10)):(o(Ze(n,-1)),r(Ze(s,1)))),n<=0&&o(Ze(s,-1)),s<=0&&r(Ze(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=Q0(e,this);return t.bounds==="ticks"&&xu(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":es(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Re(t),this._valueRange=Re(this.max)-Re(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Re(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},D(Ns,"id","logarithmic"),D(Ns,"defaults",{ticks:{callback:Co.formatters.logarithmic,major:{enabled:!0}}}),Ns);function Ar(i){const t=i.ticks;if(t.display&&i.display){const e=Ct(t.backdropPadding);return z(t.font&&t.font.size,ct.font.size)+e.height}return 0}function ey(i,t,e){return e=it(e)?e:[e],{w:Jp(i,t.string,e),h:e.length*t.lineHeight}}function dc(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function iy(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?st/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function sy(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,n+s+r,o),c=Math.round(na(Bt(l.angle+gt))),h=cy(l.y,a.h,c),u=ay(c),f=ly(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:f,top:h,right:f+a.w,bottom:h+a.h}}function oy(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(Me({x:e,y:n},t)||Me({x:e,y:o},t)||Me({x:s,y:n},t)||Me({x:s,y:o},t))}function ry(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Ar(o)/2,additionalAngle:r?st/s:0};let c;for(let h=0;h270||e<90)&&(i-=t),i}function hy(i,t,e){const{left:n,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!Y(a)){const l=di(t.borderRadius),c=Ct(t.backdropPadding);i.fillStyle=a;const h=n-c.left,u=s-c.top,f=o-n+c.width,d=r-s+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),jn(i,{x:h,y:u,w:f,h:d,radius:l}),i.fill()):i.fillRect(h,u,f,d)}}function uy(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const r=n.setContext(i.getPointLabelContext(s));hy(e,r,o);const a=pt(r.font),{x:l,y:c,textAlign:h}=o;_i(e,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function df(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,nt);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=tt(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?iy(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=nt/(this._pointLabels.length||1),n=this.options.startAngle||0;return Bt(t*e+Qt(n))}getDistanceFromCenterForValue(t){if(Y(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Y(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(u),d=s.setContext(f),g=o.setContext(f);fy(this,d,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){const h=n.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:f}=h;!f||!u||(t.lineWidth=f,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=pt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Ct(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}_i(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},D(Ti,"id","radialLinear"),D(Ti,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Co.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),D(Ti,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),D(Ti,"descriptors",{angleLines:{_fallback:"grid"}}),Ti);const To={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Rt=Object.keys(To);function gc(i,t){return i-t}function pc(i,t){if(Y(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),lt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(Bi(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function mc(i,t,e,n){const s=Rt.length;for(let o=Rt.indexOf(i);o=Rt.indexOf(e);o--){const r=Rt[o];if(To[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return Rt[e?Rt.indexOf(e):0]}function my(i){for(let t=Rt.indexOf(i)+1,e=Rt.length;t=t?e[n]:e[s];i[o]=!0}}function by(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function _c(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=_t(e,0,r),n=_t(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||mc(o.minUnit,e,n,this._getLabelCapacity(e)),a=z(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Bi(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;f+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.ticks.callback;if(r)return tt(r,[t,e,n],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],f=n[e],d=c&&u&&f&&f.major;return this._adapter.format(t,s||(d?u:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=we(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=we(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}var Ws;let _y=(Ws=class extends Dr{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=vs(e,this.min),this._tableRange=vs(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;rs-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(vs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return vs(this._table,n*this._tableRange+this._minPos,!0)}},D(Ws,"id","timeseries"),D(Ws,"defaults",Dr.defaults),Ws);var yy=Object.freeze({__proto__:null,CategoryScale:G0,LinearScale:J0,LogarithmicScale:ty,RadialLinearScale:gy,TimeScale:Dr,TimeSeriesScale:_y});const xy=[_b,J_,Y0,yy];/*! - * Chart.js v3.9.1 - * https://www.chartjs.org - * (c) 2022 Chart.js Contributors - * Released under the MIT License - */const vy=function(){let i=0;return function(){return i++}}();function K(i){return i===null||typeof i>"u"}function ot(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function X(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}const wt=i=>(typeof i=="number"||i instanceof Number)&&isFinite(+i);function Vt(i,t){return wt(i)?i:t}function j(i,t){return typeof i>"u"?t:i}const wy=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:i/t,gf=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function at(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function G(i,t,e,n){let s,o,r;if(ot(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function We(i,t){return(yc[t]||(yc[t]=Sy(t)))(i)}function Sy(i){const t=Py(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function Py(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function ba(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Ut=i=>typeof i<"u",He=i=>typeof i=="function",xc=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Cy(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const ut=Math.PI,Z=2*ut,Ay=Z+ut,ho=Number.POSITIVE_INFINITY,Dy=ut/180,ht=ut/2,Zi=ut/4,vc=ut*2/3,Ht=Math.log10,ce=Math.sign;function wc(i){const t=Math.round(i);i=In(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Ht(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function Oy(i){const t=[],e=Math.sqrt(i);let n;for(n=1;ns-o).pop(),t}function Ni(i){return!isNaN(parseFloat(i))&&isFinite(i)}function In(i,t,e){return Math.abs(i-t)=i}function mf(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function ya(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const li=(i,t,e,n)=>ya(i,e,n?s=>i[s][t]<=e:s=>i[s][t]ya(i,e,n=>i[n][t]>=e);function Fy(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+ba(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function kc(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(_f.forEach(o=>{delete i[o]}),delete i._chartjs)}function yf(i){const t=new Set;let e,n;for(e=0,n=i.length;e"u"?function(i){return i()}:window.requestAnimationFrame}();function vf(i,t,e){const n=e||(r=>Array.prototype.slice.call(r));let s=!1,o=[];return function(...r){o=n(r),s||(s=!0,xf.call(window,()=>{s=!1,i.apply(t,o)}))}}function By(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const zy=i=>i==="start"?"left":i==="end"?"right":"center",Sc=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2;function wf(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:f}=r.getUserBounds();u&&(s=Pt(Math.min(li(a,r.axis,c).lo,e?n:li(t,l,r.getPixelForValue(c)).lo),0,n-1)),f?o=Pt(Math.max(li(a,r.axis,h,!0).hi+1,e?0:li(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function Mf(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const ws=i=>i===0||i===1,Pc=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Z/e)),Cc=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Z/e)+1,Bn={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*ht)+1,easeOutSine:i=>Math.sin(i*ht),easeInOutSine:i=>-.5*(Math.cos(ut*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>ws(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>ws(i)?i:Pc(i,.075,.3),easeOutElastic:i=>ws(i)?i:Cc(i,.075,.3),easeInOutElastic(i){return ws(i)?i:i<.5?.5*Pc(i*2,.1125,.45):.5+.5*Cc(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-Bn.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?Bn.easeInBounce(i*2)*.5:Bn.easeOutBounce(i*2-1)*.5+.5};/*! - * @kurkle/color v0.2.1 - * https://github.com/kurkle/color#readme - * (c) 2022 Jukka Kurkela - * Released under the MIT License - */function ss(i){return i+.5|0}const Ie=(i,t,e)=>Math.max(Math.min(i,e),t);function kn(i){return Ie(ss(i*2.55),0,255)}function $e(i){return Ie(ss(i*255),0,255)}function _e(i){return Ie(ss(i/2.55)/100,0,1)}function Ac(i){return Ie(ss(i*100),0,100)}const Nt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Lr=[..."0123456789ABCDEF"],$y=i=>Lr[i&15],Ny=i=>Lr[(i&240)>>4]+Lr[i&15],Ms=i=>(i&240)>>4===(i&15),Vy=i=>Ms(i.r)&&Ms(i.g)&&Ms(i.b)&&Ms(i.a);function Wy(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Nt[i[1]]*17,g:255&Nt[i[2]]*17,b:255&Nt[i[3]]*17,a:t===5?Nt[i[4]]*17:255}:(t===7||t===9)&&(e={r:Nt[i[1]]<<4|Nt[i[2]],g:Nt[i[3]]<<4|Nt[i[4]],b:Nt[i[5]]<<4|Nt[i[6]],a:t===9?Nt[i[7]]<<4|Nt[i[8]]:255})),e}const Hy=(i,t)=>i<255?t(i):"";function jy(i){var t=Vy(i)?$y:Ny;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Hy(i.a,t):void 0}const Yy=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function kf(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function Xy(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Uy(i,t,e){const n=kf(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function qy(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=qy(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function va(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map($e)}function wa(i,t,e){return va(kf,i,t,e)}function Gy(i,t,e){return va(Uy,i,t,e)}function Ky(i,t,e){return va(Xy,i,t,e)}function Sf(i){return(i%360+360)%360}function Jy(i){const t=Yy.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?kn(+t[5]):$e(+t[5]));const s=Sf(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=Gy(s,o,r):t[1]==="hsv"?n=Ky(s,o,r):n=wa(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function Zy(i,t){var e=xa(i);e[0]=Sf(e[0]+t),e=wa(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Qy(i){if(!i)return;const t=xa(i),e=t[0],n=Ac(t[1]),s=Ac(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${_e(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const Dc={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Oc={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function tx(){const i={},t=Object.keys(Oc),e=Object.keys(Dc);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let ks;function ex(i){ks||(ks=tx(),ks.transparent=[0,0,0,0]);const t=ks[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const ix=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function nx(i){const t=ix.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?kn(r):Ie(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?kn(n):Ie(n,0,255)),s=255&(t[4]?kn(s):Ie(s,0,255)),o=255&(t[6]?kn(o):Ie(o,0,255)),{r:n,g:s,b:o,a:e}}}function sx(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${_e(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const tr=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Si=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function ox(i,t,e){const n=Si(_e(i.r)),s=Si(_e(i.g)),o=Si(_e(i.b));return{r:$e(tr(n+e*(Si(_e(t.r))-n))),g:$e(tr(s+e*(Si(_e(t.g))-s))),b:$e(tr(o+e*(Si(_e(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Ss(i,t,e){if(i){let n=xa(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=wa(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function Pf(i,t){return i&&Object.assign(t||{},i)}function Lc(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=$e(i[3]))):(t=Pf(i,{r:0,g:0,b:0,a:1}),t.a=$e(t.a)),t}function rx(i){return i.charAt(0)==="r"?nx(i):Jy(i)}class fo{constructor(t){if(t instanceof fo)return t;const e=typeof t;let n;e==="object"?n=Lc(t):e==="string"&&(n=Wy(t)||ex(t)||rx(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=Pf(this._rgb);return t&&(t.a=_e(t.a)),t}set rgb(t){this._rgb=Lc(t)}rgbString(){return this._valid?sx(this._rgb):void 0}hexString(){return this._valid?jy(this._rgb):void 0}hslString(){return this._valid?Qy(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=ox(this._rgb,t._rgb,e)),this}clone(){return new fo(this.rgb)}alpha(t){return this._rgb.a=$e(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=ss(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ss(this._rgb,2,t),this}darken(t){return Ss(this._rgb,2,-t),this}saturate(t){return Ss(this._rgb,1,t),this}desaturate(t){return Ss(this._rgb,1,-t),this}rotate(t){return Zy(this._rgb,t),this}}function Cf(i){return new fo(i)}function Af(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Tc(i){return Af(i)?i:Cf(i)}function er(i){return Af(i)?i:Cf(i).saturate(.5).darken(.1).hexString()}const yi=Object.create(null),Tr=Object.create(null);function zn(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;ne.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,n)=>er(n.backgroundColor),this.hoverBorderColor=(e,n)=>er(n.borderColor),this.hoverColor=(e,n)=>er(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return ir(this,t,e)}get(t){return zn(this,t)}describe(t,e){return ir(Tr,t,e)}override(t,e){return ir(yi,t,e)}route(t,e,n,s){const o=zn(this,t),r=zn(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return X(l)?Object.assign({},c,l):j(l,c)},set(l){this[a]=l}}})}}var H=new ax({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function lx(i){return!i||K(i.size)||K(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function go(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function cx(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function Gn(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,dx(i,o),l=0;l+i||0;function Ma(i,t){const e={},n=X(t),s=n?Object.keys(t):t,o=X(i)?n?r=>j(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=_x(o(r));return e}function Lf(i){return Ma(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Ri(i){return Ma(i,["topLeft","topRight","bottomLeft","bottomRight"])}function qt(i){const t=Lf(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function zt(i,t){i=i||{},t=t||H.font;let e=j(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=j(i.style,t.style);n&&!(""+n).match(mx)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const s={family:j(i.family,t.family),lineHeight:bx(j(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:j(i.weight,t.weight),string:""};return s.string=lx(s),s}function Ps(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Ue(i,t){return Object.assign(Object.create(i),t)}function ka(i,t=[""],e=i,n,s=()=>i[0]){Ut(n)||(n=Ff("_fallback",i));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:e,_fallback:n,_getTarget:s,override:r=>ka([r,...i],t,e,n)};return new Proxy(o,{deleteProperty(r,a){return delete r[a],delete r._keys,delete i[0][a],!0},get(r,a){return Ef(r,a,()=>Cx(a,t,i,r))},getOwnPropertyDescriptor(r,a){return Reflect.getOwnPropertyDescriptor(r._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,a){return Fc(r).includes(a)},ownKeys(r){return Fc(r)},set(r,a,l){const c=r._storage||(r._storage=s());return r[a]=c[a]=l,delete r._keys,!0}})}function Vi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Tf(i,n),setContext:o=>Vi(i,o,e,n),override:o=>Vi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ef(o,r,()=>vx(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Tf(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:He(e)?e:()=>e,isIndexable:He(n)?n:()=>n}}const xx=(i,t)=>i?i+ba(t):t,Sa=(i,t)=>X(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ef(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function vx(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return He(a)&&r.isScriptable(t)&&(a=wx(t,a,i,e)),ot(a)&&a.length&&(a=Mx(t,a,i,r.isIndexable)),Sa(t,a)&&(a=Vi(a,s,o&&o[t],r)),a}function wx(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);return a.add(i),t=t(o,r||n),a.delete(i),Sa(i,t)&&(t=Pa(s._scopes,s,i,t)),t}function Mx(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(Ut(o.index)&&n(i))t=t[o.index%t.length];else if(X(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Pa(c,s,i,h);t.push(Vi(u,o,r&&r[i],a))}}return t}function Rf(i,t,e){return He(i)?i(t,e):i}const kx=(i,t)=>i===!0?t:typeof i=="string"?We(t,i):void 0;function Sx(i,t,e,n,s){for(const o of t){const r=kx(e,o);if(r){i.add(r);const a=Rf(r._fallback,e,s);if(Ut(a)&&a!==e&&a!==n)return a}else if(r===!1&&Ut(n)&&e!==n)return null}return!1}function Pa(i,t,e,n){const s=t._rootScopes,o=Rf(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=Rc(a,r,e,o||e,n);return l===null||Ut(o)&&o!==e&&(l=Rc(a,r,o,l,n),l===null)?!1:ka(Array.from(a),[""],s,o,()=>Px(t,e,n))}function Rc(i,t,e,n,s){for(;e;)e=Sx(i,t,e,n,s);return e}function Px(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return ot(s)&&X(e)?e:s}function Cx(i,t,e,n){let s;for(const o of t)if(s=Ff(xx(o,i),e),Ut(s))return Sa(i,s)?Pa(e,n,i,s):s}function Ff(i,t){for(const e of t){if(!e)continue;const n=e[i];if(Ut(n))return n}}function Fc(i){let t=i._keys;return t||(t=i._keys=Ax(i._scopes)),t}function Ax(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function If(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function Ox(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=Or(o,s),l=Or(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,f=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+f*(r.x-s.x),y:o.y+f*(r.y-s.y)}}}function Lx(i,t,e){const n=i.length;let s,o,r,a,l,c=Wi(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Ex(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;owindow.getComputedStyle(i,null);function Ix(i,t){return Eo(i).getPropertyValue(t)}const Bx=["top","right","bottom","left"];function pi(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=Bx[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const zx=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function $x(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(zx(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function ni(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=Eo(e),o=s.boxSizing==="border-box",r=pi(s,"padding"),a=pi(s,"border","width"),{x:l,y:c,box:h}=$x(i,e),u=r.left+(h&&a.left),f=r.top+(h&&a.top);let{width:d,height:g}=t;return o&&(d-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/d*e.width/n),y:Math.round((c-f)/g*e.height/n)}}function Nx(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Ca(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=Eo(o),l=pi(a,"border","width"),c=pi(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=bo(a.maxWidth,o,"clientWidth"),s=bo(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||ho,maxHeight:s||ho}}const nr=i=>Math.round(i*10)/10;function Vx(i,t,e,n){const s=Eo(i),o=pi(s,"margin"),r=bo(s.maxWidth,i,"clientWidth")||ho,a=bo(s.maxHeight,i,"clientHeight")||ho,l=Nx(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=pi(s,"border","width"),f=pi(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?Math.floor(c/n):h-o.height),c=nr(Math.min(c,r,l.maxWidth)),h=nr(Math.min(h,a,l.maxHeight)),c&&!h&&(h=nr(c/2)),{width:c,height:h}}function Ic(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=s/n,i.width=o/n;const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const Wx=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function Bc(i,t){const e=Ix(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function si(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Hx(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function jx(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=si(i,s,e),a=si(s,o,e),l=si(o,t,e),c=si(r,a,e),h=si(a,l,e);return si(c,h,e)}const zc=new Map;function Yx(i,t){t=t||{};const e=i+JSON.stringify(t);let n=zc.get(e);return n||(n=new Intl.NumberFormat(i,t),zc.set(e,n)),n}function os(i,t,e){return Yx(t,e).format(i)}const Xx=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},Ux=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function sr(i,t,e){return i?Xx(t,e):Ux()}function qx(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function Gx(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function $f(i){return i==="angle"?{between:qn,compare:Ty,normalize:Zt}:{between:uo,compare:(t,e)=>t-e,normalize:t=>t}}function $c({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Kx(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=$f(n),l=t.length;let{start:c,end:h,loop:u}=i,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,x,v)&&a(s,x)!==0,y=()=>a(o,v)===0||l(o,x,v),w=()=>p||b(),M=()=>!p||y();for(let k=h,P=h;k<=u;++k)m=t[k%r],!m.skip&&(v=c(m[n]),v!==x&&(p=l(v,s,o),_===null&&w()&&(_=a(v,s)===0?k:P),_!==null&&M()&&(g.push($c({start:_,end:k,loop:f,count:r,style:d})),_=null),P=k,x=v));return _!==null&&g.push($c({start:_,end:u,loop:f,count:r,style:d})),g}function Zx(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function t1(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function e1(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=Qx(e,s,o,n);if(n===!0)return Nc(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=xf.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var pe=new s1;const Wc="transparent",o1={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=Tc(i||Wc),s=n.valid&&Tc(t||Wc);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class r1{constructor(t,e,n,s){const o=e[n];s=Ps([t.to,s,o,t.from]);const r=Ps([t.from,o,s]);this._active=!0,this._fn=t.fn||o1[t.type||typeof r],this._easing=Bn[t.easing]||Bn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ps([t.to,e,s,t.from]),this._from=Ps([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;si!=="onProgress"&&i!=="onComplete"&&i!=="fn"});H.set("animations",{colors:{type:"color",properties:l1},numbers:{type:"number",properties:a1}});H.describe("animations",{_fallback:"animation"});H.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:i=>i|0}}}});class Nf{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!X(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const s=t[n];if(!X(s))return;const o={};for(const r of c1)o[r]=s[r];(ot(s.properties)&&s.properties||[n]).forEach(r=>{(r===n||!e.has(r))&&e.set(r,o)})})}_animateOptions(t,e){const n=e.options,s=u1(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&h1(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const f=n.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=u=new r1(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return pe.add(this._chart,n),!0}}function h1(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function Uc(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=p1(o,r,n),u=t.length;let f;for(let d=0;de[n].axis===t).shift()}function _1(i,t){return Ue(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function y1(i,t,e){return Ue(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Qi(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e]}}}const rr=i=>i==="reset"||i==="none",qc=(i,t)=>t?i:Object.assign({},i),x1=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Vf(e,!0),values:null};class ee{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Yc(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Qi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,o=e.xAxisID=j(n.xAxisID,or(t,"x")),r=e.yAxisID=j(n.yAxisID,or(t,"y")),a=e.rAxisID=j(n.rAxisID,or(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&kc(this._data,this),t._stacked&&Qi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(X(e))this._data=g1(e);else if(n!==e){if(n){kc(n,this);const s=this._cachedMeta;Qi(s),s._parsed=[]}e&&Object.isExtensible(e)&&Iy(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=Yc(e.vScale,e),e.stack!==n.stack&&(s=!0,Qi(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&Uc(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,f;if(this._parsing===!1)n._parsed=s,n._sorted=!0,f=s;else{ot(s[t])?f=this.parseArrayData(n,s,t,e):X(s[t])?f=this.parseObjectData(n,s,t,e):f=this.parsePrimitiveData(n,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(qc(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,n,e))}const c=new Nf(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||rr(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){rr(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!rr(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function w1(i){const t=i.iScale,e=v1(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(Ut(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Wf(i,t,e,n){return ot(i)?S1(i,t,e,n):t[e.axis]=e.parse(i,n),t}function Gc(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,f;for(c=e,h=e+n;c=e?1:-1)}function C1(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(K(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:n,yScale:s}=e,o=this.getParsed(t),r=n.getLabelForValue(o.x),a=s.getLabelForValue(o.y),l=o._custom;return{label:e.label,value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let f=e;fqn(x,a,l,!0)?1:Math.max(b,b*e,y,y*e),g=(x,b,y)=>qn(x,a,l,!0)?-1:Math.min(b,b*e,y,y*e),p=d(0,c,u),_=d(ht,h,f),v=g(ut,c,u),m=g(ut+ht,h,f);n=(p-v)/2,s=(_-m)/2,o=-(p+v)/2,r=-(_+m)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}class rs extends ee{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(X(n[t])){const{key:l="value"}=this._parsing;o=c=>+We(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?Z*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=os(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;si!=="spacing",_indexable:i=>i!=="spacing"};rs.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){let t=i.label;const e=": "+i.formattedValue;return ot(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class Oa extends ee{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=wf(e,s,r);this._drawStart=a,this._drawCount=l,Mf(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=r.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,_=Ni(g)?g:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||s==="none";let m=e>0&&this.getParsed(e-1);for(let x=e;x0&&Math.abs(y[f]-m[f])>_,p&&(w.parsed=y,w.raw=c.data[x]),u&&(w.options=h||this.resolveDataElementOptions(x,b.active?"active":s)),v||this.updateElement(b,x,w,s),m=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Oa.id="line";Oa.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Oa.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class La extends ee{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=os(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return If.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*ut;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?te(this.resolveDataElementOptions(t,e).angle||n):0}}La.id="polarArea";La.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};La.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){return i.chart.data.labels[i.dataIndex]+": "+i.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Hf extends rs{}Hf.id="pie";Hf.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ta extends ee{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return If.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}}Ce.defaults={};Ce.defaultRoutes=void 0;const jf={values(i){return ot(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=T1(i,e)}const r=Ht(Math.abs(o)),a=Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),os(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=i/Math.pow(10,Math.floor(Ht(i)));return n===1||n===2||n===5?jf.numeric.call(this,i,t,e):""}};function T1(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Ro={formatters:jf};H.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ro.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});H.route("scale.ticks","color","","color");H.route("scale.grid","color","","borderColor");H.route("scale.grid","borderColor","","borderColor");H.route("scale.title","color","","color");H.describe("scale",{_fallback:!1,_scriptable:i=>!i.startsWith("before")&&!i.startsWith("after")&&i!=="callback"&&i!=="parser",_indexable:i=>i!=="borderDash"&&i!=="tickBorderDash"});H.describe("scales",{_fallback:"scale"});H.describe("scale.ticks",{_scriptable:i=>i!=="backdropPadding"&&i!=="callback",_indexable:i=>i!=="backdropPadding"});function E1(i,t){const e=i.options.ticks,n=e.maxTicksLimit||R1(i),s=e.major.enabled?I1(t):[],o=s.length,r=s[0],a=s[o-1],l=[];if(o>n)return B1(t,l,s,o/n),l;const c=F1(s,t,n);if(o>0){let h,u;const f=o>1?Math.round((a-r)/(o-1)):null;for(As(t,l,c,K(f)?0:r-f,r),h=0,u=o-1;hs)return l}return Math.max(s,1)}function I1(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,Zc=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e;function Qc(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function V1(i,t){G(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:Vt(e,Vt(n,e)),max:Vt(n,Vt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){at(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=yx(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=Pt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:d/(n-1),u+6>a&&(a=d/(n-(t.offset?.5:1)),l=this.maxHeight-tn(t.grid)-e.padding-th(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),r=_a(Math.min(Math.asin(Pt((h.highest.height+6)/a,-1,1)),Math.asin(Pt(l/c,-1,1))-Math.asin(Pt(f/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){at(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){at(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=th(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=tn(o)+l):(t.height=this.maxHeight,t.width=tn(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=n.padding*2,g=te(this.labelRotation),p=Math.cos(g),_=Math.sin(g);if(a){const v=n.mirror?0:_*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+v+d)}else{const v=n.mirror?0:p*u.width+_*f.height;t.width=Math.min(this.maxWidth,t.width+v+d)}this._calculatePadding(c,h,_,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=n*e.height):(f=n*t.height,d=s*e.width):o==="start"?d=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){at(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:o[M]||0,height:r[M]||0});return{first:w(0),last:w(e-1),widest:w(b),highest:w(y),widths:o,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ey(this._alignToPixels?Qe(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r}=s,a=o.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=tn(o),f=[],d=o.setContext(this.getContext()),g=d.drawBorder?d.borderWidth:0,p=g/2,_=function(A){return Qe(n,A,g)};let v,m,x,b,y,w,M,k,P,C,S,O;if(r==="top")v=_(this.bottom),w=this.bottom-u,k=v-p,C=_(t.top)+p,O=t.bottom;else if(r==="bottom")v=_(this.top),C=t.top,O=_(t.bottom)-p,w=v+p,k=this.top+u;else if(r==="left")v=_(this.right),y=this.right-u,M=v-p,P=_(t.left)+p,S=t.right;else if(r==="right")v=_(this.left),P=t.left,S=_(t.right)-p,y=v+p,M=this.left+u;else if(e==="x"){if(r==="center")v=_((t.top+t.bottom)/2+.5);else if(X(r)){const A=Object.keys(r)[0],L=r[A];v=_(this.chart.scales[A].getPixelForValue(L))}C=t.top,O=t.bottom,w=v+p,k=w+u}else if(e==="y"){if(r==="center")v=_((t.left+t.right)/2);else if(X(r)){const A=Object.keys(r)[0],L=r[A];v=_(this.chart.scales[A].getPixelForValue(L))}y=v-p,M=y-u,P=t.left,S=t.right}const T=j(s.ticks.maxTicksLimit,h),E=Math.max(1,Math.ceil(h/T));for(m=0;mo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(s)}}]:[{z:n,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:n+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");H.route(o,s,l,a)})}function q1(i){return"id"in i&&"defaults"in i}class G1{constructor(){this.controllers=new Ds(ee,"datasets",!0),this.elements=new Ds(Ce,"elements"),this.plugins=new Ds(Object,"plugins"),this.scales=new Ds(xi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):G(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=ba(t);at(n["before"+s],[],n),e[t](n),at(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-x[d])>v,_&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,y.active?"active":s)),m||this.updateElement(y,b,M,s),x=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}Ea.id="scatter";Ea.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};Ea.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(i){return"("+i.label+", "+i.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function ti(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rr{constructor(t){this.options=t||{}}init(t){}formats(){return ti()}parse(t,e){return ti()}format(t,e){return ti()}add(t,e,n){return ti()}diff(t,e,n){return ti()}startOf(t,e,n){return ti()}endOf(t,e){return ti()}}Rr.override=function(i){Object.assign(Rr.prototype,i)};var K1={_date:Rr};function J1(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Ry:li;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),f=l(o,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function as(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var ev={evaluateInteractionItems:as,modes:{index(i,t,e,n){const s=ni(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?lr(i,s,o,n,r):cr(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=ni(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?lr(i,s,o,n,r):cr(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function ih(i,t){return i.filter(e=>Yf.indexOf(e.pos)===-1&&e.box.axis===t)}function nn(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function iv(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=nn(en(t,"left"),!0),s=nn(en(t,"right")),o=nn(en(t,"top"),!0),r=nn(en(t,"bottom")),a=ih(t,"x"),l=ih(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:en(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function nh(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Xf(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function rv(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!X(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Xf(r,o.getPadding());const a=Math.max(0,t.outerWidth-nh(r,i,"left","right")),l=Math.max(0,t.outerHeight-nh(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function av(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function lv(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function Sn(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,_)=>_.box.options&&_.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),f=Object.assign({},s);Xf(f,qt(n));const d=Object.assign({maxPadding:f,w:o,h:r,x:s.left,y:s.top},s),g=sv(l.concat(c),u);Sn(a.fullSize,d,u,g),Sn(l,d,u,g),Sn(c,d,u,g)&&Sn(l,d,u,g),av(d),sh(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,sh(a.rightAndBottom,d,u,g),i.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},G(a.chartArea,p=>{const _=p.box;Object.assign(_,i.chartArea),_.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class Uf{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class cv extends Uf{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qs="$chartjs",hv={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},oh=i=>i===null||i==="";function uv(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[qs]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",oh(s)){const o=Bc(i,"width");o!==void 0&&(i.width=o)}if(oh(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Bc(i,"height");o!==void 0&&(i.height=o)}return i}const qf=Wx?{passive:!0}:!1;function fv(i,t,e){i.addEventListener(t,e,qf)}function dv(i,t,e){i.canvas.removeEventListener(t,e,qf)}function gv(i,t){const e=hv[i.type]||i.type,{x:n,y:s}=ni(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function _o(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function pv(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||_o(a.addedNodes,n),r=r&&!_o(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function mv(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||_o(a.removedNodes,n),r=r&&!_o(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Kn=new Map;let rh=0;function Gf(){const i=window.devicePixelRatio;i!==rh&&(rh=i,Kn.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function bv(i,t){Kn.size||window.addEventListener("resize",Gf),Kn.set(i,t)}function _v(i){Kn.delete(i),Kn.size||window.removeEventListener("resize",Gf)}function yv(i,t,e){const n=i.canvas,s=n&&Ca(n);if(!s)return;const o=vf((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),bv(i,o),r}function hr(i,t,e){e&&e.disconnect(),t==="resize"&&_v(i)}function xv(i,t,e){const n=i.canvas,s=vf(o=>{i.ctx!==null&&e(gv(o,i))},i,o=>{const r=o[0];return[r,r.offsetX,r.offsetY]});return fv(n,t,s),s}class vv extends Uf{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(uv(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[qs])return!1;const n=e[qs].initial;["height","width"].forEach(o=>{const r=n[o];K(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[qs],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:pv,detach:mv,resize:yv}[e]||xv;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:hr,detach:hr,resize:hr}[e]||dv)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return Vx(t,e,n,s)}isAttached(t){const e=Ca(t);return!!(e&&e.isConnected)}}function wv(i){return!zf()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?cv:vv}class Mv{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,n,s){s=s||{};for(const o of t){const r=o.plugin,a=r[n],l=[e,s,o.options];if(at(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){K(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=j(n.options&&n.options.plugins,{}),o=kv(n);return s===!1&&!e?[]:Pv(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function kv(i){const t={},e=[],n=Object.keys(ae.plugins.items);for(let o=0;o{const l=n[a];if(!X(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=Ir(a,l),h=Dv(c,s),u=e.scales||{};o[c]=o[c]||a,r[a]=Fn(Object.create(null),[{axis:c},l,u[c],u[h]])}),i.data.datasets.forEach(a=>{const l=a.type||i.type,c=a.indexAxis||Fr(l,t),u=(yi[l]||{}).scales||{};Object.keys(u).forEach(f=>{const d=Av(f,c),g=a[d+"AxisID"]||o[d]||d;r[g]=r[g]||Object.create(null),Fn(r[g],[{axis:d},n[g],u[f]])})}),Object.keys(r).forEach(a=>{const l=r[a];Fn(l,[H.scales[l.type],H.scale])}),r}function Kf(i){const t=i.options||(i.options={});t.plugins=j(t.plugins,{}),t.scales=Lv(i,t)}function Jf(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Tv(i){return i=i||{},i.data=Jf(i.data),Kf(i),i}const ah=new Map,Zf=new Set;function Ts(i,t){let e=ah.get(i);return e||(e=t(),ah.set(i,e),Zf.add(e)),e}const sn=(i,t,e)=>{const n=We(t,e);n!==void 0&&i.add(n)};class Ev{constructor(t){this._config=Tv(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Jf(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Kf(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ts(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ts(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ts(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return Ts(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>sn(l,t,u))),h.forEach(u=>sn(l,s,u)),h.forEach(u=>sn(l,yi[o]||{},u)),h.forEach(u=>sn(l,H,u)),h.forEach(u=>sn(l,Tr,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Zf.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,yi[e]||{},H.datasets[e]||{},{type:e},H,Tr]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=lh(this._resolverCache,t,s);let l=r;if(Fv(r,e)){o.$shared=!1,n=He(n)?n():n;const c=this.createResolver(t,n,a);l=Vi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=lh(this._resolverCache,t,n);return X(e)?Vi(o,e,void 0,s):o}}function lh(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:ka(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const Rv=i=>X(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||He(i[e]),!1);function Fv(i,t){const{isScriptable:e,isIndexable:n}=Tf(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(He(a)||Rv(a))||r&&ot(a))return!0}return!1}var Iv="3.9.1";const Bv=["top","bottom","left","right","chartArea"];function ch(i,t){return i==="top"||i==="bottom"||Bv.indexOf(i)===-1&&t==="x"}function hh(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function uh(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),at(e&&e.onComplete,[i],t)}function zv(i){const t=i.chart,e=t.options.animation;at(e&&e.onProgress,[i],t)}function Qf(i){return zf()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const yo={},td=i=>{const t=Qf(i);return Object.values(yo).filter(e=>e.canvas===t).pop()};function $v(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function Nv(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}class Ra{constructor(t,e){const n=this.config=new Ev(e),s=Qf(t),o=td(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||wv(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=vy(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Mv,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=By(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],yo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}pe.listen(this,"complete",uh),pe.listen(this,"progress",zv),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return K(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ic(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ec(this.canvas,this.ctx),this}stop(){return pe.stop(this),this}resize(t,e){pe.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Ic(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),at(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};G(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ir(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),G(o,r=>{const a=r.options,l=a.id,c=Ir(l,a),h=j(a.type,r.dtype);(a.position===void 0||ch(a.position,c)!==ch(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const f=ae.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),G(s,(r,a)=>{r||delete n[a]}),G(n,r=>{Ls.configure(this,r,r.options),Ls.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(hh("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){G(this.scales,t=>{Ls.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!xc(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;$v(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ls.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],G(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=this.chartArea,r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Df(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Of(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Gn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=ev.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ue(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Ut(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),pe.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};G(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){G(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},G(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!lo(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=Cy(t),c=Nv(t,this._lastEvent,n,l);n&&(this._lastEvent=null,at(o.onHover,[t,a,this],this),l&&at(o.onClick,[t,a,this],this));const h=!lo(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}const fh=()=>G(Ra.instances,i=>i._plugins.invalidate()),Ae=!0;Object.defineProperties(Ra,{defaults:{enumerable:Ae,value:H},instances:{enumerable:Ae,value:yo},overrides:{enumerable:Ae,value:yi},registry:{enumerable:Ae,value:ae},version:{enumerable:Ae,value:Iv},getChart:{enumerable:Ae,value:td},register:{enumerable:Ae,value:(...i)=>{ae.add(...i),fh()}},unregister:{enumerable:Ae,value:(...i)=>{ae.remove(...i),fh()}}});function ed(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+ht,n-ht),i.closePath(),i.clip()}function Vv(i){return Ma(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Wv(i,t,e,n){const s=Vv(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return Pt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Pt(s.innerStart,0,r),innerEnd:Pt(s.innerEnd,0,r)}}function Pi(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function Br(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),f=h>0?h+n+e+c:0;let d=0;const g=s-l;if(n){const A=h>0?h-n:0,L=u>0?u-n:0,R=(A+L)/2,J=R!==0?g*R/(R+n):g;d=(g-J)/2}const p=Math.max(.001,g*u-e/ut)/u,_=(g-p)/2,v=l+_+d,m=s-_-d,{outerStart:x,outerEnd:b,innerStart:y,innerEnd:w}=Wv(t,f,u,m-v),M=u-x,k=u-b,P=v+x/M,C=m-b/k,S=f+y,O=f+w,T=v+y/S,E=m-w/O;if(i.beginPath(),o){if(i.arc(r,a,u,P,C),b>0){const R=Pi(k,C,r,a);i.arc(R.x,R.y,b,C,m+ht)}const A=Pi(O,m,r,a);if(i.lineTo(A.x,A.y),w>0){const R=Pi(O,E,r,a);i.arc(R.x,R.y,w,m+ht,E+Math.PI)}if(i.arc(r,a,f,m-w/f,v+y/f,!0),y>0){const R=Pi(S,T,r,a);i.arc(R.x,R.y,y,T+Math.PI,v-ht)}const L=Pi(M,v,r,a);if(i.lineTo(L.x,L.y),x>0){const R=Pi(M,P,r,a);i.arc(R.x,R.y,x,v-ht,P)}}else{i.moveTo(r,a);const A=Math.cos(P)*u+r,L=Math.sin(P)*u+a;i.lineTo(A,L);const R=Math.cos(C)*u+r,J=Math.sin(C)*u+a;i.lineTo(R,J)}i.closePath()}function Hv(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){Br(i,t,e,n,r+Z,s);for(let c=0;c=Z||qn(o,a,l),p=uo(r,c+f,h+f);return g&&p}getCenterPoint(t){const{x:e,y:n,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+o)/2,u=(r+a+c+l)/2;return{x:e+Math.cos(h)*u,y:n+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:n}=this,s=(e.offset||0)/2,o=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=n>Z?Math.floor(n/Z):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=ut&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=Hv(t,this,a,o,r);Yv(t,this,a,o,l,r),t.restore()}}Fa.id="arc";Fa.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Fa.defaultRoutes={backgroundColor:"backgroundColor"};function id(i,t,e=t){i.lineCap=j(e.borderCapStyle,t.borderCapStyle),i.setLineDash(j(e.borderDash,t.borderDash)),i.lineDashOffset=j(e.borderDashOffset,t.borderDashOffset),i.lineJoin=j(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=j(e.borderWidth,t.borderWidth),i.strokeStyle=j(e.borderColor,t.borderColor)}function Xv(i,t,e){i.lineTo(e.x,e.y)}function Uv(i){return i.stepped?ux:i.tension||i.cubicInterpolationMode==="monotone"?fx:Xv}function nd(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-b:b))%o,x=()=>{p!==_&&(i.lineTo(h,_),i.lineTo(h,p),i.lineTo(h,v))};for(l&&(d=s[m(0)],i.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,y=d.y,w=b|0;w===g?(y_&&(_=y),h=(u*h+b)/++u):(x(),i.lineTo(b,y),g=w,u=0,p=_=y),v=y}x()}function zr(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Gv:qv}function Kv(i){return i.stepped?Hx:i.tension||i.cubicInterpolationMode==="monotone"?jx:si}function Jv(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),id(i,t.options),i.stroke(s)}function Zv(i,t,e,n){const{segments:s,options:o}=t,r=zr(t);for(const a of s)id(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Qv=typeof Path2D=="function";function tw(i,t,e,n){Qv&&!t.options.segment?Jv(i,t,e,n):Zv(i,t,e,n)}class Fo extends Ce{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;Fx(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=e1(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=Zx(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=Kv(n);let c,h;for(c=0,h=r.length;ci!=="borderDash"&&i!=="fill"};function dh(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)-1?i.split(` -`):i}function rw(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function gh(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=zt(t.bodyFont),c=zt(t.titleFont),h=zt(t.footerFont),u=o.length,f=s.length,d=n.length,g=qt(t.padding);let p=g.height,_=0,v=n.reduce((b,y)=>b+y.before.length+y.lines.length+y.after.length,0);if(v+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),v){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(v-d)*l.lineHeight+(v-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const x=function(b){_=Math.max(_,e.measureText(b).width+m)};return e.save(),e.font=c.string,G(i.title,x),e.font=l.string,G(i.beforeBody.concat(i.afterBody),x),m=t.displayColors?r+2+t.boxPadding:0,G(n,b=>{G(b.before,x),G(b.lines,x),G(b.after,x)}),m=0,e.font=h.string,G(i.footer,x),e.restore(),_+=g.width,{width:_,height:p}}function aw(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function lw(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function cw(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),lw(c,i,t,e)&&(c="center"),c}function ph(i,t,e){const n=e.yAlign||t.yAlign||aw(i,e);return{xAlign:e.xAlign||t.xAlign||cw(i,t,e,n),yAlign:n}}function hw(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function uw(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function mh(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=Ri(r);let g=hw(t,a);const p=uw(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:Pt(g,0,n.width-t.width),y:Pt(p,0,n.height-t.height)}}function Es(i,t,e){const n=qt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function bh(i){return se([],me(i))}function fw(i,t,e){return Ue(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function _h(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}class dw extends Ce{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Nf(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=fw(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=n.beforeTitle.apply(this,[t]),o=n.title.apply(this,[t]),r=n.afterTitle.apply(this,[t]);let a=[];return a=se(a,me(s)),a=se(a,me(o)),a=se(a,me(r)),a}getBeforeBody(t,e){return bh(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:n}=e,s=[];return G(t,o=>{const r={before:[],lines:[],after:[]},a=_h(n,o);se(r.before,me(a.beforeLabel.call(this,o))),se(r.lines,a.label.call(this,o)),se(r.after,me(a.afterLabel.call(this,o))),s.push(r)}),s}getAfterBody(t,e){return bh(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:n}=e,s=n.beforeFooter.apply(this,[t]),o=n.footer.apply(this,[t]),r=n.afterFooter.apply(this,[t]);let a=[];return a=se(a,me(s)),a=se(a,me(o)),a=se(a,me(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),G(a,h=>{const u=_h(t.callbacks,h);s.push(u.labelColor.call(this,h)),o.push(u.labelPointStyle.call(this,h)),r.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Gs[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=gh(this,n),c=Object.assign({},a,l),h=ph(this.chart,n,c),u=mh(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=Ri(a),{x:f,y:d}=t,{width:g,height:p}=e;let _,v,m,x,b,y;return o==="center"?(b=d+p/2,s==="left"?(_=f,v=_-r,x=b+r,y=b-r):(_=f+g,v=_+r,x=b-r,y=b+r),m=_):(s==="left"?v=f+Math.max(l,h)+r:s==="right"?v=f+g-Math.max(c,u)-r:v=this.caretX,o==="top"?(x=d,b=x-r,_=v-r,m=v+r):(x=d+p,b=x+r,_=v+r,m=v-r),y=x),{x1:_,x2:v,x3:m,y1:x,y2:b,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=sr(n.rtl,this.x,this.width);for(t.x=Es(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=zt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,mo(t,{x:_,y:p,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),mo(t,{x:v,y:p+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(_,p,c,l),t.strokeRect(_,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=zt(n.bodyFont);let f=u.lineHeight,d=0;const g=sr(n.rtl,this.x,this.width),p=function(k){e.fillText(k,g.x(t.x+d),t.y+f/2),t.y+=f+o},_=g.textAlign(r);let v,m,x,b,y,w,M;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=Es(this,_,n),e.fillStyle=n.bodyColor,G(this.beforeBody,p),d=a&&_!=="right"?r==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=Gs[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=gh(this,t),l=Object.assign({},r,this._size),c=ph(e,t,l),h=mh(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=qt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),qx(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Gx(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!lo(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!lo(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=Gs[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}}dw.positioners=Gs;const gw=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function pw(i,t,e,n){const s=i.indexOf(t);if(s===-1)return gw(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const mw=(i,t)=>i===null?null:Pt(Math.round(i),0,t);class $r extends xi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(K(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:pw(n,t,j(e,t),this._addedLabels),mw(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}$r.id="category";$r.defaults={ticks:{callback:$r.prototype.getLabelForValue}};function bw(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=i,d=o||1,g=h-1,{min:p,max:_}=t,v=!K(r),m=!K(a),x=!K(c),b=(_-p)/(u+1);let y=wc((_-p)/g/d)*d,w,M,k,P;if(y<1e-14&&!v&&!m)return[{value:p},{value:_}];P=Math.ceil(_/y)-Math.floor(p/y),P>g&&(y=wc(P*y/g/d)*d),K(l)||(w=Math.pow(10,l),y=Math.ceil(y*w)/w),s==="ticks"?(M=Math.floor(p/y)*y,k=Math.ceil(_/y)*y):(M=p,k=_),v&&m&&o&&Ly((a-r)/o,y/1e3)?(P=Math.round(Math.min((a-r)/y,h)),y=(a-r)/P,M=r,k=a):x?(M=v?r:M,k=m?a:k,P=c-1,y=(k-M)/P):(P=(k-M)/y,In(P,Math.round(P),y/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(Mc(y),Mc(M));w=Math.pow(10,K(l)?C:l),M=Math.round(M*w)/w,k=Math.round(k*w)/w;let S=0;for(v&&(f&&M!==r?(e.push({value:r}),Ms=e?s:l,a=l=>o=n?o:l;if(t){const l=ce(s),c=ce(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=1;(o>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(o*.05)),a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=bw(s,o);return t.bounds==="ticks"&&mf(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return os(t,this.chart.options.locale,this.options.ticks.format)}}class od extends xo{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=wt(t)?t:0,this.max=wt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=te(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}od.id="linear";od.defaults={ticks:{callback:Ro.formatters.numeric}};function xh(i){return i/Math.pow(10,Math.floor(Ht(i)))===1}function _w(i,t){const e=Math.floor(Ht(t.max)),n=Math.ceil(t.max/Math.pow(10,e)),s=[];let o=Vt(i.min,Math.pow(10,Math.floor(Ht(t.min)))),r=Math.floor(Ht(o)),a=Math.floor(o/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;do s.push({value:o,major:xh(o)}),++a,a===10&&(a=1,++r,l=r>=0?1:l),o=Math.round(a*Math.pow(10,r)*l)/l;while(r0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=wt(t)?Math.max(0,t):null,this.max=wt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=l=>n=t?n:l,r=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(Ht(l))+c);n===s&&(n<=0?(o(1),r(10)):(o(a(n,-1)),r(a(s,1)))),n<=0&&o(a(s,-1)),s<=0&&r(a(n,1)),this._zero&&this.min!==this._suggestedMin&&n===a(this.min,0)&&o(a(n,-1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=_w(e,this);return t.bounds==="ticks"&&mf(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":os(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ht(t),this._valueRange=Ht(this.max)-Ht(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ht(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}rd.id="logarithmic";rd.defaults={ticks:{callback:Ro.formatters.logarithmic,major:{enabled:!0}}};function Nr(i){const t=i.ticks;if(t.display&&i.display){const e=qt(t.backdropPadding);return j(t.font&&t.font.size,H.font.size)+e.height}return 0}function yw(i,t,e){return e=ot(e)?e:[e],{w:cx(i,t.string,e),h:e.length*t.lineHeight}}function vh(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function xw(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?ut/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function ww(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,r=Nr(o)/2,a=i.drawingArea,l=o.pointLabels.centerPointLabels?ut/s:0;for(let c=0;c270||e<90)&&(i-=t),i}function Pw(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=n.setContext(i.getPointLabelContext(s)),r=zt(o.font),{x:a,y:l,textAlign:c,left:h,top:u,right:f,bottom:d}=i._pointLabelItems[s],{backdropColor:g}=o;if(!K(g)){const p=Ri(o.borderRadius),_=qt(o.backdropPadding);e.fillStyle=g;const v=h-_.left,m=u-_.top,x=f-h+_.width,b=d-u+_.height;Object.values(p).some(y=>y!==0)?(e.beginPath(),mo(e,{x:v,y:m,w:x,h:b,radius:p}),e.fill()):e.fillRect(v,m,x,b)}po(e,i._pointLabels[s],a,l+r.lineHeight/2,r,{color:o.color,textAlign:c,textBaseline:"middle"})}}function ad(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,Z);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=at(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?xw(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=Z/(this._pointLabels.length||1),n=this.options.startAngle||0;return Zt(t*e+te(n))}getDistanceFromCenterForValue(t){if(K(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(K(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));Cw(this,u,a,o)}}),n.display){for(t.save(),r=o-1;r>=0;r--){const c=n.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=zt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=qt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}po(t,a.label,0,-o,h,{color:c.color})}),t.restore()}drawTitle(){}}Io.id="radialLinear";Io.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ro.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(i){return i},padding:5,centerPointLabels:!1}};Io.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Io.descriptors={angleLines:{_fallback:"grid"}};const Bo={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ft=Object.keys(Bo);function Dw(i,t){return i-t}function wh(i,t){if(K(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),wt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(Ni(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function Mh(i,t,e,n){const s=Ft.length;for(let o=Ft.indexOf(i);o=Ft.indexOf(e);o--){const r=Ft[o];if(Bo[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return Ft[e?Ft.indexOf(e):0]}function Lw(i){for(let t=Ft.indexOf(i)+1,e=Ft.length;t=t?e[n]:e[s];i[o]=!0}}function Tw(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function Sh(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=Pt(e,0,r),n=Pt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Mh(o.minUnit,e,n,this._getLabelCapacity(e)),a=j(o.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Ni(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;fp-_).map(p=>+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],u=n[e],f=l&&h&&u&&u.major,d=this._adapter.format(t,s||(f?h:c)),g=o.ticks.callback;return g?at(g,[d,e,n],this):d}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=li(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=li(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class ld extends zo{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Rs(e,this.min),this._tableRange=Rs(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r{}};function cd(){for(var i,t=0,e=arguments.length,n={};t=0&&(n=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}function Fw(i,t){for(var e,n=0,s=i.length;n0)for(var e,n,s=new Array(e),o=0;o=0&&(t=i.slice(0,e))!=="xmlns"&&(i=i.slice(e+1)),Ch.hasOwnProperty(t)?{space:Ch[t],local:i}:i}function Iw(i){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===Vr&&t.documentElement.namespaceURI===Vr?t.createElement(i):t.createElementNS(e,i)}}function Bw(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function Ah(i){var t=hd(i);return(t.local?Bw:Iw)(t)}function zw(){}function Dh(i){return i==null?zw:function(){return this.querySelector(i)}}function $w(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function Nw(){return[]}function Oh(i){return function(t){return t.matches(i)}}var Vw=Array.prototype.find;function Ww(){return this.firstElementChild}var Hw=Array.prototype.filter;function jw(){return Array.from(this.children)}function Lh(i){return new Array(i.length)}function vo(i,t){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=t}function Yw(i){return function(){return i}}function Xw(i,t,e,n,s,o){for(var r,a=0,l=t.length,c=o.length;at?1:i>=t?0:NaN}function Jw(i){return function(){this.removeAttribute(i)}}function Zw(i){return function(){this.removeAttributeNS(i.space,i.local)}}function Qw(i,t){return function(){this.setAttribute(i,t)}}function tM(i,t){return function(){this.setAttributeNS(i.space,i.local,t)}}function eM(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(i):this.setAttribute(i,e)}}function iM(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,e)}}function ud(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function nM(i){return function(){this.style.removeProperty(i)}}function sM(i,t,e){return function(){this.style.setProperty(i,t,e)}}function oM(i,t,e){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,e)}}function rM(i,t){return i.style.getPropertyValue(t)||ud(i).getComputedStyle(i,null).getPropertyValue(t)}function aM(i){return function(){delete this[i]}}function lM(i,t){return function(){this[i]=t}}function cM(i,t){return function(){var e=t.apply(this,arguments);e==null?delete this[i]:this[i]=e}}function fd(i){return i.trim().split(/^|\s+/)}function za(i){return i.classList||new dd(i)}function dd(i){this._node=i,this._names=fd(i.getAttribute("class")||"")}function gd(i,t){for(var e=za(i),n=-1,s=t.length;++n=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}function PM(i){return function(){var t=this.__on;if(t){for(var e,n=0,s=-1,o=t.length;n=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};var OM=[null];function Wt(i,t){this._groups=i,this._parents=t}function Pn(i){return typeof i=="string"?new Wt([[document.querySelector(i)]],[document.documentElement]):new Wt([[i]],OM)}function Th(i,t){if(i=function(o){let r;for(;r=o.sourceEvent;)o=r;return o}(i),t===void 0&&(t=i.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var n=e.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[i.clientX-s.left-t.clientLeft,i.clientY-s.top-t.clientTop]}}return[i.pageX,i.pageY]}Wt.prototype={constructor:Wt,select:function(i){typeof i!="function"&&(i=Dh(i));for(var t=this._groups,e=t.length,n=new Array(e),s=0;s=y&&(y=b+1);!(x=_[y])&&++y=0;)(n=s[o])&&(r&&4^n.compareDocumentPosition(r)&&r.parentNode.insertBefore(n,r),r=n);return this},sort:function(i){function t(u,f){return u&&f?i(u.__data__,f.__data__):!u-!f}i||(i=Kw);for(var e=this._groups,n=e.length,s=new Array(n),o=0;o1?this.each((t==null?nM:typeof t=="function"?oM:sM)(i,t,e??"")):rM(this.node(),i)},property:function(i,t){return arguments.length>1?this.each((t==null?aM:typeof t=="function"?cM:lM)(i,t)):this.node()[i]},classed:function(i,t){var e=fd(i+"");if(arguments.length<2){for(var n=za(this.node()),s=-1,o=e.length;++s()=>i;function Wr(i,{sourceEvent:t,subject:e,target:n,identifier:s,active:o,x:r,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:i,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function TM(i){return!i.ctrlKey&&!i.button}function EM(){return this.parentNode}function RM(i,t){return t??{x:i.x,y:i.y}}function FM(){return navigator.maxTouchPoints||"ontouchstart"in this}function IM(){var i,t,e,n,s=TM,o=EM,r=RM,a=FM,l={},c=cd("start","drag","end"),h=0,u=0;function f(b){b.on("mousedown.drag",d).filter(a).on("touchstart.drag",_).on("touchmove.drag",v,LM).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(b,y){if(!n&&s.call(this,b,y)){var w=x(this,o.call(this,b,y),b,y,"mouse");w&&(Pn(b.view).on("mousemove.drag",g,on).on("mouseup.drag",p,on),function(M){var k=M.document.documentElement,P=Pn(M).on("dragstart.drag",Ci,on);"onselectstart"in k?P.on("selectstart.drag",Ci,on):(k.__noselect=k.style.MozUserSelect,k.style.MozUserSelect="none")}(b.view),dr(b),e=!1,i=b.clientX,t=b.clientY,w("start",b))}}function g(b){if(Ci(b),!e){var y=b.clientX-i,w=b.clientY-t;e=y*y+w*w>u}l.mouse("drag",b)}function p(b){Pn(b.view).on("mousemove.drag mouseup.drag",null),function(y,w){var M=y.document.documentElement,k=Pn(y).on("dragstart.drag",null);w&&(k.on("click.drag",Ci,on),setTimeout(function(){k.on("click.drag",null)},0)),"onselectstart"in M?k.on("selectstart.drag",null):(M.style.MozUserSelect=M.__noselect,delete M.__noselect)}(b.view,e),Ci(b),l.mouse("end",b)}function _(b,y){if(s.call(this,b,y)){var w,M,k=b.changedTouches,P=o.call(this,b,y),C=k.length;for(w=0;wt.scales[re].max?t.scales[re].max:o,o=ot.scales[ye].max?t.scales[ye].max:r,r=r{if(Tt){Ai=Tt.datasetIndex,oi=Tt.index,Hr=!0;let s=t.data.datasets[Ai].data[oi];wo==="radar"||wo==="polarArea"?s=function(o,r){let a,l,c;o.touches?(a=o.touches[0].clientX-r.canvas.getBoundingClientRect().left,l=o.touches[0].clientY-r.canvas.getBoundingClientRect().top):(a=o.clientX-r.canvas.getBoundingClientRect().left,l=o.clientY-r.canvas.getBoundingClientRect().top);let h=r.scales[Oe],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),f=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/f:h.min+u/f,c=Mo(c,r.config.options.plugins.dragData.round),c=c>r.scales[Oe].max?r.scales[Oe].max:c,c=c((n,s,o)=>{if(Tt=s.getElementsAtEventForMode(n,"nearest",{intersect:!0},!1)[0],wo=s.config.type,Tt){let r=Tt.datasetIndex,a=Tt.index;Eh=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[r],c=s.getDatasetMeta(r);let h=l.data[a];if(re=c.xAxisID,ye=c.yAxisID,Oe=c.rAxisID,l.dragData===!1||s.config.options.scales[re]&&s.config.options.scales[re].dragData===!1||s.config.options.scales[ye]&&s.config.options.scales[ye].dragData===!1||s.config.options.scales[Oe]&&s.config.options.scales[Oe].rAxisID===!1||l.data[Tt.index].dragData===!1)return void(Tt=null);if(wo==="bar"){bd=s.config.options.scales[re].stacked;const u=s.data.datasets[0].data[0];_d=u!==null&&Array.isArray(u)&&u.length==2,yd=jr(n,s,r,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof o=="function"&&Tt&&o(n,r,a,h)===!1&&(Tt=null)}})(e.sourceEvent,i,t.onDragStart)).on("drag",e=>BM(e.sourceEvent,i,t,t.onDrag)).on("end",e=>((n,s,o)=>{if(oi=void 0,Hr=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=Eh,s.update("none")),typeof o=="function"&&Tt){const r=Tt.datasetIndex,a=Tt.index;let l=function(c,h,u){const f=c.config.options.plugins.dragData;if(!f.magnet)return c.data.datasets[h].data[u];{const d=f.magnet;if(d.to&&typeof d.to=="function"){let g=c.data.datasets[h].data[u];return g=d.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,r,a);return o(n,r,a,l)}})(e.sourceEvent,i,t.onDragEnd)))}},beforeEvent:function(i){if(Hr)return i.tooltip&&i.tooltip.update(),!1}};Ra.register(xd);function zM(i){let t,e,n,s,o;return{c(){t=B("canvas"),e=dt(),n=B("canvas"),Le(t,"width","100%"),Le(t,"height","400px"),Le(n,"width","100%"),Le(n,"height","300px")},m(r,a){$(r,t,a),$(r,e,a),$(r,n,a),s||(o=[Na(i[0].call(null,t)),Na(i[1].call(null,n))],s=!0)},p:mt,i:mt,o:mt,d(r){r&&(N(t),N(e),N(n)),s=!1,je(o)}}}function $M(i,t,e){wn.register(...xy),wn.register(xd);let{lts:n}=t,{nearbyAmenities:s}=t,{greenspace:o}=t;const r=Uh();let a=null,l=["red","blue","green"];c();function c(){let f=n+s+o;e(2,n=100*n/f),e(3,s=100*s/f),e(4,o=100*o/f),a&&(a.data.datasets[0].data=[n,s,o],a.update())}function h(f){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],pointHitRadius:25}]},options:{responsive:!1,onHover(g){const p=g.chart.getElementsAtEventForMode(g,"nearest",{intersect:!0},!1);g.native.target.style.cursor=p.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(g){g.target.style.cursor="grabbing"},onDragEnd(g,p,_,v){g.target.style.cursor="default",_==0?e(2,n=v):_==1?e(3,s=v):_==2&&e(4,o=v),c(),r("change","")}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:l,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new wn(f.getContext("2d"),d)}function u(f){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],backgroundColor:l}]},options:{indexAxis:"y"}};a=new wn(f.getContext("2d"),d)}return i.$$set=f=>{"lts"in f&&e(2,n=f.lts),"nearbyAmenities"in f&&e(3,s=f.nearbyAmenities),"greenspace"in f&&e(4,o=f.greenspace)},[h,u,n,s,o]}class NM extends ke{constructor(t){super(),Se(this,t,$M,zM,he,{lts:2,nearbyAmenities:3,greenspace:4})}}function Rh(i,t,e){const n=i.slice();return n[24]=t[e],n[29]=t,n[30]=e,n}function Fh(i,t,e){const n=i.slice();return n[24]=t[e],n[27]=t,n[28]=e,n}function Ih(i,t,e){const n=i.slice();return n[24]=t[e],n[25]=t,n[26]=e,n}function VM(i){let t,e,n,s,o,r,a,l,c,h,u,f,d,g;function p(y){i[15](y)}function _(y){i[16](y)}function v(y){i[17](y)}let m={};i[3].tradeoff_lts!==void 0&&(m.lts=i[3].tradeoff_lts),i[3].tradeoff_amenities!==void 0&&(m.nearbyAmenities=i[3].tradeoff_amenities),i[3].tradeoff_greenspace!==void 0&&(m.greenspace=i[3].tradeoff_greenspace),t=new NM({props:m}),Cn.push(()=>Hs(t,"lts",p)),Cn.push(()=>Hs(t,"nearbyAmenities",_)),Cn.push(()=>Hs(t,"greenspace",v)),t.$on("change",i[18]);let x=Fi(i[6]),b=[];for(let y=0;ye=!1)),!n&&w&8&&(n=!0,M.nearbyAmenities=y[3].tradeoff_amenities,js(()=>n=!1)),!s&&w&8&&(s=!0,M.greenspace=y[3].tradeoff_greenspace,js(()=>s=!1)),t.$set(M),w&73){x=Fi(y[6]);let k;for(k=0;kconfig.json
    - file`,g=dt(),p=B("pre"),_=Ot('"cost": '),m=Ot(v),x=dt(),b=B("button"),b.textContent="See cost function JSON",y=dt(),M&&M.c(),k=Jn(),o.__value="Distance",bt(o,o.__value),r.__value="Generalized",bt(r,r.__value),a.__value="ByLTS",bt(a,a.__value),l.__value="OsmHighwayType",bt(l,l.__value),i[1]===void 0&&qh(()=>i[7].call(s))},m(A,L){$(A,t,L),I(t,e),I(e,n),I(e,s),I(s,o),I(s,r),I(s,a),I(s,l),Js(s,i[1],!0),$(A,c,L),$(A,h,L),I(h,u),I(h,f),I(h,d),I(h,g),I(h,p),I(p,_),I(p,m),i[9](h),$(A,x,L),$(A,b,L),$(A,y,L),~w&&T[w].m(A,L),$(A,k,L),P=!0,C||(S=[xt(s,"change",i[7]),xt(u,"click",i[8]),xt(b,"click",i[10])],C=!0)},p(A,[L]){L&2&&Js(s,A[1]),(!P||L&1)&&v!==(v=JSON.stringify(A[0],null,2)+"")&&Zn(m,v);let R=w;w=E(A),w===R?~w&&T[w].p(A,L):(M&&(ko(),vt(T[R],1,1,()=>{T[R]=null}),So()),~w?(M=T[w],M?M.p(A,L):(M=T[w]=O[w](A),M.c()),yt(M,1),M.m(k.parentNode,k)):M=null)},i(A){P||(yt(M),P=!0)},o(A){vt(M),P=!1},d(A){A&&(N(t),N(c),N(h),N(x),N(b),N(y),N(k)),i[9](null),~w&&T[w].d(A),C=!1,je(S)}}}function YM(i,t,e){let{cost:n}=t,s,o="Distance",r={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},a=["lts1","lts2","lts3","lts4"],l={lts1:1,lts2:1,lts3:1,lts4:1},c={};for(let S of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])c[S]=1;function h(S){S=="OsmHighwayType"?e(0,n={OsmHighwayType:c}):S=="ByLTS"?e(0,n={ByLTS:l}):S=="Generalized"?e(0,n={Generalized:r}):e(0,n=S)}function u(){o=Gh(this),e(1,o)}const f=()=>s.close();function d(S){Cn[S?"unshift":"push"](()=>{s=S,e(2,s)})}const g=()=>s.showModal();function p(S){c[S]=ai(this.value),e(5,c)}const _=()=>e(0,n);function v(S){l[S]=ai(this.value),e(4,l)}const m=()=>e(0,n);function x(S){i.$$.not_equal(r.tradeoff_lts,S)&&(r.tradeoff_lts=S,e(3,r))}function b(S){i.$$.not_equal(r.tradeoff_amenities,S)&&(r.tradeoff_amenities=S,e(3,r))}function y(S){i.$$.not_equal(r.tradeoff_greenspace,S)&&(r.tradeoff_greenspace=S,e(3,r))}const w=()=>e(0,n);function M(S){r[S]=ai(this.value),e(3,r)}const k=()=>e(0,n);function P(){r.minimum_amenities=ai(this.value),e(3,r)}const C=()=>e(0,n);return i.$$set=S=>{"cost"in S&&e(0,n=S.cost)},i.$$.update=()=>{i.$$.dirty&2&&h(o)},[n,o,s,r,l,c,a,u,f,d,g,p,_,v,m,x,b,y,w,M,k,P,C]}class Ek extends ke{constructor(t){super(),Se(this,t,YM,jM,he,{cost:0})}}export{ZM as C,Nd as G,JM as J,qM as L,KM as O,GM as P,Qg as _,Ek as a}; diff --git a/assets/Layout-663a57a0.js b/assets/Layout-e3c78437.js similarity index 99% rename from assets/Layout-663a57a0.js rename to assets/Layout-e3c78437.js index a111a24..6b8a1cb 100644 --- a/assets/Layout-663a57a0.js +++ b/assets/Layout-e3c78437.js @@ -578,7 +578,7 @@ uniform ${D} ${k} u_${V}; #endif `}),staticAttributes:d,staticUniforms:w}}class Fu{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,u,d,m,y,w,I,C,P){this.context=i;let D=this.boundPaintVertexBuffers.length!==m.length;for(let k=0;!D&&k({u_depth:new c.aG(gt,xt.u_depth),u_terrain:new c.aG(gt,xt.u_terrain),u_terrain_dim:new c.aH(gt,xt.u_terrain_dim),u_terrain_matrix:new c.aI(gt,xt.u_terrain_matrix),u_terrain_unpack:new c.aJ(gt,xt.u_terrain_unpack),u_terrain_exaggeration:new c.aH(gt,xt.u_terrain_exaggeration)}))(i,mt),this.binderUniforms=d?d.getUniforms(i,mt):[]}draw(i,u,d,m,y,w,I,C,P,D,k,V,X,W,J,j,nt,ft){const Q=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(d),i.setStencilMode(m),i.setColorMode(y),i.setCullFace(w),C){i.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),i.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(const mt in this.terrainUniforms)this.terrainUniforms[mt].set(C[mt])}for(const mt in this.fixedUniforms)this.fixedUniforms[mt].set(I[mt]);J&&J.setUniforms(i,this.binderUniforms,X,{zoom:W});let st=0;switch(u){case Q.LINES:st=2;break;case Q.TRIANGLES:st=3;break;case Q.LINE_STRIP:st=1}for(const mt of V.get()){const gt=mt.vaos||(mt.vaos={});(gt[P]||(gt[P]=new Fu)).bind(i,this,D,J?J.getPaintVertexBuffers():[],k,mt.vertexOffset,j,nt,ft),Q.drawElements(u,mt.primitiveLength*st,Q.UNSIGNED_SHORT,mt.primitiveOffset*st*2)}}}function Bu(_,i,u){const d=1/xe(u,1,i.transform.tileZoom),m=Math.pow(2,u.tileID.overscaledZ),y=u.tileSize*Math.pow(2,i.transform.tileZoom)/m,w=y*(u.tileID.canonical.x+u.tileID.wrap*m),I=y*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[w>>16,I>>16],u_pixel_coord_lower:[65535&w,65535&I]}}const Gl=(_,i,u,d)=>{const m=i.style.light,y=m.properties.get("position"),w=[y.x,y.y,y.z],I=function(){var P=new c.A(9);return c.A!=Float32Array&&(P[1]=0,P[2]=0,P[3]=0,P[5]=0,P[6]=0,P[7]=0),P[0]=1,P[4]=1,P[8]=1,P}();m.properties.get("anchor")==="viewport"&&function(P,D){var k=Math.sin(D),V=Math.cos(D);P[0]=V,P[1]=k,P[2]=0,P[3]=-k,P[4]=V,P[5]=0,P[6]=0,P[7]=0,P[8]=1}(I,-i.transform.angle),function(P,D,k){var V=D[0],X=D[1],W=D[2];P[0]=V*k[0]+X*k[3]+W*k[6],P[1]=V*k[1]+X*k[4]+W*k[7],P[2]=V*k[2]+X*k[5]+W*k[8]}(w,w,I);const C=m.properties.get("color");return{u_matrix:_,u_lightpos:w,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:d}},zf=(_,i,u,d,m,y,w)=>c.e(Gl(_,i,u,d),Bu(y,i,w),{u_height_factor:-Math.pow(2,m.overscaledZ)/w.tileSize/8}),$p=_=>({u_matrix:_}),Vu=(_,i,u,d)=>c.e($p(_),Bu(u,i,d)),Of=(_,i)=>({u_matrix:_,u_world:i}),td=(_,i,u,d,m)=>c.e(Vu(_,i,u,d),{u_world:m}),Ff=(_,i,u,d)=>{const m=_.transform;let y,w;if(d.paint.get("circle-pitch-alignment")==="map"){const I=xe(u,1,m.zoom);y=!0,w=[I,I]}else y=!1,w=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(i.posMatrix,u,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:w}},ed=(_,i,u)=>{const d=xe(u,1,i.zoom),m=Math.pow(2,i.zoom-u.tileID.overscaledZ),y=u.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[i.pixelsToGLUnits[0]/(d*m),i.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:y}},nd=(_,i,u=1)=>({u_matrix:_,u_color:i,u_overlay:0,u_overlay_scale:u}),Uu=_=>({u_matrix:_}),id=(_,i,u,d)=>({u_matrix:_,u_extrude_scale:xe(i,1,u),u_intensity:d});function rd(_,i){const u=Math.pow(2,i.canonical.z),d=i.canonical.y;return[new c.Y(0,d/u).toLngLat().lat,new c.Y(0,(d+1)/u).toLngLat().lat]}const qu=(_,i,u,d)=>{const m=_.transform;return{u_matrix:jl(_,i,u,d),u_ratio:1/xe(i,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},od=(_,i,u,d,m)=>c.e(qu(_,i,u,m),{u_image:0,u_image_height:d}),ga=(_,i,u,d,m)=>{const y=_.transform,w=jr(i,y);return{u_matrix:jl(_,i,u,m),u_texsize:i.imageAtlasTexture.size,u_ratio:1/xe(i,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[w,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Gu=(_,i,u,d,m,y)=>{const w=_.lineAtlas,I=jr(i,_.transform),C=u.layout.get("line-cap")==="round",P=w.getDash(d.from,C),D=w.getDash(d.to,C),k=P.width*m.fromScale,V=D.width*m.toScale;return c.e(qu(_,i,u,y),{u_patternscale_a:[I/k,-P.height/2],u_patternscale_b:[I/V,-D.height/2],u_sdfgamma:w.width/(256*Math.min(k,V)*_.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:D.y,u_mix:m.t})};function jr(_,i){return 1/xe(_,1,i.tileZoom)}function jl(_,i,u,d){return _.translatePosMatrix(d?d.posMatrix:i.tileID.posMatrix,i,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const ju=(_,i,u,d,m)=>{return{u_matrix:_,u_tl_parent:i,u_scale_parent:u,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(w=m.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=m.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Zl(m.paint.get("raster-hue-rotate"))};var y,w};function Zl(_){_*=Math.PI/180;const i=Math.sin(_),u=Math.cos(_);return[(2*u+1)/3,(-Math.sqrt(3)*i-u+1)/3,(Math.sqrt(3)*i-u+1)/3]}const Hl=(_,i,u,d,m,y,w,I,C,P)=>{const D=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:D.width/D.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:w,u_coord_matrix:I,u_is_text:+C,u_pitch_with_map:+d,u_texsize:P,u_texture:0}},Wl=(_,i,u,d,m,y,w,I,C,P,D)=>{const k=m.transform;return c.e(Hl(_,i,u,d,m,y,w,I,C,P),{u_gamma_scale:d?Math.cos(k._pitch)*k.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+D})},Xl=(_,i,u,d,m,y,w,I,C,P)=>c.e(Wl(_,i,u,d,m,y,w,I,!0,C,!0),{u_texsize_icon:P,u_texture_icon:1}),Bf=(_,i,u)=>({u_matrix:_,u_opacity:i,u_color:u}),Vf=(_,i,u,d,m,y)=>c.e(function(w,I,C,P){const D=C.imageManager.getPattern(w.from.toString()),k=C.imageManager.getPattern(w.to.toString()),{width:V,height:X}=C.imageManager.getPixelSize(),W=Math.pow(2,P.tileID.overscaledZ),J=P.tileSize*Math.pow(2,C.transform.tileZoom)/W,j=J*(P.tileID.canonical.x+P.tileID.wrap*W),nt=J*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:D.tl,u_pattern_br_a:D.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[V,X],u_mix:I.t,u_pattern_size_a:D.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/xe(P,1,C.transform.tileZoom),u_pixel_coord_upper:[j>>16,nt>>16],u_pixel_coord_lower:[65535&j,65535&nt]}}(d,y,u,m),{u_matrix:_,u_opacity:i}),sd={fillExtrusion:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_opacity:new c.aH(_,i.u_opacity)}),fillExtrusionPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_height_factor:new c.aH(_,i.u_height_factor),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade),u_opacity:new c.aH(_,i.u_opacity)}),fill:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),fillPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),fillOutline:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world)}),fillOutlinePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),circle:(_,i)=>({u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_scale_with_map:new c.aG(_,i.u_scale_with_map),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_matrix:new c.aI(_,i.u_matrix)}),collisionBox:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aH(_,i.u_pixels_to_tile_units),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_overscale_factor:new c.aH(_,i.u_overscale_factor)}),collisionCircle:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_inv_matrix:new c.aI(_,i.u_inv_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_viewport_size:new c.aL(_,i.u_viewport_size)}),debug:(_,i)=>({u_color:new c.aM(_,i.u_color),u_matrix:new c.aI(_,i.u_matrix),u_overlay:new c.aG(_,i.u_overlay),u_overlay_scale:new c.aH(_,i.u_overlay_scale)}),clippingMask:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),heatmap:(_,i)=>({u_extrude_scale:new c.aH(_,i.u_extrude_scale),u_intensity:new c.aH(_,i.u_intensity),u_matrix:new c.aI(_,i.u_matrix)}),heatmapTexture:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_color_ramp:new c.aG(_,i.u_color_ramp),u_opacity:new c.aH(_,i.u_opacity)}),hillshade:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_latrange:new c.aL(_,i.u_latrange),u_light:new c.aL(_,i.u_light),u_shadow:new c.aM(_,i.u_shadow),u_highlight:new c.aM(_,i.u_highlight),u_accent:new c.aM(_,i.u_accent)}),hillshadePrepare:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_dimension:new c.aL(_,i.u_dimension),u_zoom:new c.aH(_,i.u_zoom),u_unpack:new c.aJ(_,i.u_unpack)}),line:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels)}),lineGradient:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_image:new c.aG(_,i.u_image),u_image_height:new c.aH(_,i.u_image_height)}),linePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texsize:new c.aL(_,i.u_texsize),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_image:new c.aG(_,i.u_image),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),lineSDF:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_patternscale_a:new c.aL(_,i.u_patternscale_a),u_patternscale_b:new c.aL(_,i.u_patternscale_b),u_sdfgamma:new c.aH(_,i.u_sdfgamma),u_image:new c.aG(_,i.u_image),u_tex_y_a:new c.aH(_,i.u_tex_y_a),u_tex_y_b:new c.aH(_,i.u_tex_y_b),u_mix:new c.aH(_,i.u_mix)}),raster:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_tl_parent:new c.aL(_,i.u_tl_parent),u_scale_parent:new c.aH(_,i.u_scale_parent),u_buffer_scale:new c.aH(_,i.u_buffer_scale),u_fade_t:new c.aH(_,i.u_fade_t),u_opacity:new c.aH(_,i.u_opacity),u_image0:new c.aG(_,i.u_image0),u_image1:new c.aG(_,i.u_image1),u_brightness_low:new c.aH(_,i.u_brightness_low),u_brightness_high:new c.aH(_,i.u_brightness_high),u_saturation_factor:new c.aH(_,i.u_saturation_factor),u_contrast_factor:new c.aH(_,i.u_contrast_factor),u_spin_weights:new c.aK(_,i.u_spin_weights)}),symbolIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture)}),symbolSDF:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),symbolTextAndIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texsize_icon:new c.aL(_,i.u_texsize_icon),u_texture:new c.aG(_,i.u_texture),u_texture_icon:new c.aG(_,i.u_texture_icon),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),background:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_color:new c.aM(_,i.u_color)}),backgroundPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_image:new c.aG(_,i.u_image),u_pattern_tl_a:new c.aL(_,i.u_pattern_tl_a),u_pattern_br_a:new c.aL(_,i.u_pattern_br_a),u_pattern_tl_b:new c.aL(_,i.u_pattern_tl_b),u_pattern_br_b:new c.aL(_,i.u_pattern_br_b),u_texsize:new c.aL(_,i.u_texsize),u_mix:new c.aH(_,i.u_mix),u_pattern_size_a:new c.aL(_,i.u_pattern_size_a),u_pattern_size_b:new c.aL(_,i.u_pattern_size_b),u_scale_a:new c.aH(_,i.u_scale_a),u_scale_b:new c.aH(_,i.u_scale_b),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aH(_,i.u_tile_units_to_pixels)}),terrain:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainDepth:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainCoords:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_terrain_coords_id:new c.aH(_,i.u_terrain_coords_id),u_ele_delta:new c.aH(_,i.u_ele_delta)})};class Uf{constructor(i,u,d){this.context=i;const m=i.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const _a={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Zu{constructor(i,u,d,m){this.length=u.length,this.attributes=d,this.itemSize=u.bytesPerElement,this.dynamicDraw=m,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,u){for(let d=0;d0){const zt=c.F(),Vt=xt;c.aP(zt,gt.placementInvProjMatrix,_.transform.glCoordMatrix),c.aP(zt,zt,gt.placementViewportMatrix),D.push({circleArray:Lt,circleOffset:V,transform:Vt,invTransform:zt,coord:st}),k+=Lt.length/4,V=k}Pt&&P.draw(I,C.LINES,We.disabled,Mn.disabled,_.colorModeForRenderPass(),Sn.disabled,ed(xt,_.transform,mt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(st),u.id,Pt.layoutVertexBuffer,Pt.indexBuffer,Pt.segments,null,_.transform.zoom,null,null,Pt.collisionVertexBuffer)}if(!w||!D.length)return;const X=_.useProgram("collisionCircle"),W=new c.aQ;W.resize(4*k),W._trim();let J=0;for(const Q of D)for(let st=0;st=0&&(W[j.associatedIconIndex]={shiftedAnchor:Te,angle:qt})}else Et(j.numGlyphs,V)}if(P){X.clear();const J=_.icon.placedSymbolArray;for(let j=0;j_.style.map.terrain.getElevation(Pt,ho,yi):null,jn=u.layout.get("text-rotation-alignment")==="map";F(zt,Pt.posMatrix,_,m,Hr,Qo,j,P,jn,_i)}const Js=_.translatePosMatrix(Pt.posMatrix,Lt,y,w),$o=nt||m&>||lu?Eh:Hr,gi=_.translatePosMatrix(Qo,Lt,y,w,!0),Gn=qt&&u.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zn;zn=qt?zt.iconsInText?Xl(he.kind,_e,ft,j,_,Js,$o,gi,Ne,Si):Wl(he.kind,_e,ft,j,_,Js,$o,gi,m,Ne,!0):Hl(he.kind,_e,ft,j,_,Js,$o,gi,m,Ne);const co={program:Xe,buffers:Vt,uniformValues:zn,atlasTexture:Jn,atlasTextureIcon:qn,atlasInterpolation:_n,atlasInterpolationIcon:Zr,isSDF:qt,hasHalo:Gn};if(Q&&zt.canOverlap){st=!0;const _i=Vt.segments.get();for(const jn of _i)xt.push({segments:new c.$([jn]),sortKey:jn.sortKey,state:co,terrainData:De})}else xt.push({segments:Vt.segments,sortKey:0,state:co,terrainData:De})}st&&xt.sort((Pt,Lt)=>Pt.sortKey-Lt.sortKey);for(const Pt of xt){const Lt=Pt.state;if(V.activeTexture.set(X.TEXTURE0),Lt.atlasTexture.bind(Lt.atlasInterpolation,X.CLAMP_TO_EDGE),Lt.atlasTextureIcon&&(V.activeTexture.set(X.TEXTURE1),Lt.atlasTextureIcon&&Lt.atlasTextureIcon.bind(Lt.atlasInterpolationIcon,X.CLAMP_TO_EDGE)),Lt.isSDF){const zt=Lt.uniformValues;Lt.hasHalo&&(zt.u_is_halo=1,md(Lt.buffers,Pt.segments,u,_,Lt.program,mt,D,k,zt,Pt.terrainData)),zt.u_is_halo=0}md(Lt.buffers,Pt.segments,u,_,Lt.program,mt,D,k,Lt.uniformValues,Pt.terrainData)}}function md(_,i,u,d,m,y,w,I,C,P){const D=d.context;m.draw(D,D.gl.TRIANGLES,y,w,I,Sn.disabled,C,P,u.id,_.layoutVertexBuffer,_.indexBuffer,i,u.paint,d.transform.zoom,_.programConfigurations.get(u.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function nc(_,i,u,d,m){if(!u||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let w=y[u.to.toString()],I=y[u.from.toString()];if(!w&&I&&(w=I),!I&&w&&(I=w),!w||!I){const C=m.getPaintProperty(i);w=y[C],I=y[C]}w&&I&&_.setConstantPatternPositions(w,I)}function gd(_,i,u,d,m,y,w){const I=_.context.gl,C="fill-pattern",P=u.paint.get(C),D=P&&P.constantOr(1),k=u.getCrossfadeParameters();let V,X,W,J,j;w?(X=D&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",V=I.LINES):(X=D?"fillPattern":"fill",V=I.TRIANGLES);const nt=P.constantOr(null);for(const ft of d){const Q=i.getTile(ft);if(D&&!Q.patternsLoaded())continue;const st=Q.getBucket(u);if(!st)continue;const mt=st.programConfigurations.get(u.id),gt=_.useProgram(X,mt),xt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ft);D&&(_.context.activeTexture.set(I.TEXTURE0),Q.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),mt.updatePaintBuffers(k)),nc(mt,C,nt,Q,u);const Pt=xt?ft:null,Lt=_.translatePosMatrix(Pt?Pt.posMatrix:ft.posMatrix,Q,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(w){J=st.indexBuffer2,j=st.segments2;const zt=[I.drawingBufferWidth,I.drawingBufferHeight];W=X==="fillOutlinePattern"&&D?td(Lt,_,k,Q,zt):Of(Lt,zt)}else J=st.indexBuffer,j=st.segments,W=D?Vu(Lt,_,k,Q):$p(Lt);gt.draw(_.context,V,m,_.stencilModeForClipping(ft),y,Sn.disabled,W,xt,u.id,st.layoutVertexBuffer,J,j,u.paint,_.transform.zoom,mt)}}function ic(_,i,u,d,m,y,w){const I=_.context,C=I.gl,P="fill-extrusion-pattern",D=u.paint.get(P),k=D.constantOr(1),V=u.getCrossfadeParameters(),X=u.paint.get("fill-extrusion-opacity"),W=D.constantOr(null);for(const J of d){const j=i.getTile(J),nt=j.getBucket(u);if(!nt)continue;const ft=_.style.map.terrain&&_.style.map.terrain.getTerrainData(J),Q=nt.programConfigurations.get(u.id),st=_.useProgram(k?"fillExtrusionPattern":"fillExtrusion",Q);k&&(_.context.activeTexture.set(C.TEXTURE0),j.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Q.updatePaintBuffers(V)),nc(Q,P,W,j,u);const mt=_.translatePosMatrix(J.posMatrix,j,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),gt=u.paint.get("fill-extrusion-vertical-gradient"),xt=k?zf(mt,_,gt,X,J,V,j):Gl(mt,_,gt,X);st.draw(I,I.gl.TRIANGLES,m,y,w,Sn.backCCW,xt,ft,u.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,u.paint,_.transform.zoom,Q,_.style.map.terrain&&nt.centroidVertexBuffer)}}function rc(_,i,u,d,m,y,w){const I=_.context,C=I.gl,P=u.fbo;if(!P)return;const D=_.useProgram("hillshade"),k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(i);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,P.colorAttachment.get()),D.draw(I,C.TRIANGLES,m,y,w,Sn.disabled,((V,X,W,J)=>{const j=W.paint.get("hillshade-shadow-color"),nt=W.paint.get("hillshade-highlight-color"),ft=W.paint.get("hillshade-accent-color");let Q=W.paint.get("hillshade-illumination-direction")*(Math.PI/180);W.paint.get("hillshade-illumination-anchor")==="viewport"&&(Q-=V.transform.angle);const st=!V.options.moving;return{u_matrix:J?J.posMatrix:V.transform.calculatePosMatrix(X.tileID.toUnwrapped(),st),u_image:0,u_latrange:rd(0,X.tileID),u_light:[W.paint.get("hillshade-exaggeration"),Q],u_shadow:j,u_highlight:nt,u_accent:ft}})(_,u,d,k?i:null),k,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function Sh(_,i,u,d,m,y){const w=_.context,I=w.gl,C=i.dem;if(C&&C.data){const P=C.dim,D=C.stride,k=C.getPixels();if(w.activeTexture.set(I.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||_.getTileTexture(D),i.demTexture){const X=i.demTexture;X.update(k,{premultiply:!1}),X.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else i.demTexture=new Nt(w,k,I.RGBA,{premultiply:!1}),i.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);w.activeTexture.set(I.TEXTURE0);let V=i.fbo;if(!V){const X=new Nt(w,{width:P,height:P,data:null},I.RGBA);X.bind(I.LINEAR,I.CLAMP_TO_EDGE),V=i.fbo=w.createFramebuffer(P,P,!0,!1),V.colorAttachment.set(X.texture)}w.bindFramebuffer.set(V.framebuffer),w.viewport.set([0,0,P,P]),_.useProgram("hillshadePrepare").draw(w,I.TRIANGLES,d,m,y,Sn.disabled,((X,W)=>{const J=W.stride,j=c.F();return c.aN(j,0,c.W,-c.W,0,0,1),c.H(j,j,[0,-c.W,0]),{u_matrix:j,u_image:1,u_dimension:[J,J],u_zoom:X.overscaledZ,u_unpack:W.getUnpackVector()}})(i.tileID,C),null,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function _d(_,i,u,d,m,y){const w=d.paint.get("raster-fade-duration");if(!y&&w>0){const I=N.now(),C=(I-_.timeAdded)/w,P=i?(I-i.timeAdded)/w:-1,D=u.getSource(),k=m.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),V=!i||Math.abs(i.tileID.overscaledZ-k)>Math.abs(_.tileID.overscaledZ-k),X=V&&_.refreshedUponExpiration?1:c.ac(V?C:1-P,0,1);return _.refreshedUponExpiration&&C>=1&&(_.refreshedUponExpiration=!1),i?{opacity:1,mix:1-X}:{opacity:X,mix:0}}return{opacity:1,mix:0}}const yd=new c.aO(1,0,0,1),oc=new c.aO(0,1,0,1),Ch=new c.aO(0,0,1,1),Kf=new c.aO(1,0,1,1),vd=new c.aO(0,1,1,1);function Yn(_,i,u,d){fr(_,0,i+u/2,_.transform.width,u,d)}function Hs(_,i,u,d){fr(_,i-u/2,0,u,_.transform.height,d)}function fr(_,i,u,d,m,y){const w=_.context,I=w.gl;I.enable(I.SCISSOR_TEST),I.scissor(i*_.pixelRatio,u*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),w.clear({color:y}),I.disable(I.SCISSOR_TEST)}function Th(_,i,u){const d=_.context,m=d.gl,y=u.posMatrix,w=_.useProgram("debug"),I=We.disabled,C=Mn.disabled,P=_.colorModeForRenderPass(),D="$debug",k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(u);d.activeTexture.set(m.TEXTURE0);const V=i.getTileByID(u.key).latestRawTileData,X=Math.floor((V&&V.byteLength||0)/1024),W=i.getTile(u).tileSize,J=512/Math.min(W,512)*(u.overscaledZ/_.transform.zoom)*.5;let j=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(j+=` => ${u.overscaledZ}`),function(nt,ft){nt.initDebugOverlayCanvas();const Q=nt.debugOverlayCanvas,st=nt.context.gl,mt=nt.debugOverlayCanvas.getContext("2d");mt.clearRect(0,0,Q.width,Q.height),mt.shadowColor="white",mt.shadowBlur=2,mt.lineWidth=1.5,mt.strokeStyle="white",mt.textBaseline="top",mt.font="bold 36px Open Sans, sans-serif",mt.fillText(ft,5,5),mt.strokeText(ft,5,5),nt.debugOverlayTexture.update(Q),nt.debugOverlayTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE)}(_,`${j} ${X}kB`),w.draw(d,m.TRIANGLES,I,C,ai.alphaBlended,Sn.disabled,nd(y,c.aO.transparent,J),null,D,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),w.draw(d,m.LINE_STRIP,I,C,P,Sn.disabled,nd(y,c.aO.red),k,D,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function sc(_,i,u){const d=_.context,m=d.gl,y=_.colorModeForRenderPass(),w=new We(m.LEQUAL,We.ReadWrite,_.depthRangeFor3D),I=_.useProgram("terrain"),C=i.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const P of u){const D=_.renderToTexture.getTexture(P),k=i.getTerrainData(P.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D.texture);const V={u_matrix:_.transform.calculatePosMatrix(P.tileID.toUnwrapped()),u_texture:0,u_ele_delta:i.getMeshFrameDelta(_.transform.zoom)};I.draw(d,m.TRIANGLES,w,Mn.disabled,y,Sn.backCCW,V,k,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class xd{constructor(i,u){this.context=new Yf(i),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qi.maxUnderzooming+Qi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new js}resize(i,u,d){if(this.width=Math.floor(i*d),this.height=Math.floor(u*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const i=this.context,u=new c.aV;u.emplaceBack(0,0),u.emplaceBack(c.W,0),u.emplaceBack(0,c.W),u.emplaceBack(c.W,c.W),this.tileExtentBuffer=i.createVertexBuffer(u,Ou.members),this.tileExtentSegments=c.$.simpleSegment(0,0,4,2);const d=new c.aV;d.emplaceBack(0,0),d.emplaceBack(c.W,0),d.emplaceBack(0,c.W),d.emplaceBack(c.W,c.W),this.debugBuffer=i.createVertexBuffer(d,Ou.members),this.debugSegments=c.$.simpleSegment(0,0,4,5);const m=new c.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(c.W,0,c.W,0),m.emplaceBack(0,c.W,0,c.W),m.emplaceBack(c.W,c.W,c.W,c.W),this.rasterBoundsBuffer=i.createVertexBuffer(m,Ve.members),this.rasterBoundsSegments=c.$.simpleSegment(0,0,4,2);const y=new c.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(y,Ou.members),this.viewportSegments=c.$.simpleSegment(0,0,4,2);const w=new c.aW;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(w);const I=new c.aX;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(I);const C=this.context.gl;this.stencilClearMode=new Mn({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const i=this.context,u=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=c.F();c.aN(d,0,this.width,this.height,0,0,1),c.J(d,d,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,u.TRIANGLES,We.disabled,this.stencilClearMode,ai.disabled,Sn.disabled,Uu(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,u){if(this.currentStencilSource===i.source||!i.isTileClipped()||!u||!u.length)return;this.currentStencilSource=i.source;const d=this.context,m=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(ai.disabled),d.setDepthMode(We.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of u){const I=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(d,m.TRIANGLES,We.disabled,new Mn({func:m.ALWAYS,mask:0},I,255,m.KEEP,m.KEEP,m.REPLACE),ai.disabled,Sn.disabled,Uu(w.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,u=this.context.gl;return new Mn({func:u.NOTEQUAL,mask:255},i,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(i){const u=this.context.gl;return new Mn({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(i){const u=this.context.gl,d=i.sort((w,I)=>I.overscaledZ-w.overscaledZ),m=d[d.length-1].overscaledZ,y=d[0].overscaledZ-m+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let I=0;I=0;this.currentLayer--){const C=this.style._layers[d[this.currentLayer]],P=m[C.source],D=y[C.source];this._renderTileClippingMasks(C,D),this.renderLayer(this,P,C,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerj.source&&!j.isHidden(D)?[P.sourceCaches[j.source]]:[]),X=V.filter(j=>j.getSource().type==="vector"),W=V.filter(j=>j.getSource().type!=="vector"),J=j=>{(!k||k.getSource().maxzoomJ(j)),k||W.forEach(j=>J(j)),k}(this.style,this.transform.zoom);C&&function(P,D,k){for(let V=0;V0),m&&(c.a_(u,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(y,w){const I=y.context,C=I.gl,P=ai.unblended,D=new We(C.LEQUAL,We.ReadWrite,[0,1]),k=w.getTerrainMesh(),V=w.sourceCache.getRenderableTiles(),X=y.useProgram("terrainDepth");I.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1});for(const W of V){const J=w.getTerrainData(W.tileID),j={u_matrix:y.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};X.draw(I,C.TRIANGLES,D,Mn.disabled,P,Sn.backCCW,j,J,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain),function(y,w){const I=y.context,C=I.gl,P=ai.unblended,D=new We(C.LEQUAL,We.ReadWrite,[0,1]),k=w.getTerrainMesh(),V=w.getCoordsTexture(),X=w.sourceCache.getRenderableTiles(),W=y.useProgram("terrainCoords");I.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1}),w.coordsIndex=[];for(const J of X){const j=w.getTerrainData(J.tileID);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,V.texture);const nt={u_matrix:y.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};W.draw(I,C.TRIANGLES,D,Mn.disabled,P,Sn.backCCW,nt,j,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),w.coordsIndex.push(J.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain))}renderLayer(i,u,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(y,w,I,C,P){if(y.renderPass!=="translucent")return;const D=Mn.disabled,k=y.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,X,W,J,j,nt,ft){const Q=X.transform,st=j==="map",mt=nt==="map";for(const gt of V){const xt=J.getTile(gt),Pt=xt.getBucket(W);if(!Pt||!Pt.text||!Pt.text.segments.get().length)continue;const Lt=c.ag(Pt.textSizeData,Q.zoom),zt=xe(xt,1,X.transform.zoom),Vt=Se(gt.posMatrix,mt,st,X.transform,zt),Te=W.layout.get("icon-text-fit")!=="none"&&Pt.hasIconData();if(Lt){const qt=Math.pow(2,Q.zoom-xt.tileID.overscaledZ);$u(Pt,st,mt,ft,Q,Vt,gt.posMatrix,qt,Lt,Te,X.style.map.terrain?(he,Le)=>X.style.map.terrain.getElevation(gt,he,Le):null)}}}(C,y,I,w,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),P),I.paint.get("icon-opacity").constantOr(1)!==0&&ec(y,w,I,C,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),D,k),I.paint.get("text-opacity").constantOr(1)!==0&&ec(y,w,I,C,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),D,k),w.map.showCollisionBoxes&&(Qu(y,w,I,C,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),!0),Qu(y,w,I,C,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),!1))})(i,u,d,m,this.style.placement.variableOffsets);break;case"circle":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("circle-opacity"),D=I.paint.get("circle-stroke-width"),k=I.paint.get("circle-stroke-opacity"),V=!I.layout.get("circle-sort-key").isConstant();if(P.constantOr(1)===0&&(D.constantOr(1)===0||k.constantOr(1)===0))return;const X=y.context,W=X.gl,J=y.depthModeForSublayer(0,We.ReadOnly),j=Mn.disabled,nt=y.colorModeForRenderPass(),ft=[];for(let Q=0;QQ.sortKey-st.sortKey);for(const Q of ft){const{programConfiguration:st,program:mt,layoutVertexBuffer:gt,indexBuffer:xt,uniformValues:Pt,terrainData:Lt}=Q.state;mt.draw(X,W.TRIANGLES,J,j,nt,Sn.disabled,Pt,Lt,I.id,gt,xt,Q.segments,I.paint,y.transform.zoom,st)}})(i,u,d,m);break;case"heatmap":(function(y,w,I,C){if(I.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const P=y.context,D=P.gl,k=Mn.disabled,V=new ai([D.ONE,D.ONE],c.aO.transparent,[!0,!0,!0,!0]);(function(X,W,J){const j=X.gl;X.activeTexture.set(j.TEXTURE1),X.viewport.set([0,0,W.width/4,W.height/4]);let nt=J.heatmapFbo;if(nt)j.bindTexture(j.TEXTURE_2D,nt.colorAttachment.get()),X.bindFramebuffer.set(nt.framebuffer);else{const ft=j.createTexture();j.bindTexture(j.TEXTURE_2D,ft),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),nt=J.heatmapFbo=X.createFramebuffer(W.width/4,W.height/4,!1,!1),function(Q,st,mt,gt){var xt,Pt;const Lt=Q.gl,zt=(xt=Q.HALF_FLOAT)!==null&&xt!==void 0?xt:Lt.UNSIGNED_BYTE,Vt=(Pt=Q.RGBA16F)!==null&&Pt!==void 0?Pt:Lt.RGBA;Lt.texImage2D(Lt.TEXTURE_2D,0,Vt,st.width/4,st.height/4,0,Lt.RGBA,zt,null),gt.colorAttachment.set(mt)}(X,W,ft,nt)}})(P,y,I),P.clear({color:c.aO.transparent});for(let X=0;X{const Q=c.F();c.aN(Q,0,J.width,J.height,0,0,1);const st=J.context.gl;return{u_matrix:Q,u_world:[st.drawingBufferWidth,st.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(P,D),null,D.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,D.paint,P.transform.zoom)}(y,I))})(i,u,d,m);break;case"line":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("line-opacity"),D=I.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const k=y.depthModeForSublayer(0,We.ReadOnly),V=y.colorModeForRenderPass(),X=I.paint.get("line-dasharray"),W=I.paint.get("line-pattern"),J=W.constantOr(1),j=I.paint.get("line-gradient"),nt=I.getCrossfadeParameters(),ft=J?"linePattern":X?"lineSDF":j?"lineGradient":"line",Q=y.context,st=Q.gl;let mt=!0;for(const gt of C){const xt=w.getTile(gt);if(J&&!xt.patternsLoaded())continue;const Pt=xt.getBucket(I);if(!Pt)continue;const Lt=Pt.programConfigurations.get(I.id),zt=y.context.program.get(),Vt=y.useProgram(ft,Lt),Te=mt||Vt.program!==zt,qt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(gt),he=W.constantOr(null);if(he&&xt.imageAtlas){const _e=xt.imageAtlas,De=_e.patternPositions[he.to.toString()],Ne=_e.patternPositions[he.from.toString()];De&&Ne&&Lt.setConstantPatternPositions(De,Ne)}const Le=qt?gt:null,Xe=J?ga(y,xt,I,nt,Le):X?Gu(y,xt,I,X,nt,Le):j?od(y,xt,I,Pt.lineClipsArray.length,Le):qu(y,xt,I,Le);if(J)Q.activeTexture.set(st.TEXTURE0),xt.imageAtlasTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE),Lt.updatePaintBuffers(nt);else if(X&&(Te||y.lineAtlas.dirty))Q.activeTexture.set(st.TEXTURE0),y.lineAtlas.bind(Q);else if(j){const _e=Pt.gradients[I.id];let De=_e.texture;if(I.gradientVersion!==_e.version){let Ne=256;if(I.stepInterpolant){const Jn=w.getSource().maxzoom,_n=gt.canonical.z===Jn?Math.ceil(1<0?u.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const u=this.imageManager.getPattern(i.from.toString()),d=this.imageManager.getPattern(i.to.toString());return!u||!d}useProgram(i,u){this.cache=this.cache||{};const d=i+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Zs(this.context,ql[i],u,sd[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:u}=this.context.gl;return this.width!==i||this.height!==u}}class Ws{constructor(i,u){this.points=i,this.planes=u}static fromInvProjectionMatrix(i,u,d){const m=Math.pow(2,d),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const C=1/(I=c.af([],I,i))[3]/u*m;return c.a$(I,I,[C,C,1/I[3],C])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const C=function(V,X){var W=X[0],J=X[1],j=X[2],nt=W*W+J*J+j*j;return nt>0&&(nt=1/Math.sqrt(nt)),V[0]=X[0]*nt,V[1]=X[1]*nt,V[2]=X[2]*nt,V}([],function(V,X,W){var J=X[0],j=X[1],nt=X[2],ft=W[0],Q=W[1],st=W[2];return V[0]=j*st-nt*Q,V[1]=nt*ft-J*st,V[2]=J*Q-j*ft,V}([],Ee([],y[I[0]],y[I[1]]),Ee([],y[I[2]],y[I[1]]))),P=-((D=C)[0]*(k=y[I[1]])[0]+D[1]*k[1]+D[2]*k[2]);var D,k;return C.concat(P)});return new Ws(y,w)}}class Xs{constructor(i,u){this.min=i,this.max=u,this.center=function(d,m,y){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,y){return d[0]=m[0]+y[0],d[1]=m[1]+y[1],d[2]=m[2]+y[2],d}([],this.min,this.max))}quadrant(i){const u=[i%2==0,i<2],d=Fe(this.min),m=Fe(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==u.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let I=0;Ithis.max[m]-this.min[m])return 0}return 1}}class tl{constructor(i=0,u=0,d=0,m=0){if(isNaN(i)||i<0||isNaN(u)||u<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=u,this.left=d,this.right=m}interpolate(i,u,d){return u.top!=null&&i.top!=null&&(this.top=c.z.number(i.top,u.top,d)),u.bottom!=null&&i.bottom!=null&&(this.bottom=c.z.number(i.bottom,u.bottom,d)),u.left!=null&&i.left!=null&&(this.left=c.z.number(i.left,u.left,d)),u.right!=null&&i.right!=null&&(this.right=c.z.number(i.right,u.right,d)),this}getCenter(i,u){const d=c.ac((this.left+i-this.right)/2,0,i),m=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(d,m)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new tl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Lh=85.051129;class ac{constructor(i,u,d,m,y){this.tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=i||0,this._maxZoom=u||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tl,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new ac(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const u=-c.b1(i,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,y){var w=m[0],I=m[1],C=m[2],P=m[3],D=Math.sin(y),k=Math.cos(y);d[0]=w*k+C*D,d[1]=I*k+P*D,d[2]=w*-D+C*k,d[3]=I*-D+P*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const u=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const u=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,u,d){this._unmodified=!1,this._edgeInsets.interpolate(i,u,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const u=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(i){const u=[new c.b2(0,i)];if(this._renderWorldCopies){const d=this.pointCoordinate(new c.P(0,0)),m=this.pointCoordinate(new c.P(this.width,0)),y=this.pointCoordinate(new c.P(this.width,this.height)),w=this.pointCoordinate(new c.P(0,this.height)),I=Math.floor(Math.min(d.x,m.x,y.x,w.x)),C=Math.floor(Math.max(d.x,m.x,y.x,w.x)),P=1;for(let D=I-P;D<=C+P;D++)D!==0&&u.push(new c.b2(D,i))}return u}coveringTiles(i){var u,d;let m=this.coveringZoomLevel(i);const y=m;if(i.minzoom!==void 0&&mi.maxzoom&&(m=i.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),I=c.Y.fromLngLat(this.center),C=Math.pow(2,m),P=[C*w.x,C*w.y,0],D=[C*I.x,C*I.y,0],k=Ws.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let V=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(V=m);const X=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,W=Q=>({aabb:new Xs([Q*C,0,0],[(Q+1)*C,C,0]),zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),J=[],j=[],nt=m,ft=i.reparseOverscaled?y:m;if(this._renderWorldCopies)for(let Q=1;Q<=3;Q++)J.push(W(-Q)),J.push(W(Q));for(J.push(W(0));J.length>0;){const Q=J.pop(),st=Q.x,mt=Q.y;let gt=Q.fullyVisible;if(!gt){const Vt=Q.aabb.intersects(k);if(Vt===0)continue;gt=Vt===2}const xt=i.terrain?P:D,Pt=Q.aabb.distanceX(xt),Lt=Q.aabb.distanceY(xt),zt=Math.max(Math.abs(Pt),Math.abs(Lt));if(Q.zoom===nt||zt>X+(1<=V){const Vt=nt-Q.zoom,Te=P[0]-.5-(st<>1),he=Q.zoom+1;let Le=Q.aabb.quadrant(Vt);if(i.terrain){const Xe=new c.Q(he,Q.wrap,he,Te,qt),_e=i.terrain.getMinMaxElevation(Xe),De=(u=_e.minElevation)!==null&&u!==void 0?u:this.elevation,Ne=(d=_e.maxElevation)!==null&&d!==void 0?d:this.elevation;Le=new Xs([Le.min[0],Le.min[1],De],[Le.max[0],Le.max[1],Ne])}J.push({aabb:Le,zoom:he,x:Te,y:qt,wrap:Q.wrap,fullyVisible:gt})}}return j.sort((Q,st)=>Q.distanceSq-st.distanceSq).map(Q=>Q.tileID)}resize(i,u){this.width=i,this.height=u,this.pixelsToGLUnits=[2/i,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const u=c.ac(i.lat,-85.051129,Lh);return new c.P(c.N(i.lng)*this.worldSize,c.O(u)*this.worldSize)}unproject(i){return new c.Y(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){const u=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,i),y=i.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-y))return;const w=d+u-y,I=Math.cos(this._pitch)*this.cameraToCenterDistance/w/c.b3(1,m.lat),C=this.scaleZoom(I/this.tileSize);this._elevation=y,this._center=m,this.zoom=C}setLocationAtPoint(i,u){const d=this.pointCoordinate(u),m=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(i),w=new c.Y(y.x-(d.x-m.x),y.y-(d.y-m.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,u){return u?this.coordinatePoint(this.locationCoordinate(i),u.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,u){return this.coordinateLocation(this.pointCoordinate(i,u))}locationCoordinate(i){return c.Y.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,u){if(u){const V=u.pointCoordinate(i);if(V!=null)return V}const d=[i.x,i.y,0,1],m=[i.x,i.y,1,1];c.af(d,d,this.pixelMatrixInverse),c.af(m,m,this.pixelMatrixInverse);const y=d[3],w=m[3],I=d[1]/y,C=m[1]/w,P=d[2]/y,D=m[2]/w,k=P===D?0:(0-P)/(D-P);return new c.Y(c.z.number(d[0]/y,m[0]/w,k)/this.worldSize,c.z.number(I,C,k)/this.worldSize)}coordinatePoint(i,u=0,d=this.pixelMatrix){const m=[i.x*this.worldSize,i.y*this.worldSize,u,1];return c.af(m,m,d),new c.P(m[0]/m[3],m[1]/m[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new Ct().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ct([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Lh])}calculatePosMatrix(i,u=!1){const d=i.key,m=u?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const y=i.canonical,w=this.worldSize/this.zoomScale(y.z),I=y.x+Math.pow(2,y.z)*i.wrap,C=c.an(new Float64Array(16));return c.H(C,C,[I*w,y.y*w,0]),c.J(C,C,[w/c.W,w/c.W,1]),c.K(C,u?this.alignedProjMatrix:this.projMatrix,C),m[d]=new Float32Array(C),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,u){u=c.ac(+u,this.minZoom,this.maxZoom);const d={center:new c.M(i.lng,i.lat),zoom:u};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const Q=179.9999999999;m=[-Q,Q]}const y=this.tileSize*this.zoomScale(d.zoom);let w=0,I=y,C=0,P=y,D=0,k=0;const{x:V,y:X}=this.size;if(this.latRange){const Q=this.latRange;w=c.O(Q[1])*y,I=c.O(Q[0])*y,I-wI&&(nt=I-Q)}if(m){const Q=(C+P)/2;let st=W;this._renderWorldCopies&&(st=c.b1(W,Q-y/2,Q+y/2));const mt=V/2;st-mtP&&(j=P-mt)}if(j!==void 0||nt!==void 0){const Q=new c.P(j??W,nt??J);d.center=this.unproject.call({worldSize:y},Q).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:u,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=d,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,u=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b3(1,this.center.lat)*this.worldSize;let m=c.an(new Float64Array(16));c.J(m,m,[this.width/2,-this.height/2,1]),c.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=c.an(new Float64Array(16)),c.J(m,m,[1,-1,1]),c.H(m,m,[-1,-1,0]),c.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),I=y-w*this._pixelPerMeter/Math.cos(this._pitch),C=w<0?I:y,P=Math.PI/2+this._pitch,D=this._fov*(.5+i.y/this.height),k=Math.sin(D)*C/Math.sin(c.ac(Math.PI-P-D,.01,Math.PI-.01)),V=this.getHorizon(),X=2*Math.atan(V/this.cameraToCenterDistance)*(.5+i.y/(2*V)),W=Math.sin(X)*C/Math.sin(c.ac(Math.PI-P-X,.01,Math.PI-.01)),J=Math.min(k,W),j=1.01*(Math.cos(Math.PI/2-this._pitch)*J+C),nt=this.height/50;m=new Float64Array(16),c.b4(m,this._fov,this.width/this.height,nt,j),m[8]=2*-i.x/this.width,m[9]=2*i.y/this.height,c.J(m,m,[1,-1,1]),c.H(m,m,[0,0,-this.cameraToCenterDistance]),c.b5(m,m,this._pitch),c.ad(m,m,this.angle),c.H(m,m,[-u,-d,0]),this.mercatorMatrix=c.J([],m,[this.worldSize,this.worldSize,this.worldSize]),c.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.K(new Float64Array(16),this.labelPlaneMatrix,m),c.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=c.ar([],m),this.pixelMatrix3D=c.K(new Float64Array(16),this.labelPlaneMatrix,m);const ft=this.width%2/2,Q=this.height%2/2,st=Math.cos(this.angle),mt=Math.sin(this.angle),gt=u-Math.round(u)+st*ft+mt*Q,xt=d-Math.round(d)+st*Q+mt*ft,Pt=new Float64Array(m);if(c.H(Pt,Pt,[gt>.5?gt-1:gt,xt>.5?xt-1:xt,0]),this.alignedProjMatrix=Pt,m=c.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),u=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const u=this.getCameraPoint();if(i.length===1)return[i[0],u];{let d=u.x,m=u.y,y=u.x,w=u.y;for(const I of i)d=Math.min(d,I.x),m=Math.min(m,I.y),y=Math.max(y,I.x),w=Math.max(w,I.y);return[new c.P(d,m),new c.P(y,m),new c.P(y,w),new c.P(d,w),new c.P(d,m)]}}lngLatToCameraDepth(i,u){const d=this.locationCoordinate(i),m=[d.x*this.worldSize,d.y*this.worldSize,u,1];return c.af(m,m,this.projMatrix),m[2]/m[3]}}function Ph(_,i){let u,d=!1,m=null,y=null;const w=()=>{m=null,d&&(_.apply(y,u),m=setTimeout(w,i),d=!1)};return(...I)=>(d=!0,y=this,u=I,m||w(),m)}class Ah{constructor(i){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let d;return u.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:d,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,u)}catch{}},this._updateHash=Ph(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){const u=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,m),w=Math.round(u.lng*y)/y,I=Math.round(u.lat*y)/y,C=this._map.getBearing(),P=this._map.getPitch();let D="";if(D+=i?`/${w}/${I}/${d}`:`${d}/${I}/${w}`,(C||P)&&(D+="/"+Math.round(10*C)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){const k=this._hashName;let V=!1;const X=window.location.hash.slice(1).split("&").map(W=>{const J=W.split("=")[0];return J===k?(V=!0,`${J}=${D}`):W}).filter(W=>W);return V||X.push(`${k}=${D}`),`#${X.join("&")}`}return`#${D}`}}const Kl={linearity:.3,easing:c.b6(0,0,.3,1)},xa=c.e({deceleration:2500,maxSpeed:1400},Kl),bd=c.e({deceleration:20,maxSpeed:1400},Kl),wd=c.e({deceleration:1e3,maxSpeed:360},Kl),Id=c.e({deceleration:1e3,maxSpeed:90},Kl);class Ed{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:N.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,u=N.now();for(;i.length>0&&u-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)u.zoom+=y.zoomDelta||0,u.bearing+=y.bearingDelta||0,u.pitch+=y.pitchDelta||0,y.panDelta&&u.pan._add(y.panDelta),y.around&&(u.around=y.around),y.pinchAround&&(u.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(u.pan.mag()){const y=Ql(u.pan.mag(),d,c.e({},xa,i||{}));m.offset=u.pan.mult(y.amount/u.pan.mag()),m.center=this._map.transform.center,Jl(m,y)}if(u.zoom){const y=Ql(u.zoom,d,bd);m.zoom=this._map.transform.zoom+y.amount,Jl(m,y)}if(u.bearing){const y=Ql(u.bearing,d,wd);m.bearing=this._map.transform.bearing+c.ac(y.amount,-179,179),Jl(m,y)}if(u.pitch){const y=Ql(u.pitch,d,Id);m.pitch=this._map.transform.pitch+y.amount,Jl(m,y)}if(m.zoom||m.bearing){const y=u.pinchAround===void 0?u.around:u.pinchAround;m.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),c.e(m,{noMoveStart:!0})}}function Jl(_,i){(!_.duration||_.durationu.unproject(C)),I=y.reduce((C,P,D,k)=>C.add(P.div(k.length)),new c.P(0,0));super(i,{points:y,point:I,lngLats:w,lngLat:u.unproject(I),originalEvent:d}),this._defaultPrevented=!1}}class Mh extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,d){super(i,{originalEvent:d}),this._defaultPrevented=!1}}class wo{constructor(i,u){this._map=i,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Mh(i.type,this._map,i))}mousedown(i,u){return this._mousedownPos=u,this._firePreventable(new Pr(i.type,this._map,i))}mouseup(i){this._map.fire(new Pr(i.type,this._map,i))}click(i,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Pr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Pr(i.type,this._map,i))}mouseover(i){this._map.fire(new Pr(i.type,this._map,i))}mouseout(i){this._map.fire(new Pr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Yo(i.type,this._map,i))}touchmove(i){this._map.fire(new Yo(i.type,this._map,i))}touchend(i){this._map.fire(new Yo(i.type,this._map,i))}touchcancel(i){this._map.fire(new Yo(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ko{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Pr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Pr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class el{constructor(i){this._map=i}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class Io{constructor(i,u){this._map=i,this._tr=new el(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,u){this.isEnabled()&&i.shiftKey&&i.button===0&&(U.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(i,u){if(!this._active)return;const d=u;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,u){return this._map.fire(new c.k(i,{originalEvent:u}))}}function ba(_,i){if(_.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${i.length}`);const u={};for(let d=0;d<_.length;d++)u[_[d].identifier]=i[d];return u}class Jf{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,u,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const y=new c.P(0,0);for(const w of m)y._add(w);return y.div(m.length)}(u),this.touches=ba(d,u)))}touchmove(i,u,d){if(this.aborted||!this.centroid)return;const m=ba(d,u);for(const y in this.touches){const w=m[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(i,u,d){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class Dh{constructor(i){this.singleTap=new Jf(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,u,d){this.singleTap.touchstart(i,u,d)}touchmove(i,u,d){this.singleTap.touchmove(i,u,d)}touchend(i,u,d){const m=this.singleTap.touchend(i,u,d);if(m){const y=i.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(m)<30;if(y&&w||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Qf{constructor(i){this._tr=new el(i),this._zoomIn=new Dh({numTouches:1,numTaps:2}),this._zoomOut=new Dh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,u,d){this._zoomIn.touchstart(i,u,d),this._zoomOut.touchstart(i,u,d)}touchmove(i,u,d){this._zoomIn.touchmove(i,u,d),this._zoomOut.touchmove(i,u,d)}touchend(i,u,d){const m=this._zoomIn.touchend(i,u,d),y=this._zoomOut.touchend(i,u,d),w=this._tr;return m?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(m)},{originalEvent:i})}):y?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nl{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const u=this._moveFunction(...i);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(i,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,u){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const m=u.length?u[0]:u;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(i){i.preventDefault()}},il=({enable:_,clickTolerance:i,bearingDegreesPerPixelMoved:u=.8})=>{const d=new Jo({checkCorrectEvent:m=>U.mouseButton(m)===0&&m.ctrlKey||U.mouseButton(m)===2});return new nl({clickTolerance:i,move:(m,y)=>({bearingDelta:(y.x-m.x)*u}),moveStateManager:d,enable:_,assignEvents:lc})},rl=({enable:_,clickTolerance:i,pitchDegreesPerPixelMoved:u=-.5})=>{const d=new Jo({checkCorrectEvent:m=>U.mouseButton(m)===0&&m.ctrlKey||U.mouseButton(m)===2});return new nl({clickTolerance:i,move:(m,y)=>({pitchDelta:(y.y-m.y)*u}),moveStateManager:d,enable:_,assignEvents:lc})};class Sd{constructor(i,u){this._clickTolerance=i.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(i,u,d){return this._calculateTransform(i,u,d)}touchmove(i,u,d){if(this._active&&!(d.length0&&(this._active=!0);const m=ba(d,u),y=new c.P(0,0),w=new c.P(0,0);let I=0;for(const P in m){const D=m[P],k=this._touches[P];k&&(y._add(D),w._add(D.sub(k)),I++,m[P]=D)}if(this._touches=m,IMath.abs(_.x)}class Ld extends Wt{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,u,d){super.touchstart(i,u,d),this._currentTouchCount=d.length}_start(i){this._lastPoints=i,cc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,u,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=i[0].sub(this._lastPoints[0]),y=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,y,d.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(m.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(i,u,d){if(this._valid!==void 0)return this._valid;const m=i.mag()>=2,y=u.mag()>=2;if(!m&&!y)return;if(!m||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const w=i.y>0==u.y>0;return cc(i)&&cc(u)&&w}}const $f={panStep:100,bearingStep:15,pitchStep:10};class Ys{constructor(i){this._tr=new el(i);const u=$f;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let u=0,d=0,m=0,y=0,w=0;switch(i.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:i.shiftKey?d=-1:(i.preventDefault(),y=-1);break;case 39:i.shiftKey?d=1:(i.preventDefault(),y=1);break;case 38:i.shiftKey?m=1:(i.preventDefault(),w=-1);break;case 40:i.shiftKey?m=-1:(i.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:I=>{const C=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:kn,zoom:u?Math.round(C.zoom)+u*(i.shiftKey?2:1):C.zoom,bearing:C.bearing+d*this._bearingStep,pitch:C.pitch+m*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:C.center},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function kn(_){return _*(2-_)}const tu=4.000244140625;class hc{constructor(i,u){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=i,this._tr=new el(i),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!i[this._map.cooperativeGestures._bypassKey])return;let u=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const d=N.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,u!==0&&u%tu==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(m*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),i.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=i,this._delta-=u,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=U.mousePos(this._map.getCanvas(),i),d=this._tr;this._around=u.y>d.transform.height/2-d.transform.getHorizon()?c.M.convert(this._aroundCenter?d.center:d.unproject(u)):c.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const I=this._type==="wheel"&&Math.abs(this._delta)>tu?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*I)));this._delta<0&&C!==0&&(C=1/C);const P=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(P*C))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,d=this._startZoom,m=this._easing;let y,w=!1;if(this._type==="wheel"&&d&&m){const I=Math.min((N.now()-this._lastWheelEventTime)/200,1),C=m(I);y=c.z.number(d,u,C),I<1?this._frameId||(this._frameId=!0):w=!0}else y=u,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let u=c.b7;if(this._prevEase){const d=this._prevEase,m=(N.now()-d.start)/d.duration,y=d.easing(m+.01)-d.easing(m),w=.27/Math.sqrt(y*y+1e-4)*.01,I=Math.sqrt(.0729-w*w);u=c.b6(w,I,.25,1)}return this._prevEase={start:N.now(),duration:i,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Nh{constructor(i,u){this._clickZoom=i,this._tapZoom=u}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Pd{constructor(i){this._tr=new el(i),this.reset()}reset(){this._active=!1}dblclick(i,u){return i.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ad{constructor(){this._tap=new Dh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(i,u,d){if(!this._swipePoint)if(this._tapTime){const m=u[0],y=i.timeStamp-this._tapTime<500,w=this._tapPoint.dist(m)<30;y&&w?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(i,u,d)}touchmove(i,u,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=u[0],y=m.y-this._swipePoint.y;return this._swipePoint=m,i.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(i,u,d)}touchend(i,u,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(i,u,d);m&&(this._tapTime=i.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Md{constructor(i,u,d){this._el=i,this._mousePan=u,this._touchPan=d}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Eo{constructor(i,u,d){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=u,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class eu{constructor(i,u,d,m){this._el=i,this._touchZoom=u,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ne{constructor(i,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",i);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=u,this._container.appendChild(m);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(U.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(i){this._onCooperativeGesture(i.touches.length===1)}wheel(i){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!i[this._bypassKey])}_onCooperativeGesture(i){this._enabled&&i&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ue=_=>_.zoom||_.drag||_.pitch||_.rotate;class pc extends c.k{}function nu(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class kh{constructor(i,u){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,y)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=m.type==="renderFrame"?void 0:m,I={needsRenderFrame:!1},C={},P={},D=m.touches,k=D?this._getMapTouches(D):void 0,V=k?U.touchPos(this._map.getCanvas(),k):U.mousePos(this._map.getCanvas(),m);for(const{handlerName:J,handler:j,allowed:nt}of this._handlers){if(!j.isEnabled())continue;let ft;this._blockedByActive(P,nt,J)?j.reset():j[y||m.type]&&(ft=j[y||m.type](m,V,k),this.mergeHandlerResult(I,C,ft,J,w),ft&&ft.needsRenderFrame&&this._triggerRenderFrame()),(ft||j.isActive())&&(P[J]=j)}const X={};for(const J in this._previousActiveHandlers)P[J]||(X[J]=w);this._previousActiveHandlers=P,(Object.keys(X).length||nu(I))&&(this._changes.push([I,C,X]),this._triggerRenderFrame()),(Object.keys(P).length||nu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:W}=I;W&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],W(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ed(i),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,y,w]of this._listeners)U.addEventListener(m,y,m===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[i,u,d]of this._listeners)U.removeEventListener(i,u,i===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(i){const u=this._map,d=u.getCanvasContainer();this._add("mapEvent",new wo(u,i));const m=u.boxZoom=new Io(u,i);this._add("boxZoom",m),i.interactive&&i.boxZoom&&m.enable();const y=u.cooperativeGestures=new ne(u,i.cooperativeGestures);this._add("cooperativeGestures",y),i.cooperativeGestures&&y.enable();const w=new Qf(u),I=new Pd(u);u.doubleClickZoom=new Nh(I,w),this._add("tapZoom",w),this._add("clickZoom",I),i.interactive&&i.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Ad;this._add("tapDragZoom",C);const P=u.touchPitch=new Ld(u);this._add("touchPitch",P),i.interactive&&i.touchPitch&&u.touchPitch.enable(i.touchPitch);const D=il(i),k=rl(i);u.dragRotate=new Eo(i,D,k),this._add("mouseRotate",D,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]),i.interactive&&i.dragRotate&&u.dragRotate.enable();const V=(({enable:ft,clickTolerance:Q})=>{const st=new Jo({checkCorrectEvent:mt=>U.mouseButton(mt)===0&&!mt.ctrlKey});return new nl({clickTolerance:Q,move:(mt,gt)=>({around:gt,panDelta:gt.sub(mt)}),activateOnStart:!0,moveStateManager:st,enable:ft,assignEvents:lc})})(i),X=new Sd(i,u);u.dragPan=new Md(d,V,X),this._add("mousePan",V),this._add("touchPan",X,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&u.dragPan.enable(i.dragPan);const W=new Rh,J=new Td;u.touchZoomRotate=new eu(d,J,W,C),this._add("touchRotate",W,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&u.touchZoomRotate.enable(i.touchZoomRotate);const j=u.scrollZoom=new hc(u,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),i.interactive&&i.scrollZoom&&u.scrollZoom.enable(i.scrollZoom);const nt=u.keyboard=new Ys(u);this._add("keyboard",nt),i.interactive&&i.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new Ko(u))}_add(i,u,d){this._handlers.push({handlerName:i,handler:u,allowed:d}),this._handlersById[i]=u}stop(i){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ue(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,u,d){for(const m in i)if(m!==d&&(!u||u.indexOf(m)<0))return!0;return!1}_getMapTouches(i){const u=[];for(const d of i)this._el.contains(d.target)&&u.push(d);return u}mergeHandlerResult(i,u,d,m,y){if(!d)return;c.e(i,d);const w={handlerName:m,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(u.zoom=w),d.panDelta!==void 0&&(u.drag=w),d.pitchDelta!==void 0&&(u.pitch=w),d.bearingDelta!==void 0&&(u.rotate=w)}_applyChanges(){const i={},u={},d={};for(const[m,y,w]of this._changes)m.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(m.panDelta)),m.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(i.around=m.around),m.pinchAround!==void 0&&(i.pinchAround=m.pinchAround),m.noInertia&&(i.noInertia=m.noInertia),c.e(u,y),c.e(d,w);this._updateMapTransform(i,u,d),this._changes=[]}_updateMapTransform(i,u,d){const m=this._map,y=m._getTransformForUpdate(),w=m.terrain;if(!(nu(i)||w&&this._terrainMovement))return this._fireEvents(u,d,!0);let{panDelta:I,zoomDelta:C,bearingDelta:P,pitchDelta:D,around:k,pinchAround:V}=i;V!==void 0&&(k=V),m._stop(!0),k=k||m.transform.centerPoint;const X=y.pointLocation(I?k.sub(I):k);P&&(y.bearing+=P),D&&(y.pitch+=D),C&&(y.zoom+=C),w?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(I)):y.setLocationAtPoint(X,k):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(X,k),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(m.terrain)})):y.setLocationAtPoint(X,k),m._applyUpdatedTransform(y),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(u,d,!0)}_fireEvents(i,u,d){const m=ue(this._eventsInProgress),y=ue(i),w={};for(const D in i){const{originalEvent:k}=i[D];this._eventsInProgress[D]||(w[`${D}start`]=k),this._eventsInProgress[D]=i[D]}!m&&y&&this._fireEvent("movestart",y.originalEvent);for(const D in w)this._fireEvent(D,w[D]);y&&this._fireEvent("move",y.originalEvent);for(const D in i){const{originalEvent:k}=i[D];this._fireEvent(D,k)}const I={};let C;for(const D in this._eventsInProgress){const{handlerName:k,originalEvent:V}=this._eventsInProgress[D];this._handlersById[k].isActive()||(delete this._eventsInProgress[D],C=u[k]||V,I[`${D}end`]=C)}for(const D in I)this._fireEvent(D,I[D]);const P=ue(this._eventsInProgress);if(d&&(m||y)&&!P){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=V=>V!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new pc("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ar extends c.E{constructor(i,u){super(),this._renderFrameCallback=()=>{const d=Math.min((N.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.M(this.transform.center.lng,this.transform.center.lat)}setCenter(i,u){return this.jumpTo({center:i},u)}panBy(i,u,d){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},u),d)}panTo(i,u,d){return this.easeTo(c.e({center:i},u),d)}getZoom(){return this.transform.zoom}setZoom(i,u){return this.jumpTo({zoom:i},u),this}zoomTo(i,u,d){return this.easeTo(c.e({zoom:i},u),d)}zoomIn(i,u){return this.zoomTo(this.getZoom()+1,i,u),this}zoomOut(i,u){return this.zoomTo(this.getZoom()-1,i,u),this}getBearing(){return this.transform.bearing}setBearing(i,u){return this.jumpTo({bearing:i},u),this}getPadding(){return this.transform.padding}setPadding(i,u){return this.jumpTo({padding:i},u),this}rotateTo(i,u,d){return this.easeTo(c.e({bearing:i},u),d)}resetNorth(i,u){return this.rotateTo(0,c.e({duration:1e3},i),u),this}resetNorthPitch(i,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),u),this}snapToNorth(i,u){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=c.z.number(y,j,xt)),this._rotating&&(m.bearing=c.z.number(w,P,xt)),this._pitching&&(m.pitch=c.z.number(I,D,xt)),this._padding&&(m.interpolatePadding(C,k,xt),X=m.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(xt),st)m.setLocationAtPoint(st,mt);else{const Pt=m.zoomScale(m.zoom-y),Lt=j>y?Math.min(2,Q):Math.max(.5,Q),zt=Math.pow(Lt,1-xt),Vt=m.unproject(nt.add(ft.mult(xt*zt)).mult(Pt));m.setLocationAtPoint(m.renderWorldCopies?Vt.wrap():Vt,X)}this._applyUpdatedTransform(m),this._fireMoveEvents(u)},xt=>{this.terrain&&this._finalizeElevation(),this._afterEase(u,xt)},i),this}_prepareEase(i,u,d={}){this._moving=!0,u||d.moving||this.fire(new c.k("movestart",i)),this._zooming&&!d.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!d.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!d.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&u!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(d-(u-(d*i+this._elevationStart))/(1-i)),this._elevationTarget=u}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;const u=i.clone(),{center:d,zoom:m,pitch:y,bearing:w,elevation:I}=this.transformCameraUpdate(u);d&&(u.center=d),m!==void 0&&(u.zoom=m),y!==void 0&&(u.pitch=y),w!==void 0&&(u.bearing=w),I!==void 0&&(u.elevation=I),this.transform.apply(u)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const d=this._zooming,m=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new c.k("zoomend",i)),m&&this.fire(new c.k("rotateend",i)),y&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,u){var d;if(!i.essential&&N.prefersReducedMotion){const Xe=c.L(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Xe,u)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b7},i);const m=this._getTransformForUpdate(),y=this.getZoom(),w=this.getBearing(),I=this.getPitch(),C=this.getPadding(),P="bearing"in i?this._normalizeBearing(i.bearing,w):w,D="pitch"in i?+i.pitch:I,k="padding"in i?i.padding:m.padding,V=c.P.convert(i.offset);let X=m.centerPoint.add(V);const W=m.pointLocation(X),{center:J,zoom:j}=m.getConstrained(c.M.convert(i.center||W),(d=i.zoom)!==null&&d!==void 0?d:y);this._normalizeCenter(J);const nt=m.zoomScale(j-y),ft=m.project(W),Q=m.project(J).sub(ft);let st=i.curve;const mt=Math.max(m.width,m.height),gt=mt/nt,xt=Q.mag();if("minZoom"in i){const Xe=c.ac(Math.min(i.minZoom,y,j),m.minZoom,m.maxZoom),_e=mt/m.zoomScale(Xe-y);st=Math.sqrt(_e/xt*2)}const Pt=st*st;function Lt(Xe){const _e=(gt*gt-mt*mt+(Xe?-1:1)*Pt*Pt*xt*xt)/(2*(Xe?gt:mt)*Pt*xt);return Math.log(Math.sqrt(_e*_e+1)-_e)}function zt(Xe){return(Math.exp(Xe)-Math.exp(-Xe))/2}function Vt(Xe){return(Math.exp(Xe)+Math.exp(-Xe))/2}const Te=Lt(!1);let qt=function(Xe){return Vt(Te)/Vt(Te+st*Xe)},he=function(Xe){return mt*((Vt(Te)*(zt(_e=Te+st*Xe)/Vt(_e))-zt(Te))/Pt)/xt;var _e},Le=(Lt(!0)-Te)/st;if(Math.abs(xt)<1e-6||!isFinite(Le)){if(Math.abs(mt-gt)<1e-6)return this.easeTo(i,u);const Xe=gti.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=w!==P,this._pitching=D!==I,this._padding=!m.isPaddingEqual(k),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(J),this._ease(Xe=>{const _e=Xe*Le,De=1/qt(_e);m.zoom=Xe===1?j:y+m.scaleZoom(De),this._rotating&&(m.bearing=c.z.number(w,P,Xe)),this._pitching&&(m.pitch=c.z.number(I,D,Xe)),this._padding&&(m.interpolatePadding(C,k,Xe),X=m.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(Xe);const Ne=Xe===1?J:m.unproject(ft.add(Q.mult(he(_e))).mult(De));m.setLocationAtPoint(m.renderWorldCopies?Ne.wrap():Ne,X),this._applyUpdatedTransform(m),this._fireMoveEvents(u)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(u)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,u)}if(!i){const d=this.handlers;d&&d.stop(!1)}return this}_ease(i,u,d){d.animate===!1||d.duration===0?(i(1),u()):(this._easeStart=N.now(),this._easeOptions=d,this._onEaseFrame=i,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,u){i=c.b1(i,-180,180);const d=Math.abs(i-u);return Math.abs(i-360-u)180?-360:d<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.M.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const zh={compact:!0,customAttribution:'MapLibre'};class So{constructor(i=zh){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){U.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(i,u){const d=this._map._getUIString(`AttributionControl.${u}`);i.title=d,i.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const u=this._map.style.sourceCaches;for(const m in u){const y=u[m];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&i.indexOf(w.attribution)<0&&i.push(w.attribution)}}i=i.filter(m=>String(m).trim()),i.sort((m,y)=>m.length-y.length),i=i.filter((m,y)=>{for(let w=y+1;w=0)return!1;return!0});const d=i.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,i.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Dd{constructor(i={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const d=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const u=U.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class iu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const u=++this._id;return this._queue.push({callback:i,id:u,cancelled:!1}),u}remove(i){const u=this._currentlyRunning,d=u?this._queue.concat(u):this._queue;for(const m of d)if(m.id===i)return void(m.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const d of u)if(!d.cancelled&&(d.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Kn=c.X([{name:"a_pos3d",type:"Int16",components:3}]);class li extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,u){this.sourceCache.update(i,u),this._renderableTilesKeys=[];const d={};for(const m of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),c.aN(m.posMatrix,0,c.W,0,c.W,0,1),this._tiles[m.key]=new Zo(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(i){for(const u in this._tiles){const d=this._tiles[u];(!i||d.tileID.equals(i)||d.tileID.isChildOf(i)||i.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const u={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16),c.aN(y.posMatrix,0,c.W,0,c.W,0,1),u[d]=y}else if(m.canonical.isChildOf(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=m.canonical.z-i.canonical.z,I=m.canonical.x-(m.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,P,0,P,0,1),c.H(y.posMatrix,y.posMatrix,[-I*P,-C*P,0]),u[d]=y}else if(i.canonical.isChildOf(m.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=i.canonical.z-m.canonical.z,I=i.canonical.x-(i.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,c.W,0,c.W,0,1),c.H(y.posMatrix,y.posMatrix,[I*P,C*P,0]),c.J(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),u[d]=y}}return u}getSourceTile(i,u){const d=this.sourceCache._source;let m=i.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(i.scaledTo(m--).key);return y}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=i)}}class Rd{constructor(i,u,d){this.painter=i,this.sourceCache=new li(u),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,u,d,m=c.W){var y;if(!(u>=0&&u=0&&di.canonical.z&&(i.canonical.z>=m?y=i.canonical.z-m:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=i.canonical.x-(i.canonical.x>>y<>y<>8<<4|y>>8,u[w+3]=0;const d=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),m=new Nt(i,d,i.gl.RGBA,{premultiply:!1});return m.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),d=this.painter.context,m=d.gl,y=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(y,I-w-1,1,1,m.RGBA,m.UNSIGNED_BYTE,u),d.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),P=u[1]+((15&u[2])<<8),D=this.coordsIndex[255-u[3]],k=D&&this.sourceCache.getTileByID(D);if(!k)return null;const V=this._coordsTextureSize,X=(1<i.id!==u),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length!i.inUse)===!1}}const xs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Oh{constructor(i,u){this.painter=i,this.terrain=u,this.pool=new ru(i.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(d=>!i._layers[d].isHidden(u)),this._coordsDescendingInv={};for(const d in i.sourceCaches){this._coordsDescendingInv[d]={};const m=i.sourceCaches[d].getVisibleCoordinates();for(const y of m){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const I in w)this._coordsDescendingInv[d][I]||(this._coordsDescendingInv[d][I]=[]),this._coordsDescendingInv[d][I].push(w[I])}}this._coordsDescendingInvStr={};for(const d of i._order){const m=i._layers[d],y=m.source;if(xs[m.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(I=>I.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[m][d.tileID.key];y&&y!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const u=i.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(xs[u]&&(this._prevType&&xs[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(i.id),!m))return!0;if(xs[this._prevType]||xs[u]&&m){this._prevType=u;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(sc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[y]){const P=this.pool.getObjectForId(I.rtt[y].id);if(P.stamp===I.rtt[y].stamp){this.pool.useObject(P);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),I.rtt[y]={id:C.id,stamp:C.stamp},d.context.bindFramebuffer.set(C.fbo.framebuffer),d.context.clear({color:c.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let P=0;P{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Vh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Uh{constructor(i,u,d=!1){this.mousedown=w=>{this.startMouse(c.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=i.dragRotate._mouseRotate.getClickTolerance(),y=i.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=il({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:I,bearingDegreesPerPixelMoved:C=.8})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,k)=>({bearingDelta:(k.x-D.x)*C}),moveStateManager:P,enable:w,assignEvents:dc})})({clickTolerance:m,enable:!0}),this.map=i,d&&(this.mousePitch=rl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:I,pitchDegreesPerPixelMoved:C=-.5})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,k)=>({pitchDelta:(k.y-D.y)*C}),moveStateManager:P,enable:w,assignEvents:dc})})({clickTolerance:y,enable:!0})),U.addEventListener(u,"mousedown",this.mousedown),U.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(u,"touchcancel",this.reset)}startMouse(i,u){this.mouseRotate.dragStart(i,u),this.mousePitch&&this.mousePitch.dragStart(i,u),U.disableDrag()}startTouch(i,u){this.touchRotate.dragStart(i,u),this.touchPitch&&this.touchPitch.dragStart(i,u),U.disableDrag()}moveMouse(i,u){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(i,u)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(i,u){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(i,u)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const i=this.element;U.removeEventListener(i,"mousedown",this.mousedown),U.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let bs;function fc(_,i,u){const d=new c.M(_.lng,_.lat);if(_=new c.M(_.lng,_.lat),i){const m=new c.M(_.lng-360,_.lat),y=new c.M(_.lng+360,_.lat),w=u.locationPoint(_).distSqr(i);u.locationPoint(m).distSqr(i)180;){const m=u.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=u.width&&m.y<=u.height)break;_.lng>u.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&u.locationPoint(_).y>u.height/2-u.getHorizon()?_:d}const su={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function mc(_,i,u){const d=_.classList;for(const m in su)d.remove(`maplibregl-${u}-anchor-${m}`);d.add(`maplibregl-${u}-anchor-${i}`)}class au extends c.E{constructor(i){if(super(),this._onKeyPress=u=>{const d=u.code,m=u.charCode||u.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=u=>{const d=u.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=u=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?fc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),u&&u.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${su[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${y}`),N.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=u.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div"),this._element.setAttribute("aria-label","Map marker");const u=U.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${d}px`),u.setAttributeNS(null,"width",`${m}px`),u.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const y=U.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const I=U.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const C=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const nt of C){const ft=U.createNS("http://www.w3.org/2000/svg","ellipse");ft.setAttributeNS(null,"opacity","0.04"),ft.setAttributeNS(null,"cx","10.5"),ft.setAttributeNS(null,"cy","5.80029008"),ft.setAttributeNS(null,"rx",nt.rx),ft.setAttributeNS(null,"ry",nt.ry),I.appendChild(ft)}const P=U.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const D=U.createNS("http://www.w3.org/2000/svg","path");D.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),P.appendChild(D);const k=U.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const V=U.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),k.appendChild(V);const X=U.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(6.0, 7.0)"),X.setAttributeNS(null,"fill","#FFFFFF");const W=U.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const j=U.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),W.appendChild(J),W.appendChild(j),w.appendChild(I),w.appendChild(P),w.appendChild(k),w.appendChild(X),w.appendChild(W),u.appendChild(w),u.setAttributeNS(null,"height",d*this._scale+"px"),u.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),mc(this._element,this._anchor,"marker"),i&&i.className)for(const u of i.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.M.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const m=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var u,d;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,y=m.terrain.depthAtPoint(this._pos),w=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,w)-y<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/m.transform._pixelPerMeter,C=Math.sin(m.getPitch()*Math.PI/180)*I,P=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),D=m.transform.lngLatToCameraDepth(this._lngLat,w+C)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,u){return i===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const gc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let sl=0,wa=!1;const _c={maxWidth:100,unit:"metric"};function yc(_,i,u){const d=u&&u.maxWidth||100,m=_._container.clientHeight/2,y=_.unproject([0,m]),w=_.unproject([d,m]),I=y.distanceTo(w);if(u&&u.unit==="imperial"){const C=3.2808*I;C>5280?Ia(i,d,C/5280,_._getUIString("ScaleControl.Miles")):Ia(i,d,C,_._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?Ia(i,d,I/1852,_._getUIString("ScaleControl.NauticalMiles")):I>=1e3?Ia(i,d,I/1e3,_._getUIString("ScaleControl.Kilometers")):Ia(i,d,I,_._getUIString("ScaleControl.Meters"))}function Ia(_,i,u,d){const m=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let I=y/w;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(C){const P=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*P)/P}(I),w*I}(u);_.style.width=i*(m/u)+"px",_.innerHTML=`${m} ${d}`}const qh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Gh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function vc(_){if(_){if(typeof _=="number"){const i=Math.round(Math.abs(_)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,_),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-_),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(_,0),right:new c.P(-_,0)}}if(_ instanceof c.P||Array.isArray(_)){const i=c.P.convert(_);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:c.P.convert(_.center||[0,0]),top:c.P.convert(_.top||[0,0]),"top-left":c.P.convert(_["top-left"]||[0,0]),"top-right":c.P.convert(_["top-right"]||[0,0]),bottom:c.P.convert(_.bottom||[0,0]),"bottom-left":c.P.convert(_["bottom-left"]||[0,0]),"bottom-right":c.P.convert(_["bottom-right"]||[0,0]),left:c.P.convert(_.left||[0,0]),right:c.P.convert(_.right||[0,0])}}return vc(new c.P(0,0))}const Nd=S;f.AJAXError=c.be,f.Evented=c.E,f.LngLat=c.M,f.MercatorCoordinate=c.Y,f.Point=c.P,f.addProtocol=c.bf,f.config=c.a,f.removeProtocol=c.bg,f.AttributionControl=So,f.BoxZoomHandler=Io,f.CanvasSource=Za,f.CooperativeGesturesHandler=ne,f.DoubleClickZoomHandler=Nh,f.DragPanHandler=Md,f.DragRotateHandler=Eo,f.EdgeInsets=tl,f.FullscreenControl=class extends c.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var i;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=u==null?void 0:u.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},f.GeoJSONSource=qs,f.GeolocateControl=class extends c.E{constructor(_){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const u=new c.M(i.coords.longitude,i.coords.latitude),d=i.coords.accuracy,m=this._map.getBearing(),y=c.e({bearing:m},this.options.fitBoundsOptions),w=Ct.fromLngLat(u,d);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const u=new c.M(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&wa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",u=>u.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new au({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},gc,_)}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return c._(this,arguments,void 0,function*(i=!1){if(bs!==void 0&&!i)return bs;if(window.navigator.permissions===void 0)return bs=!!window.navigator.geolocation,bs;try{bs=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{bs=!!window.navigator.geolocation}return bs})}().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,sl=0,wa=!1}_isOutOfMapMaxBounds(_){const i=this._map.getMaxBounds(),u=_.coords;return i&&(u.longitudei.getEast()||u.latitudei.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),i=_.getSouthEast(),u=_.getNorthEast(),d=i.distanceTo(u),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":sl--,wa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),sl++,sl>1?(_={maximumAge:6e5,timeout:0},wa=!0):(_=this.options.positionOptions,wa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},f.Hash=Ah,f.ImageSource=wi,f.KeyboardHandler=Ys,f.LngLatBounds=Ct,f.LogoControl=Dd,f.Map=class extends Ar{constructor(_){if(c.bc.mark(c.bd.create),(_=c.e({},ou,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ac(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=i=>{i.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:i}))},this._contextRestored=i=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:i}))},this._onMapScroll=i=>{if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new iu,this._controls=[],this._mapId=c.a3(),this._locale=c.e({},Fh,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=Bt.addThrottleControl(()=>this.isMoving()),this._requestManager=new ie(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let i=!1;const u=Ph(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{i?u(d):i=!0}),this._resizeObserver.observe(this._container)}this.handlers=new kh(this,_),this._hash=_.hash&&new Ah(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,c.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new So(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Dd,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update(i.dataType==="style"),this.fire(new c.k(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new c.k(`${i.dataType}dataloading`,i))}),this.on("dataabort",i=>{this.fire(new c.k("sourcedataabort",i))})}_getMapId(){return this._mapId}addControl(_,i){if(i===void 0&&(i=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[i];return i.indexOf("bottom")!==-1?d.insertBefore(u,d.firstChild):d.appendChild(u),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(_);return i>-1&&this._controls.splice(i,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,i,u,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,i,u,d)}resize(_){var i;const u=this._containerDimensions(),d=u[0],m=u[1],y=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,y),this.painter.resize(d,m,y),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const C=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,C),this.painter.resize(d,m,C)}this.transform.resize(d,m),(i=this._requestedCameraState)===null||i===void 0||i.resize(d,m);const w=!this._moving;return w&&(this.stop(),this.fire(new c.k("movestart",_)).fire(new c.k("move",_))),this.fire(new c.k("resize",_)),w&&this.fire(new c.k("moveend",_)),this}_getClampedPixelRatio(_,i){const{0:u,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),y=_*m,w=i*m;return Math.min(y>u?u/y:1,w>d?d/w:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Ct.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(c.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(c.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,i,u){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:y=>{const w=this.getLayer(i)?this.queryRenderedFeatures(y.point,{layers:[i]}):[];w.length?d||(d=!0,u.call(this,new Pr(_,this,y.originalEvent,{features:w}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:w=>{(this.getLayer(i)?this.queryRenderedFeatures(w.point,{layers:[i]}):[]).length?d=!0:d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))},mouseout:w=>{d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))}}}}{const d=m=>{const y=this.getLayer(i)?this.queryRenderedFeatures(m.point,{layers:[i]}):[];y.length&&(m.features=y,u.call(this,m),delete m.features)};return{layer:i,listener:u,delegates:{[_]:d}}}}on(_,i,u){if(u===void 0)return super.on(_,i);const d=this._createDelegatedListener(_,i,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,i,u){if(u===void 0)return super.once(_,i);const d=this._createDelegatedListener(_,i,u);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,i,u){return u===void 0?super.off(_,i):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,i));const u=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Gr(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,i,u):this.style.loadJSON(_,i,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,i){if(typeof _=="string"){const u=this._requestManager.transformRequest(_,"Style");c.h(u,new AbortController).then(d=>{this._updateDiff(d.data,i)}).catch(d=>{d&&this.fire(new c.j(d))})}else typeof _=="object"&&this._updateDiff(_,i)}_updateDiff(_,i){try{this.style.setState(_,i)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(_,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(_,i){return this._lazyInitEmptyStyle(),this.style.addSource(_,i),this._update(!0)}isSourceLoaded(_){const i=this.style&&this.style.sourceCaches[_];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const i=this.style.sourceCaches[_.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&i.reload();for(const u in this.style._layers){const d=this.style._layers[u];d.type==="hillshade"&&d.source===_.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Rd(this.painter,i,_),this.painter.renderToTexture=new Oh(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:_})),this}getTerrain(){var _,i;return(i=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const i in _){const u=_[i]._tiles;for(const d in u){const m=u[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,i,u={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:y,stretchY:w,content:I}=u;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:P,data:D}=i,k=i;return this.style.addImage(_,{data:new c.R({width:C,height:P},new Uint8Array(D)),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:m,version:0,userImage:k}),k.onAdd&&k.onAdd(this,_),this}}{const{width:C,height:P,data:D}=N.getImageData(i);this.style.addImage(_,{data:new c.R({width:C,height:P},D),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:m,version:0})}}updateImage(_,i){const u=this.style.getImage(_);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=i instanceof HTMLImageElement||c.b(i)?N.getImageData(i):i,{width:m,height:y,data:w}=d;if(m===void 0||y===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==u.data.width||y!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(i instanceof HTMLImageElement||c.b(i));return u.data.replace(w,I),this.style.updateImage(_,u),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return Bt.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,i){return this._lazyInitEmptyStyle(),this.style.addLayer(_,i),this._update(!0)}moveLayer(_,i){return this.style.moveLayer(_,i),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,i,u){return this.style.setLayerZoomRange(_,i,u),this._update(!0)}setFilter(_,i,u={}){return this.style.setFilter(_,i,u),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,i,u,d={}){return this.style.setPaintProperty(_,i,u,d),this._update(!0)}getPaintProperty(_,i){return this.style.getPaintProperty(_,i)}setLayoutProperty(_,i,u,d={}){return this.style.setLayoutProperty(_,i,u,d),this._update(!0)}getLayoutProperty(_,i){return this.style.getLayoutProperty(_,i)}setGlyphs(_,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,i,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,i,u,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,i,u=>{u||this._update(!0)}),this}setLight(_,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,i){return this.style.setFeatureState(_,i),this._update()}removeFeatureState(_,i){return this.style.removeFeatureState(_,i),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,i=0;return this._container&&(_=this._container.clientWidth||400,i=this._container.clientHeight||300),[_,i]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const i=this._canvasContainer=U.create("div","maplibregl-canvas-container",_);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions(),d=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],d);const m=this._controlContainer=U.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=U.create("div",`maplibregl-ctrl-${w} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,i,u){this._canvas.width=Math.floor(u*_),this._canvas.height=Math.floor(u*i),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{i={requestedAttributes:_},d&&(i.statusMessage=d.statusMessage,i.type=d.type)},{once:!0});const u=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!u){const d="Failed to initialize WebGL";throw i?(i.message=d,new Error(JSON.stringify(i))):new Error(d)}this.painter=new xd(u,this.transform),lt.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,y=N.now();this.style.zoomHistory.update(m,y);const w=new c.a8(m,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=w.crossFadingFactor();I===1&&I===this._crossFadingFactor||(u=!0,this._crossFadingFactor=I),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bc.mark(c.bd.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.bc.mark(c.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const u of this._controls)u.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Bt.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bc.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(_=>{c.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Bh}getCameraTargetElevation(){return this.transform.elevation}},f.MapMouseEvent=Pr,f.MapTouchEvent=Yo,f.MapWheelEvent=Mh,f.Marker=au,f.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const i=this._map.getZoom(),u=i===this._map.getMaxZoom(),d=i===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,u)=>{const d=this._map._getUIString(`NavigationControl.${u}`);i.title=d,i.setAttribute("aria-label",d)},this.options=c.e({},Vh,_),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,i){const u=U.create("button",_,this._container);return u.type="button",u.addEventListener("click",i),u}},f.Popup=class extends c.E{constructor(_){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?fc(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!i)return;const d=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const y=vc(this.options.offset);if(!m){const I=this._container.offsetWidth,C=this._container.offsetHeight;let P;P=d.y+y.bottom.ythis._map.transform.height-C?["bottom"]:[],d.xthis._map.transform.width-I/2&&P.push("right"),m=P.length===0?"bottom":P.join("-")}let w=d.add(y[m]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${su[m]} translate(${w.x}px,${w.y}px)`),mc(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(qh),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=c.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const i=document.createDocumentFragment(),u=document.createElement("body");let d;for(u.innerHTML=_;d=u.firstChild,d;)i.appendChild(d);return this.setDOMContent(i)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Gh);_&&_.focus()}},f.RasterDEMTileSource=hr,f.RasterTileSource=yt,f.ScaleControl=class{constructor(_){this._onMove=()=>{yc(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,yc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},_c),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},f.ScrollZoomHandler=hc,f.Style=Gr,f.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},f.TwoFingersTouchPitchHandler=Ld,f.TwoFingersTouchRotateHandler=Rh,f.TwoFingersTouchZoomHandler=Td,f.TwoFingersTouchZoomRotateHandler=eu,f.VectorTileSource=si,f.VideoSource=ja,f.addSourceType=(_,i)=>c._(void 0,void 0,void 0,function*(){if(Wa(_))throw new Error(`A source type called "${_}" already exists.`);((u,d)=>{Ha[u]=d})(_,i)}),f.clearPrewarmedResources=function(){const _=fn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Be),fn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},f.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},f.getRTLTextPluginStatus=function(){return Ot().getRTLTextPluginStatus()},f.getVersion=function(){return Nd},f.getWorkerCount=function(){return un.workerCount},f.getWorkerUrl=function(){return c.a.WORKER_URL},f.importScriptInWorkers=function(_){return Gi().broadcast("IS",_)},f.prewarm=function(){An().acquire(Be)},f.setMaxParallelImageRequests=function(_){c.a.MAX_PARALLEL_IMAGE_REQUESTS=_},f.setRTLTextPlugin=function(_,i){return Ot().setRTLTextPlugin(_,i)},f.setWorkerCount=function(_){un.workerCount=_},f.setWorkerUrl=function(_){c.a.WORKER_URL=_}});var p=r;return p})})(P0);var fb=P0.exports;const Ps=db(fb);function yy(t){let e;return r=>{if(r)for(let s in r){let l=e==null?void 0:e[s],p=r[s];l!==p&&t(s,p,l)}else if(e)for(let s in e)t(s,void 0,e[s]);e=r}}function mb(t,...e){let r=[t];for(let s of e)if(s)Array.isArray(s)&&s[0]===t?r.push(...s.slice(1)):r.push(s);else continue;if(r.length!==1)return r.length===2?r[1]:r}function gb(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function _2(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var M0=_b;function _b(t){var e,r,s;if(t){if(Array.isArray(t)){for(e=[],r=t.length,s=0;s{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(l)}}}function vb(t,e,r){let s,l,p,f,c,S,L,R,N,U,lt,ht,{$$slots:vt={},$$scope:wt}=e,{id:Mt=dg("layer")}=e,{source:Dt=void 0}=e,{sourceLayer:Bt=void 0}=e,{beforeId:ie=void 0}=e,{beforeLayerType:de=void 0}=e,{type:Fe}=e,{paint:ce=void 0}=e,{layout:Ee=void 0}=e,{filter:ge=void 0}=e,{applyToClusters:ve=void 0}=e,{minzoom:Nt=void 0}=e,{maxzoom:Jt=void 0}=e,{manageHoverState:ke=!1}=e,{hovered:ye=null}=e,{interactive:Ze=!0}=e,{hoverCursor:In=void 0}=e,{eventsIfTopMost:fe=!1}=e;const Ke=hg(),{map:Pn,source:xi,self:ln,minzoom:Be,maxzoom:un,eventTopMost:En,layerInfo:fn}=cb();Qr(t,Pn,Ut=>r(31,N=Ut)),Qr(t,xi,Ut=>r(32,U=Ut)),Qr(t,ln,Ut=>r(0,R=Ut)),Qr(t,Be,Ut=>r(34,ht=Ut)),Qr(t,un,Ut=>r(33,lt=Ut)),mu(()=>{R&&N&&(fn.delete(R),N==null||N.removeLayer(R))});let cn;function An(Ut){var yt,hr;if(!Ze||!R||!N||fe&&En(Ut)!==R)return;let Ct=Ut.features??[],bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id,si={event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct};Ke(Ut.type,si)}function Wn(Ut){var yt,hr;if(!Ze||!R||!N||fe&&En(Ut)!==R)return;In&&(N.getCanvas().style.cursor=In);let Ct=Ut.features??[];r(6,ye=Ct[0]??null);let bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id;Ke("mouseenter",{event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct})}function Gi(Ut){var yt,hr,qs;if(!Ze||!N)return;if(fe&&En(Ut)!==R){r(6,ye=null),ke&&cn!==void 0&&(N==null||N.setFeatureState({source:c,sourceLayer:Bt,id:cn},{hover:!1}),cn=void 0);return}N.getCanvas().style.cursor=In;let Ct=Ut.features??[],bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id,si=(qs=Ct[0])==null?void 0:qs.id;si!==cn&&(ke&&(cn!==void 0&&(N==null||N.setFeatureState({source:c,id:cn,sourceLayer:Bt},{hover:!1})),N==null||N.setFeatureState({source:c,id:si,sourceLayer:Bt},{hover:!0})),cn=si,r(6,ye=Ct[0]??null)),Ke("mousemove",{event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct})}function At(Ut){if(!(!Ze||!R||!N)){if(In&&(N.getCanvas().style.cursor=""),r(6,ye=null),ke&&cn!==void 0){const Ct={source:c,id:cn,sourceLayer:Bt};N==null||N.setFeatureState(Ct,{hover:!1}),cn=void 0}Ke("mouseleave",{map:N,layer:R,source:c})}}let we=!0;function qe(Ut){N&&(N.off("click",Ut,An),N.off("dblclick",Ut,An),N.off("contextmenu",Ut,An),N.off("mouseenter",Ut,Wn),N.off("mousemove",Ut,Gi),N.off("mouseleave",Ut,At))}return mu(()=>{N&&R&&qe(R)}),t.$$set=Ut=>{"id"in Ut&&r(7,Mt=Ut.id),"source"in Ut&&r(8,Dt=Ut.source),"sourceLayer"in Ut&&r(9,Bt=Ut.sourceLayer),"beforeId"in Ut&&r(10,ie=Ut.beforeId),"beforeLayerType"in Ut&&r(11,de=Ut.beforeLayerType),"type"in Ut&&r(12,Fe=Ut.type),"paint"in Ut&&r(13,ce=Ut.paint),"layout"in Ut&&r(14,Ee=Ut.layout),"filter"in Ut&&r(15,ge=Ut.filter),"applyToClusters"in Ut&&r(16,ve=Ut.applyToClusters),"minzoom"in Ut&&r(17,Nt=Ut.minzoom),"maxzoom"in Ut&&r(18,Jt=Ut.maxzoom),"manageHoverState"in Ut&&r(19,ke=Ut.manageHoverState),"hovered"in Ut&&r(6,ye=Ut.hovered),"interactive"in Ut&&r(20,Ze=Ut.interactive),"hoverCursor"in Ut&&r(21,In=Ut.hoverCursor),"eventsIfTopMost"in Ut&&r(22,fe=Ut.eventsIfTopMost),"$$scope"in Ut&&r(35,wt=Ut.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,s=gb(ve)),t.$$.dirty[0]&1073774592&&r(24,l=mb("all",s,ge)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,p=Nt??ht),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,f=Jt??lt),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,c=Dt||U),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&N&&R!==Mt&&c){R&&(qe(R),fn.delete(R));let Ut=ie;if(!ie&&de){let Ct=N.getStyle().layers,bi=typeof de=="function"?de:yt=>yt.type===de,si=Ct==null?void 0:Ct.find(bi);si&&(Ut=si.id)}wp(ln,R=Mt,R),N.addLayer(M0({id:R,type:Fe,source:c,"source-layer":Bt,filter:l,paint:ce,layout:Ee,minzoom:p,maxzoom:f}),Ut),r(23,we=!0),N.on("click",R,An),N.on("dblclick",R,An),N.on("contextmenu",R,An),N.on("mouseenter",R,Wn),N.on("mousemove",R,Gi),N.on("mouseleave",R,At)}t.$$.dirty[0]&1048577&&R&&fn.set(R,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,S=R?yy((Ut,Ct)=>N==null?void 0:N.setPaintProperty(R,Ut,Ct)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,L=R?yy((Ut,Ct)=>N==null?void 0:N.setLayoutProperty(R,Ut,Ct)):void 0),t.$$.dirty[0]&268443648&&(S==null||S(ce)),t.$$.dirty[0]&134234112&&(L==null||L(Ee)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&R&&(N==null||N.setLayerZoomRange(R,p,f)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&R&&(we?r(23,we=!1):N==null||N.setFilter(R,l))},[R,Pn,xi,ln,Be,un,ye,Mt,Dt,Bt,ie,de,Fe,ce,Ee,ge,ve,Nt,Jt,ke,Ze,In,fe,we,l,f,p,L,S,c,s,N,U,lt,ht,wt,vt]}class D0 extends ao{constructor(e){super(),so(this,e,vb,yb,Cr,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function xb(t){let e;const r=t[16].default,s=wl(r,t,t[24],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&16777216)&&El(s,r,l,l[24],e?Il(r,l[24],p,null):Sl(l[24]),null)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function bb(t){let e,r,s;function l(f){t[17](f)}let p={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[xb]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new D0({props:p}),Vc.push(()=>f0(e,"hovered",l)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){du(e.$$.fragment)},m(f,c){_l(e,f,c),s=!0},p(f,[c]){const S={};c&2&&(S.id=f[1]),c&4&&(S.source=f[2]),c&8&&(S.sourceLayer=f[3]),c&16&&(S.beforeId=f[4]),c&32&&(S.beforeLayerType=f[5]),c&64&&(S.paint=f[6]),c&128&&(S.layout=f[7]),c&256&&(S.filter=f[8]),c&512&&(S.applyToClusters=f[9]),c&1024&&(S.minzoom=f[10]),c&2048&&(S.maxzoom=f[11]),c&4096&&(S.hoverCursor=f[12]),c&8192&&(S.manageHoverState=f[13]),c&16384&&(S.eventsIfTopMost=f[14]),c&32768&&(S.interactive=f[15]),c&16777216&&(S.$$scope={dirty:c,ctx:f}),!r&&c&1&&(r=!0,S.hovered=f[0],p0(()=>r=!1)),e.$set(S)},i(f){s||(dn(e.$$.fragment,f),s=!0)},o(f){Fn(e.$$.fragment,f),s=!1},d(f){yl(e,f)}}}function wb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=dg("circle")}=e,{source:f=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:N=void 0}=e,{filter:U=void 0}=e,{applyToClusters:lt=void 0}=e,{minzoom:ht=void 0}=e,{maxzoom:vt=void 0}=e,{hoverCursor:wt=void 0}=e,{manageHoverState:Mt=!1}=e,{hovered:Dt=null}=e,{eventsIfTopMost:Bt=!1}=e,{interactive:ie=!0}=e;function de(Jt){Dt=Jt,r(0,Dt)}function Fe(Jt){is.call(this,t,Jt)}function ce(Jt){is.call(this,t,Jt)}function Ee(Jt){is.call(this,t,Jt)}function ge(Jt){is.call(this,t,Jt)}function ve(Jt){is.call(this,t,Jt)}function Nt(Jt){is.call(this,t,Jt)}return t.$$set=Jt=>{"id"in Jt&&r(1,p=Jt.id),"source"in Jt&&r(2,f=Jt.source),"sourceLayer"in Jt&&r(3,c=Jt.sourceLayer),"beforeId"in Jt&&r(4,S=Jt.beforeId),"beforeLayerType"in Jt&&r(5,L=Jt.beforeLayerType),"paint"in Jt&&r(6,R=Jt.paint),"layout"in Jt&&r(7,N=Jt.layout),"filter"in Jt&&r(8,U=Jt.filter),"applyToClusters"in Jt&&r(9,lt=Jt.applyToClusters),"minzoom"in Jt&&r(10,ht=Jt.minzoom),"maxzoom"in Jt&&r(11,vt=Jt.maxzoom),"hoverCursor"in Jt&&r(12,wt=Jt.hoverCursor),"manageHoverState"in Jt&&r(13,Mt=Jt.manageHoverState),"hovered"in Jt&&r(0,Dt=Jt.hovered),"eventsIfTopMost"in Jt&&r(14,Bt=Jt.eventsIfTopMost),"interactive"in Jt&&r(15,ie=Jt.interactive),"$$scope"in Jt&&r(24,l=Jt.$$scope)},[Dt,p,f,c,S,L,R,N,U,lt,ht,vt,wt,Mt,Bt,ie,s,de,Fe,ce,Ee,ge,ve,Nt,l]}class y2 extends ao{constructor(e){super(),so(this,e,wb,bb,Cr,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Ib(t,e,r){let s;const{map:l}=ah();Qr(t,l,S=>r(4,s=S));let{position:p="top-left"}=e,{container:f=void 0}=e,c=null;return mu(()=>{s!=null&&s.loaded()&&c&&s.removeControl(c)}),t.$$set=S=>{"position"in S&&r(1,p=S.position),"container"in S&&r(2,f=S.container)},t.$$.update=()=>{if(t.$$.dirty&30&&s&&!c){let S;typeof f=="string"?S=document.querySelector(f)??void 0:S=f,r(3,c=new Ps.FullscreenControl({container:S})),s.addControl(c,p)}},[l,p,f,c,s]}class Eb extends ao{constructor(e){super(),so(this,e,Ib,null,Cr,{position:1,container:2})}}function Sb(t,e,r){let s;const{map:l}=ah();Qr(t,l,U=>r(8,s=U));let{position:p="top-left"}=e,{positionOptions:f=void 0}=e,{fitBoundsOptions:c=void 0}=e,{trackUserLocation:S=!1}=e,{showAccuracyCircle:L=!0}=e,{showUserLocation:R=!0}=e,N=null;return mu(()=>{s!=null&&s.loaded()&&N&&s.removeControl(N)}),t.$$set=U=>{"position"in U&&r(1,p=U.position),"positionOptions"in U&&r(2,f=U.positionOptions),"fitBoundsOptions"in U&&r(3,c=U.fitBoundsOptions),"trackUserLocation"in U&&r(4,S=U.trackUserLocation),"showAccuracyCircle"in U&&r(5,L=U.showAccuracyCircle),"showUserLocation"in U&&r(6,R=U.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&s&&!N&&(r(7,N=new Ps.GeolocateControl({positionOptions:f,fitBoundsOptions:c,trackUserLocation:S,showAccuracyCircle:L,showUserLocation:R})),s.addControl(N,p))},[l,p,f,c,S,L,R,N,s]}class Cb extends ao{constructor(e){super(),so(this,e,Sb,null,Cr,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function Tb(t){let e;const r=t[15].default,s=wl(r,t,t[23],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&8388608)&&El(s,r,l,l[23],e?Il(r,l[23],p,null):Sl(l[23]),null)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Lb(t){let e,r,s;function l(f){t[16](f)}let p={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[Tb]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new D0({props:p}),Vc.push(()=>f0(e,"hovered",l)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){du(e.$$.fragment)},m(f,c){_l(e,f,c),s=!0},p(f,[c]){const S={};c&2&&(S.id=f[1]),c&4&&(S.source=f[2]),c&8&&(S.sourceLayer=f[3]),c&16&&(S.beforeId=f[4]),c&32&&(S.beforeLayerType=f[5]),c&64&&(S.paint=f[6]),c&128&&(S.layout=f[7]),c&256&&(S.filter=f[8]),c&512&&(S.minzoom=f[9]),c&1024&&(S.maxzoom=f[10]),c&2048&&(S.hoverCursor=f[11]),c&4096&&(S.manageHoverState=f[12]),c&8192&&(S.eventsIfTopMost=f[13]),c&16384&&(S.interactive=f[14]),c&8388608&&(S.$$scope={dirty:c,ctx:f}),!r&&c&1&&(r=!0,S.hovered=f[0],p0(()=>r=!1)),e.$set(S)},i(f){s||(dn(e.$$.fragment,f),s=!0)},o(f){Fn(e.$$.fragment,f),s=!1},d(f){yl(e,f)}}}function Pb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=dg("line")}=e,{source:f=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:N=void 0}=e,{filter:U=void 0}=e,{minzoom:lt=void 0}=e,{maxzoom:ht=void 0}=e,{hoverCursor:vt=void 0}=e,{manageHoverState:wt=!1}=e,{hovered:Mt=null}=e,{eventsIfTopMost:Dt=!1}=e,{interactive:Bt=!0}=e;function ie(Nt){Mt=Nt,r(0,Mt)}function de(Nt){is.call(this,t,Nt)}function Fe(Nt){is.call(this,t,Nt)}function ce(Nt){is.call(this,t,Nt)}function Ee(Nt){is.call(this,t,Nt)}function ge(Nt){is.call(this,t,Nt)}function ve(Nt){is.call(this,t,Nt)}return t.$$set=Nt=>{"id"in Nt&&r(1,p=Nt.id),"source"in Nt&&r(2,f=Nt.source),"sourceLayer"in Nt&&r(3,c=Nt.sourceLayer),"beforeId"in Nt&&r(4,S=Nt.beforeId),"beforeLayerType"in Nt&&r(5,L=Nt.beforeLayerType),"paint"in Nt&&r(6,R=Nt.paint),"layout"in Nt&&r(7,N=Nt.layout),"filter"in Nt&&r(8,U=Nt.filter),"minzoom"in Nt&&r(9,lt=Nt.minzoom),"maxzoom"in Nt&&r(10,ht=Nt.maxzoom),"hoverCursor"in Nt&&r(11,vt=Nt.hoverCursor),"manageHoverState"in Nt&&r(12,wt=Nt.manageHoverState),"hovered"in Nt&&r(0,Mt=Nt.hovered),"eventsIfTopMost"in Nt&&r(13,Dt=Nt.eventsIfTopMost),"interactive"in Nt&&r(14,Bt=Nt.interactive),"$$scope"in Nt&&r(23,l=Nt.$$scope)},[Mt,p,f,c,S,L,R,N,U,lt,ht,vt,wt,Dt,Bt,s,ie,de,Fe,ce,Ee,ge,ve,l]}class v2 extends ao{constructor(e){super(),so(this,e,Pb,Lb,Cr,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function Ab(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,s=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,s),p=Math.round(e.lat*l)/l,f=Math.round(e.lng*l)/l,c=`${r}/${p}/${f}`,S=t.getBearing(),L=t.getPitch();return(S||L)&&(c+=`/${Math.round(S*10)/10}`),L&&(c+=`/${Math.round(L)}`),`#${c}`}function Mb(t){return t.replace("#","").split("/").map(parseFloat)}var sf=gg;function gg(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?by(t,e):{}.toString.call(t)=="[object Set]"?by(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?Rb(t,e):Db(t,e)}function Db(t,e){return t.toString()===e.toString()}function by(t,e){var r=t.length;if(r!=e.length)return!1;for(var s=0;sr(6,s=R));let{position:p="top-left"}=e,{showCompass:f=!0}=e,{showZoom:c=!0}=e,{visualizePitch:S=!1}=e,L=null;return mu(()=>{s!=null&&s.loaded()&&L&&s.removeControl(L)}),t.$$set=R=>{"position"in R&&r(1,p=R.position),"showCompass"in R&&r(2,f=R.showCompass),"showZoom"in R&&r(3,c=R.showZoom),"visualizePitch"in R&&r(4,S=R.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&s&&!L&&(r(5,L=new Ps.NavigationControl({showCompass:f,showZoom:c,visualizePitch:S})),s.addControl(L,p))},[l,p,f,c,S,L,s]}class kb extends ao{constructor(e){super(),so(this,e,Nb,null,Cr,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function zb(t,e,r){let s;const{map:l}=ah();Qr(t,l,L=>r(5,s=L));let{position:p="bottom-left"}=e,{maxWidth:f=void 0}=e,{unit:c="metric"}=e,S=null;return mu(()=>{s!=null&&s.loaded()&&S&&s.removeControl(S)}),t.$$set=L=>{"position"in L&&r(1,p=L.position),"maxWidth"in L&&r(2,f=L.maxWidth),"unit"in L&&r(3,c=L.unit)},t.$$.update=()=>{t.$$.dirty&62&&s&&!S&&(r(4,S=new Ps.ScaleControl({maxWidth:f,unit:c})),s.addControl(S,p))},[l,p,f,c,S,s]}class Ob extends ao{constructor(e){super(),so(this,e,zb,null,Cr,{position:1,maxWidth:2,unit:3})}}const{window:Fb}=r1,Bb=t=>({map:t[0]&8,loadedImages:t[0]&16,allImagesLoaded:t[0]&32}),wy=t=>({map:t[3],loadedImages:t[4],allImagesLoaded:t[5]});function Iy(t){let e,r,s=t[2]&&Ey(t);const l=t[38].default,p=wl(l,t,t[37],wy);return{c(){s&&s.c(),e=Hi(),p&&p.c()},m(f,c){s&&s.m(f,c),hn(f,e,c),p&&p.m(f,c),r=!0},p(f,c){f[2]?s?(s.p(f,c),c[0]&4&&dn(s,1)):(s=Ey(f),s.c(),dn(s,1),s.m(e.parentNode,e)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh()),p&&p.p&&(!r||c[0]&56|c[1]&64)&&El(p,l,f,f[37],r?Il(l,f[37],c,Bb):Sl(f[37]),wy)},i(f){r||(dn(s),dn(p,f),r=!0)},o(f){Fn(s),Fn(p,f),r=!1},d(f){f&&an(e),s&&s.d(f),p&&p.d(f)}}}function Ey(t){let e,r,s,l,p,f,c,S;return e=new kb({props:{position:t[6]}}),s=new Cb({props:{position:t[6],fitBoundsOptions:{maxZoom:12}}}),p=new Eb({props:{position:t[6]}}),c=new Ob({props:{position:t[6]}}),{c(){du(e.$$.fragment),r=Hi(),du(s.$$.fragment),l=Hi(),du(p.$$.fragment),f=Hi(),du(c.$$.fragment)},m(L,R){_l(e,L,R),hn(L,r,R),_l(s,L,R),hn(L,l,R),_l(p,L,R),hn(L,f,R),_l(c,L,R),S=!0},p(L,R){const N={};R[0]&64&&(N.position=L[6]),e.$set(N);const U={};R[0]&64&&(U.position=L[6]),s.$set(U);const lt={};R[0]&64&&(lt.position=L[6]),p.$set(lt);const ht={};R[0]&64&&(ht.position=L[6]),c.$set(ht)},i(L){S||(dn(e.$$.fragment,L),dn(s.$$.fragment,L),dn(p.$$.fragment,L),dn(c.$$.fragment,L),S=!0)},o(L){Fn(e.$$.fragment,L),Fn(s.$$.fragment,L),Fn(p.$$.fragment,L),Fn(c.$$.fragment,L),S=!1},d(L){L&&(an(r),an(l),an(f)),yl(e,L),yl(s,L),yl(p,L),yl(c,L)}}}function Vb(t){let e,r,s,l,p,f=t[3]&&t[0]&&Iy(t);return{c(){e=sn("div"),f&&f.c(),Tn(e,"class",r=cy(t[1])+" svelte-p00lfq"),Tn(e,"data-testid","map-container"),py(e,"expand-map",!t[1])},m(c,S){hn(c,e,S),f&&f.m(e,null),s=!0,l||(p=[yp(Fb,"hashchange",t[10]),i1(t[9].call(null,e))],l=!0)},p(c,S){c[3]&&c[0]?f?(f.p(c,S),S[0]&9&&dn(f,1)):(f=Iy(c),f.c(),dn(f,1),f.m(e,null)):f&&(oh(),Fn(f,1,1,()=>{f=null}),sh()),(!s||S[0]&2&&r!==(r=cy(c[1])+" svelte-p00lfq"))&&Tn(e,"class",r),(!s||S[0]&2)&&py(e,"expand-map",!c[1])},i(c){s||(dn(f),s=!0)},o(c){Fn(f),s=!1},d(c){c&&an(e),f&&f.d(),l=!1,Lu(p)}}}function Ub(t,e,r){let s,l,p,f,{$$slots:c={},$$scope:S}=e,{map:L=null}=e,{class:R=void 0}=e,{style:N}=e,{diffStyleUpdates:U=!1}=e,{center:lt=void 0}=e,{zoom:ht=void 0}=e,{pitch:vt=0}=e,{bearing:wt=0}=e,{bounds:Mt=void 0}=e,{hash:Dt=!1}=e,{loaded:Bt=!1}=e,{minZoom:ie=0}=e,{maxZoom:de=22}=e,{antialias:Fe=void 0}=e,{zoomOnDoubleClick:ce=!0}=e,{locale:Ee=void 0}=e,{interactive:ge=!0}=e,{attributionControl:ve=!0}=e,{cooperativeGestures:Nt=!1}=e,{preserveDrawingBuffer:Jt=!1}=e,{maxBounds:ke=void 0}=e,{images:ye=[]}=e,{standardControls:Ze=!1}=e,{filterLayers:In=void 0}=e,{transformRequest:fe=void 0}=e;const Ke=hg(),{map:Pn,loadedImages:xi}=ub();Qr(t,Pn,At=>r(3,p=At)),Qr(t,xi,At=>r(4,f=At));let ln=new Set;async function Be(At,we=!1){if(p&&!(!p.loaded()&&!we))if("url"in At){ln.add(At.id);try{let qe=await p.loadImage(At.url);p==null||p.addImage(At.id,qe.data,At.options),f.add(At.id),xi.set(f)}catch(qe){Ke("error",qe)}finally{ln.delete(At.id)}}else p.addImage(At.id,At.data,At.options),f.add(At.id),xi.set(f)}let un,En,fn,cn;function An(At){return Gi(),wp(Pn,p=new Ps.Map(M0({container:At,style:N,locale:Ee,center:lt,zoom:ht,pitch:vt,bearing:wt,minZoom:ie,maxZoom:de,antialias:Fe,interactive:ge,preserveDrawingBuffer:Jt,maxBounds:ke,bounds:Mt,attributionControl:ve,transformRequest:fe,cooperativeGestures:Nt})),p),p.on("load",we=>{we.target.getContainer().setAttribute("data-testid","map"),we.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,Bt=!0),Ke("load",p)}),p.on("error",we=>Ke("error",{...we,map:p})),p.on("movestart",we=>Ke("movestart",{...we,map:p})),p.on("moveend",we=>{if(r(11,lt=we.target.getCenter()),r(12,ht=we.target.getZoom()),r(13,Mt=we.target.getBounds()),Ke("moveend",{...we,map:p}),Dt){let qe=window.location.href.replace(/(#.+)?$/,Ab(p));window.history.replaceState(window.history.state,"",qe)}}),p.on("zoomstart",we=>Ke("zoomstart",{...we,map:p})),p.on("zoom",we=>{r(12,ht=we.target.getZoom()),Ke("zoom",{...we,map:p})}),p.on("zoomend",we=>{r(12,ht=we.target.getZoom()),Ke("zoomend",{...we,map:p})}),p.on("style.load",()=>{if(p){const we=p.getStyle();if(r(34,un=we.layers.map(qe=>qe.id)),r(35,En=Object.keys(we.sources)),cn)for(const[qe,Ut]of Object.entries(cn))p.addSource(qe,Ut);if(fn)for(const qe of fn)p.addLayer(qe);for(const qe of ye)Be(qe,!0)}}),p.on("styledata",we=>{if(p&&In){const qe=p.getStyle().layers;if(qe)for(let Ut of qe)In(Ut)||p.setLayoutProperty(Ut.id,"visibility","none")}Ke("styledata",{...we,map:p})}),{destroy(){r(0,Bt=!1),p==null||p.remove(),wp(Pn,p=null,p)}}}let Wn=N;function Gi(){if(Dt){let At=Mb(window.location.hash);At.length>=3&&(r(12,ht=At[0]),r(11,lt=[At[2],At[1]])),At.length==5&&(r(16,wt=At[3]),r(15,vt=At[4]))}}return t.$$set=At=>{"map"in At&&r(14,L=At.map),"class"in At&&r(1,R=At.class),"style"in At&&r(17,N=At.style),"diffStyleUpdates"in At&&r(18,U=At.diffStyleUpdates),"center"in At&&r(11,lt=At.center),"zoom"in At&&r(12,ht=At.zoom),"pitch"in At&&r(15,vt=At.pitch),"bearing"in At&&r(16,wt=At.bearing),"bounds"in At&&r(13,Mt=At.bounds),"hash"in At&&r(19,Dt=At.hash),"loaded"in At&&r(0,Bt=At.loaded),"minZoom"in At&&r(20,ie=At.minZoom),"maxZoom"in At&&r(21,de=At.maxZoom),"antialias"in At&&r(22,Fe=At.antialias),"zoomOnDoubleClick"in At&&r(23,ce=At.zoomOnDoubleClick),"locale"in At&&r(24,Ee=At.locale),"interactive"in At&&r(25,ge=At.interactive),"attributionControl"in At&&r(26,ve=At.attributionControl),"cooperativeGestures"in At&&r(27,Nt=At.cooperativeGestures),"preserveDrawingBuffer"in At&&r(28,Jt=At.preserveDrawingBuffer),"maxBounds"in At&&r(29,ke=At.maxBounds),"images"in At&&r(30,ye=At.images),"standardControls"in At&&r(2,Ze=At.standardControls),"filterLayers"in At&&r(31,In=At.filterLayers),"transformRequest"in At&&r(32,fe=At.transformRequest),"$$scope"in At&&r(37,S=At.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&4&&r(6,s=typeof Ze=="boolean"?void 0:Ze),t.$$.dirty[0]&8&&r(14,L=p),t.$$.dirty[0]&393224|t.$$.dirty[1]&56&&p&&!sf(N,Wn)){const At=p.getStyle();if(un&&(fn=At.layers.filter(we=>!un.includes(we.id))),En){const we=Object.keys(At.sources).filter(qe=>!En.includes(qe));cn={};for(const qe of we)cn[qe]=At.sources[qe]}r(36,Wn=N),p.setStyle(N,{diff:U}),wp(xi,f=new Set,f),r(33,ln=new Set)}if(t.$$.dirty[0]&1073741849|t.$$.dirty[1]&4&&Bt&&p!=null&&p.loaded())for(let At of ye)!f.has(At.id)&&!ln.has(At.id)&&!p.hasImage(At.id)&&Be(At);t.$$.dirty[0]&1073741840&&r(5,l=ye.every(At=>f.has(At.id))),t.$$.dirty[0]&2056&<&&!sf(lt,p==null?void 0:p.getCenter())&&(p==null||p.panTo(lt)),t.$$.dirty[0]&4104&&ht&&!sf(ht,p==null?void 0:p.getZoom())&&(p==null||p.zoomTo(ht)),t.$$.dirty[0]&8200&&Mt&&!sf(Mt,p==null?void 0:p.getBounds())&&(p==null||p.fitBounds(Mt)),t.$$.dirty[0]&8388616&&(ce?p==null||p.doubleClickZoom.enable():p==null||p.doubleClickZoom.disable())},[Bt,R,Ze,p,f,l,s,Pn,xi,An,Gi,lt,ht,Mt,L,vt,wt,N,U,Dt,ie,de,Fe,ce,Ee,ge,ve,Nt,Jt,ke,ye,In,fe,ln,un,En,Wn,S,c]}class x2 extends ao{constructor(e){super(),so(this,e,Ub,Vb,Cr,{map:14,class:1,style:17,diffStyleUpdates:18,center:11,zoom:12,pitch:15,bearing:16,bounds:13,hash:19,loaded:0,minZoom:20,maxZoom:21,antialias:22,zoomOnDoubleClick:23,locale:24,interactive:25,attributionControl:26,cooperativeGestures:27,preserveDrawingBuffer:28,maxBounds:29,images:30,standardControls:2,filterLayers:31,transformRequest:32},null,[-1,-1])}}const qb=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),Sy=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function Cy(t){let e,r,s=(t[4]||t[3]instanceof Ps.Marker)&&Ty(t);return{c(){e=sn("div"),s&&s.c()},m(l,p){hn(l,e,p),s&&s.m(e,null),t[32](e),r=!0},p(l,p){l[4]||l[3]instanceof Ps.Marker?s?(s.p(l,p),p[0]&24&&dn(s,1)):(s=Ty(l),s.c(),dn(s,1),s.m(e,null)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(),t[32](null)}}}function Ty(t){let e;const r=t[30].default,s=wl(r,t,t[29],Sy);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p[0]&536870933)&&El(s,r,l,l[29],e?Il(r,l[29],p,qb):Sl(l[29]),Sy)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Gb(t){let e,r,s=t[9].default&&Cy(t);return{c(){s&&s.c(),e=If()},m(l,p){s&&s.m(l,p),hn(l,e,p),r=!0},p(l,p){l[9].default?s?(s.p(l,p),p[0]&512&&dn(s,1)):(s=Cy(l),s.c(),dn(s,1),s.m(e.parentNode,e)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(l)}}}function jb(t,e,r){let s,l,p,f,c,S,{$$slots:L={},$$scope:R}=e;const N=n1(L);let{closeButton:U=void 0}=e,{closeOnClickOutside:lt=!0}=e,{closeOnClickInside:ht=!1}=e,{closeOnMove:vt=!1}=e,{openOn:wt="click"}=e,{openIfTopMost:Mt=!0}=e,{focusAfterOpen:Dt=!0}=e,{anchor:Bt=void 0}=e,{offset:ie=void 0}=e,{popupClass:de=void 0}=e,{maxWidth:Fe=void 0}=e,{lngLat:ce=void 0}=e,{html:Ee=void 0}=e,{open:ge=!1}=e;const ve=hg(),{map:Nt,popupTarget:Jt,layerEvent:ke,layer:ye,eventTopMost:Ze}=ah();Qr(t,Nt,Ct=>r(2,p=Ct)),Qr(t,Jt,Ct=>r(3,c=Ct)),Qr(t,ke,Ct=>r(28,f=Ct)),Qr(t,ye,Ct=>r(35,S=Ct));const In=["click","dblclick","contextmenu"];let fe,Ke=!1,Pn;function xi(){if(!fe)return;let Ct=fe.getElement();!Ct||Ct===Pn||(Pn=Ct,wt==="hover"&&(Pn.style.pointerEvents="none"),Pn.addEventListener("mouseenter",()=>{r(24,Ke=!0)},{passive:!0}),Pn.addEventListener("mouseleave",()=>{r(24,Ke=!1)},{passive:!0}),Pn.addEventListener("click",()=>{ht&&r(0,ge=!1)},{passive:!0}))}u1(()=>{if(p)return p.on("click",At),p.on("contextmenu",At),typeof c=="string"&&(p.on("click",c,En),p.on("dblclick",c,En),p.on("contextmenu",c,En),p.on("mousemove",c,Gi),p.on("mouseleave",c,Wn),p.on("touchstart",c,cn),p.on("touchend",c,An)),()=>{p!=null&&p.loaded()&&(fe==null||fe.remove(),p.off("click",At),p.off("contextmenu",At),c instanceof Ps.Marker?c.getPopup()===fe&&c.setPopup(void 0):typeof c=="string"&&(p.off("click",c,En),p.off("dblclick",c,En),p.off("contextmenu",c,En),p.off("mousemove",c,Gi),p.off("mouseleave",c,Wn),p.off("touchstart",c,cn),p.off("touchend",c,An)))}});function ln(Ct){return Mt?!("marker"in Ct)&&!hb(Ct)&&Ze(Ct)!==S:!1}let Be=null,un="normal";function En(Ct){Ct.type===wt&&(ln(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(r(10,ce=Ct.coordinate),r(4,Be=Ct.object?[Ct.object]:null)):(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[])):(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[])),setTimeout(()=>r(0,ge=!0))))}let fn=null;function cn(Ct){fn=Ct.point}function An(Ct){if(!fn||wt!=="hover")return;let bi=fn.dist(Ct.point);fn=null,bi<3&&(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[]),fe.isOpen()?r(25,un="justOpened"):(r(25,un="opening"),r(0,ge=!0)))}function Wn(Ct){wt!=="hover"||fn||un!=="normal"||(r(0,ge=!1),r(4,Be=null))}function Gi(Ct){if(!(wt!=="hover"||fn||un!=="normal")){if(ln(Ct)){r(0,ge=!1),r(4,Be=null);return}r(0,ge=!0),r(4,Be=Ct.features??[]),r(10,ce=Ct.lngLat)}}function At(Ct){if(un==="justOpened"){r(25,un="normal");return}if(!lt)return;let bi=[Pn,c instanceof Ps.Marker?c==null?void 0:c.getElement():null];ge&&fe.isOpen()&&!bi.some(si=>si==null?void 0:si.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&wt==="contextmenu"||Ct.type!=="contextmenu")&&r(0,ge=!1)}mu(()=>{p&&(fe!=null&&fe.isOpen())&&fe.remove()});let we;const qe=()=>r(0,ge=!1);function Ut(Ct){Vc[Ct?"unshift":"push"](()=>{we=Ct,r(1,we)})}return t.$$set=Ct=>{"closeButton"in Ct&&r(11,U=Ct.closeButton),"closeOnClickOutside"in Ct&&r(12,lt=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&r(13,ht=Ct.closeOnClickInside),"closeOnMove"in Ct&&r(14,vt=Ct.closeOnMove),"openOn"in Ct&&r(15,wt=Ct.openOn),"openIfTopMost"in Ct&&r(16,Mt=Ct.openIfTopMost),"focusAfterOpen"in Ct&&r(17,Dt=Ct.focusAfterOpen),"anchor"in Ct&&r(18,Bt=Ct.anchor),"offset"in Ct&&r(19,ie=Ct.offset),"popupClass"in Ct&&r(20,de=Ct.popupClass),"maxWidth"in Ct&&r(21,Fe=Ct.maxWidth),"lngLat"in Ct&&r(10,ce=Ct.lngLat),"html"in Ct&&r(22,Ee=Ct.html),"open"in Ct&&r(0,ge=Ct.open),"$$scope"in Ct&&r(29,R=Ct.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,s=U??(!lt&&!ht)),t.$$.dirty[0]&146685952&&(fe||(r(23,fe=new Ps.Popup({closeButton:s,closeOnClick:!1,closeOnMove:vt,focusAfterOpen:Dt,maxWidth:Fe,className:de,anchor:Bt,offset:ie})),Pn=fe.getElement(),fe.on("open",()=>{r(0,ge=!0),xi(),ve("open",fe)}),fe.on("close",()=>{r(0,ge=!1),ve("close",fe)}),fe.on("hover",()=>{ve("hover",fe)}))),t.$$.dirty[0]&8421384&&fe&&c instanceof Ps.Marker&&(wt==="click"?c.setPopup(fe):c.getPopup()===fe&&c.setPopup(void 0)),t.$$.dirty[0]&268468224&&In.includes(wt)&&(f==null?void 0:f.type)===wt&&(En(f),wp(ke,f=null,f)),t.$$.dirty[0]&268468224&&r(26,l=wt==="hover"&&((f==null?void 0:f.type)==="mousemove"||(f==null?void 0:f.type)==="mouseenter")),t.$$.dirty[0]&352354304&&wt==="hover"&&ke&&(l&&f&&(f.layerType==="deckgl"?(r(10,ce=f.coordinate),r(4,Be=f.object?[f.object]:null)):(r(10,ce=f.lngLat),r(4,Be=f.features??[]))),r(0,ge=(l||Ke)??!1)),t.$$.dirty[0]&12582914&&(we?fe.setDOMContent(we):Ee&&fe.setHTML(Ee)),t.$$.dirty[0]&8389632&&ce&&fe.setLngLat(ce),t.$$.dirty[0]&41943045&&p){let Ct=fe.isOpen();ge&&!Ct?(fe.addTo(p),un==="opening"&&r(25,un="justOpened")):!ge&&Ct&&fe.remove()}},[ge,we,p,c,Be,Nt,Jt,ke,ye,N,ce,U,lt,ht,vt,wt,Mt,Dt,Bt,ie,de,Fe,Ee,fe,Ke,un,l,s,f,R,L,qe,Ut]}class Zb extends ao{constructor(e){super(),so(this,e,jb,Gb,Cr,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}let mp={origins:"blue",destinations:"purple",lts1:"#009e73",lts2:"#56b4e9",lts3:"#e69f00",lts4:"#d55e00",lts_not_allowed:"red"},b2=["match",["get","lts"],0,mp.lts_not_allowed,1,mp.lts1,2,mp.lts2,3,mp.lts3,4,mp.lts4,"red"];function w2(t,e,r){let s=["step",t];for(let l=1;lopen-source project +`),Q=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(Q,nt),I.compileShader(Q),!I.getShaderParameter(Q,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(Q)}`);I.attachShader(this.program,Q);const st=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(st,ft),I.compileShader(st),!I.getShaderParameter(st,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(st)}`);I.attachShader(this.program,st),this.attributes={};const mt={};this.numAttributes=D.length;for(let gt=0;gt({u_depth:new c.aG(gt,xt.u_depth),u_terrain:new c.aG(gt,xt.u_terrain),u_terrain_dim:new c.aH(gt,xt.u_terrain_dim),u_terrain_matrix:new c.aI(gt,xt.u_terrain_matrix),u_terrain_unpack:new c.aJ(gt,xt.u_terrain_unpack),u_terrain_exaggeration:new c.aH(gt,xt.u_terrain_exaggeration)}))(i,mt),this.binderUniforms=d?d.getUniforms(i,mt):[]}draw(i,u,d,m,y,w,I,C,P,D,k,V,X,W,J,j,nt,ft){const Q=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(d),i.setStencilMode(m),i.setColorMode(y),i.setCullFace(w),C){i.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),i.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(const mt in this.terrainUniforms)this.terrainUniforms[mt].set(C[mt])}for(const mt in this.fixedUniforms)this.fixedUniforms[mt].set(I[mt]);J&&J.setUniforms(i,this.binderUniforms,X,{zoom:W});let st=0;switch(u){case Q.LINES:st=2;break;case Q.TRIANGLES:st=3;break;case Q.LINE_STRIP:st=1}for(const mt of V.get()){const gt=mt.vaos||(mt.vaos={});(gt[P]||(gt[P]=new Fu)).bind(i,this,D,J?J.getPaintVertexBuffers():[],k,mt.vertexOffset,j,nt,ft),Q.drawElements(u,mt.primitiveLength*st,Q.UNSIGNED_SHORT,mt.primitiveOffset*st*2)}}}function Bu(_,i,u){const d=1/xe(u,1,i.transform.tileZoom),m=Math.pow(2,u.tileID.overscaledZ),y=u.tileSize*Math.pow(2,i.transform.tileZoom)/m,w=y*(u.tileID.canonical.x+u.tileID.wrap*m),I=y*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[w>>16,I>>16],u_pixel_coord_lower:[65535&w,65535&I]}}const Gl=(_,i,u,d)=>{const m=i.style.light,y=m.properties.get("position"),w=[y.x,y.y,y.z],I=function(){var P=new c.A(9);return c.A!=Float32Array&&(P[1]=0,P[2]=0,P[3]=0,P[5]=0,P[6]=0,P[7]=0),P[0]=1,P[4]=1,P[8]=1,P}();m.properties.get("anchor")==="viewport"&&function(P,D){var k=Math.sin(D),V=Math.cos(D);P[0]=V,P[1]=k,P[2]=0,P[3]=-k,P[4]=V,P[5]=0,P[6]=0,P[7]=0,P[8]=1}(I,-i.transform.angle),function(P,D,k){var V=D[0],X=D[1],W=D[2];P[0]=V*k[0]+X*k[3]+W*k[6],P[1]=V*k[1]+X*k[4]+W*k[7],P[2]=V*k[2]+X*k[5]+W*k[8]}(w,w,I);const C=m.properties.get("color");return{u_matrix:_,u_lightpos:w,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:d}},zf=(_,i,u,d,m,y,w)=>c.e(Gl(_,i,u,d),Bu(y,i,w),{u_height_factor:-Math.pow(2,m.overscaledZ)/w.tileSize/8}),$p=_=>({u_matrix:_}),Vu=(_,i,u,d)=>c.e($p(_),Bu(u,i,d)),Of=(_,i)=>({u_matrix:_,u_world:i}),td=(_,i,u,d,m)=>c.e(Vu(_,i,u,d),{u_world:m}),Ff=(_,i,u,d)=>{const m=_.transform;let y,w;if(d.paint.get("circle-pitch-alignment")==="map"){const I=xe(u,1,m.zoom);y=!0,w=[I,I]}else y=!1,w=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(i.posMatrix,u,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:w}},ed=(_,i,u)=>{const d=xe(u,1,i.zoom),m=Math.pow(2,i.zoom-u.tileID.overscaledZ),y=u.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[i.pixelsToGLUnits[0]/(d*m),i.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:y}},nd=(_,i,u=1)=>({u_matrix:_,u_color:i,u_overlay:0,u_overlay_scale:u}),Uu=_=>({u_matrix:_}),id=(_,i,u,d)=>({u_matrix:_,u_extrude_scale:xe(i,1,u),u_intensity:d});function rd(_,i){const u=Math.pow(2,i.canonical.z),d=i.canonical.y;return[new c.Y(0,d/u).toLngLat().lat,new c.Y(0,(d+1)/u).toLngLat().lat]}const qu=(_,i,u,d)=>{const m=_.transform;return{u_matrix:jl(_,i,u,d),u_ratio:1/xe(i,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},od=(_,i,u,d,m)=>c.e(qu(_,i,u,m),{u_image:0,u_image_height:d}),ga=(_,i,u,d,m)=>{const y=_.transform,w=jr(i,y);return{u_matrix:jl(_,i,u,m),u_texsize:i.imageAtlasTexture.size,u_ratio:1/xe(i,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[w,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Gu=(_,i,u,d,m,y)=>{const w=_.lineAtlas,I=jr(i,_.transform),C=u.layout.get("line-cap")==="round",P=w.getDash(d.from,C),D=w.getDash(d.to,C),k=P.width*m.fromScale,V=D.width*m.toScale;return c.e(qu(_,i,u,y),{u_patternscale_a:[I/k,-P.height/2],u_patternscale_b:[I/V,-D.height/2],u_sdfgamma:w.width/(256*Math.min(k,V)*_.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:D.y,u_mix:m.t})};function jr(_,i){return 1/xe(_,1,i.tileZoom)}function jl(_,i,u,d){return _.translatePosMatrix(d?d.posMatrix:i.tileID.posMatrix,i,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const ju=(_,i,u,d,m)=>{return{u_matrix:_,u_tl_parent:i,u_scale_parent:u,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(w=m.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=m.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Zl(m.paint.get("raster-hue-rotate"))};var y,w};function Zl(_){_*=Math.PI/180;const i=Math.sin(_),u=Math.cos(_);return[(2*u+1)/3,(-Math.sqrt(3)*i-u+1)/3,(Math.sqrt(3)*i-u+1)/3]}const Hl=(_,i,u,d,m,y,w,I,C,P)=>{const D=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:D.width/D.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:w,u_coord_matrix:I,u_is_text:+C,u_pitch_with_map:+d,u_texsize:P,u_texture:0}},Wl=(_,i,u,d,m,y,w,I,C,P,D)=>{const k=m.transform;return c.e(Hl(_,i,u,d,m,y,w,I,C,P),{u_gamma_scale:d?Math.cos(k._pitch)*k.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+D})},Xl=(_,i,u,d,m,y,w,I,C,P)=>c.e(Wl(_,i,u,d,m,y,w,I,!0,C,!0),{u_texsize_icon:P,u_texture_icon:1}),Bf=(_,i,u)=>({u_matrix:_,u_opacity:i,u_color:u}),Vf=(_,i,u,d,m,y)=>c.e(function(w,I,C,P){const D=C.imageManager.getPattern(w.from.toString()),k=C.imageManager.getPattern(w.to.toString()),{width:V,height:X}=C.imageManager.getPixelSize(),W=Math.pow(2,P.tileID.overscaledZ),J=P.tileSize*Math.pow(2,C.transform.tileZoom)/W,j=J*(P.tileID.canonical.x+P.tileID.wrap*W),nt=J*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:D.tl,u_pattern_br_a:D.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[V,X],u_mix:I.t,u_pattern_size_a:D.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/xe(P,1,C.transform.tileZoom),u_pixel_coord_upper:[j>>16,nt>>16],u_pixel_coord_lower:[65535&j,65535&nt]}}(d,y,u,m),{u_matrix:_,u_opacity:i}),sd={fillExtrusion:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_opacity:new c.aH(_,i.u_opacity)}),fillExtrusionPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_height_factor:new c.aH(_,i.u_height_factor),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade),u_opacity:new c.aH(_,i.u_opacity)}),fill:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),fillPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),fillOutline:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world)}),fillOutlinePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),circle:(_,i)=>({u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_scale_with_map:new c.aG(_,i.u_scale_with_map),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_matrix:new c.aI(_,i.u_matrix)}),collisionBox:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aH(_,i.u_pixels_to_tile_units),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_overscale_factor:new c.aH(_,i.u_overscale_factor)}),collisionCircle:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_inv_matrix:new c.aI(_,i.u_inv_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_viewport_size:new c.aL(_,i.u_viewport_size)}),debug:(_,i)=>({u_color:new c.aM(_,i.u_color),u_matrix:new c.aI(_,i.u_matrix),u_overlay:new c.aG(_,i.u_overlay),u_overlay_scale:new c.aH(_,i.u_overlay_scale)}),clippingMask:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),heatmap:(_,i)=>({u_extrude_scale:new c.aH(_,i.u_extrude_scale),u_intensity:new c.aH(_,i.u_intensity),u_matrix:new c.aI(_,i.u_matrix)}),heatmapTexture:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_color_ramp:new c.aG(_,i.u_color_ramp),u_opacity:new c.aH(_,i.u_opacity)}),hillshade:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_latrange:new c.aL(_,i.u_latrange),u_light:new c.aL(_,i.u_light),u_shadow:new c.aM(_,i.u_shadow),u_highlight:new c.aM(_,i.u_highlight),u_accent:new c.aM(_,i.u_accent)}),hillshadePrepare:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_dimension:new c.aL(_,i.u_dimension),u_zoom:new c.aH(_,i.u_zoom),u_unpack:new c.aJ(_,i.u_unpack)}),line:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels)}),lineGradient:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_image:new c.aG(_,i.u_image),u_image_height:new c.aH(_,i.u_image_height)}),linePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texsize:new c.aL(_,i.u_texsize),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_image:new c.aG(_,i.u_image),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),lineSDF:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_patternscale_a:new c.aL(_,i.u_patternscale_a),u_patternscale_b:new c.aL(_,i.u_patternscale_b),u_sdfgamma:new c.aH(_,i.u_sdfgamma),u_image:new c.aG(_,i.u_image),u_tex_y_a:new c.aH(_,i.u_tex_y_a),u_tex_y_b:new c.aH(_,i.u_tex_y_b),u_mix:new c.aH(_,i.u_mix)}),raster:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_tl_parent:new c.aL(_,i.u_tl_parent),u_scale_parent:new c.aH(_,i.u_scale_parent),u_buffer_scale:new c.aH(_,i.u_buffer_scale),u_fade_t:new c.aH(_,i.u_fade_t),u_opacity:new c.aH(_,i.u_opacity),u_image0:new c.aG(_,i.u_image0),u_image1:new c.aG(_,i.u_image1),u_brightness_low:new c.aH(_,i.u_brightness_low),u_brightness_high:new c.aH(_,i.u_brightness_high),u_saturation_factor:new c.aH(_,i.u_saturation_factor),u_contrast_factor:new c.aH(_,i.u_contrast_factor),u_spin_weights:new c.aK(_,i.u_spin_weights)}),symbolIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture)}),symbolSDF:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),symbolTextAndIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texsize_icon:new c.aL(_,i.u_texsize_icon),u_texture:new c.aG(_,i.u_texture),u_texture_icon:new c.aG(_,i.u_texture_icon),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),background:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_color:new c.aM(_,i.u_color)}),backgroundPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_image:new c.aG(_,i.u_image),u_pattern_tl_a:new c.aL(_,i.u_pattern_tl_a),u_pattern_br_a:new c.aL(_,i.u_pattern_br_a),u_pattern_tl_b:new c.aL(_,i.u_pattern_tl_b),u_pattern_br_b:new c.aL(_,i.u_pattern_br_b),u_texsize:new c.aL(_,i.u_texsize),u_mix:new c.aH(_,i.u_mix),u_pattern_size_a:new c.aL(_,i.u_pattern_size_a),u_pattern_size_b:new c.aL(_,i.u_pattern_size_b),u_scale_a:new c.aH(_,i.u_scale_a),u_scale_b:new c.aH(_,i.u_scale_b),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aH(_,i.u_tile_units_to_pixels)}),terrain:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainDepth:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainCoords:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_terrain_coords_id:new c.aH(_,i.u_terrain_coords_id),u_ele_delta:new c.aH(_,i.u_ele_delta)})};class Uf{constructor(i,u,d){this.context=i;const m=i.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const _a={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Zu{constructor(i,u,d,m){this.length=u.length,this.attributes=d,this.itemSize=u.bytesPerElement,this.dynamicDraw=m,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,u){for(let d=0;d0){const zt=c.F(),Vt=xt;c.aP(zt,gt.placementInvProjMatrix,_.transform.glCoordMatrix),c.aP(zt,zt,gt.placementViewportMatrix),D.push({circleArray:Lt,circleOffset:V,transform:Vt,invTransform:zt,coord:st}),k+=Lt.length/4,V=k}Pt&&P.draw(I,C.LINES,We.disabled,Mn.disabled,_.colorModeForRenderPass(),Sn.disabled,ed(xt,_.transform,mt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(st),u.id,Pt.layoutVertexBuffer,Pt.indexBuffer,Pt.segments,null,_.transform.zoom,null,null,Pt.collisionVertexBuffer)}if(!w||!D.length)return;const X=_.useProgram("collisionCircle"),W=new c.aQ;W.resize(4*k),W._trim();let J=0;for(const Q of D)for(let st=0;st=0&&(W[j.associatedIconIndex]={shiftedAnchor:Te,angle:qt})}else Et(j.numGlyphs,V)}if(P){X.clear();const J=_.icon.placedSymbolArray;for(let j=0;j_.style.map.terrain.getElevation(Pt,ho,yi):null,jn=u.layout.get("text-rotation-alignment")==="map";F(zt,Pt.posMatrix,_,m,Hr,Qo,j,P,jn,_i)}const Js=_.translatePosMatrix(Pt.posMatrix,Lt,y,w),$o=nt||m&>||lu?Eh:Hr,gi=_.translatePosMatrix(Qo,Lt,y,w,!0),Gn=qt&&u.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zn;zn=qt?zt.iconsInText?Xl(he.kind,_e,ft,j,_,Js,$o,gi,Ne,Si):Wl(he.kind,_e,ft,j,_,Js,$o,gi,m,Ne,!0):Hl(he.kind,_e,ft,j,_,Js,$o,gi,m,Ne);const co={program:Xe,buffers:Vt,uniformValues:zn,atlasTexture:Jn,atlasTextureIcon:qn,atlasInterpolation:_n,atlasInterpolationIcon:Zr,isSDF:qt,hasHalo:Gn};if(Q&&zt.canOverlap){st=!0;const _i=Vt.segments.get();for(const jn of _i)xt.push({segments:new c.$([jn]),sortKey:jn.sortKey,state:co,terrainData:De})}else xt.push({segments:Vt.segments,sortKey:0,state:co,terrainData:De})}st&&xt.sort((Pt,Lt)=>Pt.sortKey-Lt.sortKey);for(const Pt of xt){const Lt=Pt.state;if(V.activeTexture.set(X.TEXTURE0),Lt.atlasTexture.bind(Lt.atlasInterpolation,X.CLAMP_TO_EDGE),Lt.atlasTextureIcon&&(V.activeTexture.set(X.TEXTURE1),Lt.atlasTextureIcon&&Lt.atlasTextureIcon.bind(Lt.atlasInterpolationIcon,X.CLAMP_TO_EDGE)),Lt.isSDF){const zt=Lt.uniformValues;Lt.hasHalo&&(zt.u_is_halo=1,md(Lt.buffers,Pt.segments,u,_,Lt.program,mt,D,k,zt,Pt.terrainData)),zt.u_is_halo=0}md(Lt.buffers,Pt.segments,u,_,Lt.program,mt,D,k,Lt.uniformValues,Pt.terrainData)}}function md(_,i,u,d,m,y,w,I,C,P){const D=d.context;m.draw(D,D.gl.TRIANGLES,y,w,I,Sn.disabled,C,P,u.id,_.layoutVertexBuffer,_.indexBuffer,i,u.paint,d.transform.zoom,_.programConfigurations.get(u.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function nc(_,i,u,d,m){if(!u||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let w=y[u.to.toString()],I=y[u.from.toString()];if(!w&&I&&(w=I),!I&&w&&(I=w),!w||!I){const C=m.getPaintProperty(i);w=y[C],I=y[C]}w&&I&&_.setConstantPatternPositions(w,I)}function gd(_,i,u,d,m,y,w){const I=_.context.gl,C="fill-pattern",P=u.paint.get(C),D=P&&P.constantOr(1),k=u.getCrossfadeParameters();let V,X,W,J,j;w?(X=D&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",V=I.LINES):(X=D?"fillPattern":"fill",V=I.TRIANGLES);const nt=P.constantOr(null);for(const ft of d){const Q=i.getTile(ft);if(D&&!Q.patternsLoaded())continue;const st=Q.getBucket(u);if(!st)continue;const mt=st.programConfigurations.get(u.id),gt=_.useProgram(X,mt),xt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ft);D&&(_.context.activeTexture.set(I.TEXTURE0),Q.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),mt.updatePaintBuffers(k)),nc(mt,C,nt,Q,u);const Pt=xt?ft:null,Lt=_.translatePosMatrix(Pt?Pt.posMatrix:ft.posMatrix,Q,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(w){J=st.indexBuffer2,j=st.segments2;const zt=[I.drawingBufferWidth,I.drawingBufferHeight];W=X==="fillOutlinePattern"&&D?td(Lt,_,k,Q,zt):Of(Lt,zt)}else J=st.indexBuffer,j=st.segments,W=D?Vu(Lt,_,k,Q):$p(Lt);gt.draw(_.context,V,m,_.stencilModeForClipping(ft),y,Sn.disabled,W,xt,u.id,st.layoutVertexBuffer,J,j,u.paint,_.transform.zoom,mt)}}function ic(_,i,u,d,m,y,w){const I=_.context,C=I.gl,P="fill-extrusion-pattern",D=u.paint.get(P),k=D.constantOr(1),V=u.getCrossfadeParameters(),X=u.paint.get("fill-extrusion-opacity"),W=D.constantOr(null);for(const J of d){const j=i.getTile(J),nt=j.getBucket(u);if(!nt)continue;const ft=_.style.map.terrain&&_.style.map.terrain.getTerrainData(J),Q=nt.programConfigurations.get(u.id),st=_.useProgram(k?"fillExtrusionPattern":"fillExtrusion",Q);k&&(_.context.activeTexture.set(C.TEXTURE0),j.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Q.updatePaintBuffers(V)),nc(Q,P,W,j,u);const mt=_.translatePosMatrix(J.posMatrix,j,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),gt=u.paint.get("fill-extrusion-vertical-gradient"),xt=k?zf(mt,_,gt,X,J,V,j):Gl(mt,_,gt,X);st.draw(I,I.gl.TRIANGLES,m,y,w,Sn.backCCW,xt,ft,u.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,u.paint,_.transform.zoom,Q,_.style.map.terrain&&nt.centroidVertexBuffer)}}function rc(_,i,u,d,m,y,w){const I=_.context,C=I.gl,P=u.fbo;if(!P)return;const D=_.useProgram("hillshade"),k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(i);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,P.colorAttachment.get()),D.draw(I,C.TRIANGLES,m,y,w,Sn.disabled,((V,X,W,J)=>{const j=W.paint.get("hillshade-shadow-color"),nt=W.paint.get("hillshade-highlight-color"),ft=W.paint.get("hillshade-accent-color");let Q=W.paint.get("hillshade-illumination-direction")*(Math.PI/180);W.paint.get("hillshade-illumination-anchor")==="viewport"&&(Q-=V.transform.angle);const st=!V.options.moving;return{u_matrix:J?J.posMatrix:V.transform.calculatePosMatrix(X.tileID.toUnwrapped(),st),u_image:0,u_latrange:rd(0,X.tileID),u_light:[W.paint.get("hillshade-exaggeration"),Q],u_shadow:j,u_highlight:nt,u_accent:ft}})(_,u,d,k?i:null),k,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function Sh(_,i,u,d,m,y){const w=_.context,I=w.gl,C=i.dem;if(C&&C.data){const P=C.dim,D=C.stride,k=C.getPixels();if(w.activeTexture.set(I.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||_.getTileTexture(D),i.demTexture){const X=i.demTexture;X.update(k,{premultiply:!1}),X.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else i.demTexture=new Nt(w,k,I.RGBA,{premultiply:!1}),i.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);w.activeTexture.set(I.TEXTURE0);let V=i.fbo;if(!V){const X=new Nt(w,{width:P,height:P,data:null},I.RGBA);X.bind(I.LINEAR,I.CLAMP_TO_EDGE),V=i.fbo=w.createFramebuffer(P,P,!0,!1),V.colorAttachment.set(X.texture)}w.bindFramebuffer.set(V.framebuffer),w.viewport.set([0,0,P,P]),_.useProgram("hillshadePrepare").draw(w,I.TRIANGLES,d,m,y,Sn.disabled,((X,W)=>{const J=W.stride,j=c.F();return c.aN(j,0,c.W,-c.W,0,0,1),c.H(j,j,[0,-c.W,0]),{u_matrix:j,u_image:1,u_dimension:[J,J],u_zoom:X.overscaledZ,u_unpack:W.getUnpackVector()}})(i.tileID,C),null,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function _d(_,i,u,d,m,y){const w=d.paint.get("raster-fade-duration");if(!y&&w>0){const I=N.now(),C=(I-_.timeAdded)/w,P=i?(I-i.timeAdded)/w:-1,D=u.getSource(),k=m.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),V=!i||Math.abs(i.tileID.overscaledZ-k)>Math.abs(_.tileID.overscaledZ-k),X=V&&_.refreshedUponExpiration?1:c.ac(V?C:1-P,0,1);return _.refreshedUponExpiration&&C>=1&&(_.refreshedUponExpiration=!1),i?{opacity:1,mix:1-X}:{opacity:X,mix:0}}return{opacity:1,mix:0}}const yd=new c.aO(1,0,0,1),oc=new c.aO(0,1,0,1),Ch=new c.aO(0,0,1,1),Kf=new c.aO(1,0,1,1),vd=new c.aO(0,1,1,1);function Yn(_,i,u,d){fr(_,0,i+u/2,_.transform.width,u,d)}function Hs(_,i,u,d){fr(_,i-u/2,0,u,_.transform.height,d)}function fr(_,i,u,d,m,y){const w=_.context,I=w.gl;I.enable(I.SCISSOR_TEST),I.scissor(i*_.pixelRatio,u*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),w.clear({color:y}),I.disable(I.SCISSOR_TEST)}function Th(_,i,u){const d=_.context,m=d.gl,y=u.posMatrix,w=_.useProgram("debug"),I=We.disabled,C=Mn.disabled,P=_.colorModeForRenderPass(),D="$debug",k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(u);d.activeTexture.set(m.TEXTURE0);const V=i.getTileByID(u.key).latestRawTileData,X=Math.floor((V&&V.byteLength||0)/1024),W=i.getTile(u).tileSize,J=512/Math.min(W,512)*(u.overscaledZ/_.transform.zoom)*.5;let j=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(j+=` => ${u.overscaledZ}`),function(nt,ft){nt.initDebugOverlayCanvas();const Q=nt.debugOverlayCanvas,st=nt.context.gl,mt=nt.debugOverlayCanvas.getContext("2d");mt.clearRect(0,0,Q.width,Q.height),mt.shadowColor="white",mt.shadowBlur=2,mt.lineWidth=1.5,mt.strokeStyle="white",mt.textBaseline="top",mt.font="bold 36px Open Sans, sans-serif",mt.fillText(ft,5,5),mt.strokeText(ft,5,5),nt.debugOverlayTexture.update(Q),nt.debugOverlayTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE)}(_,`${j} ${X}kB`),w.draw(d,m.TRIANGLES,I,C,ai.alphaBlended,Sn.disabled,nd(y,c.aO.transparent,J),null,D,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),w.draw(d,m.LINE_STRIP,I,C,P,Sn.disabled,nd(y,c.aO.red),k,D,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function sc(_,i,u){const d=_.context,m=d.gl,y=_.colorModeForRenderPass(),w=new We(m.LEQUAL,We.ReadWrite,_.depthRangeFor3D),I=_.useProgram("terrain"),C=i.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const P of u){const D=_.renderToTexture.getTexture(P),k=i.getTerrainData(P.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D.texture);const V={u_matrix:_.transform.calculatePosMatrix(P.tileID.toUnwrapped()),u_texture:0,u_ele_delta:i.getMeshFrameDelta(_.transform.zoom)};I.draw(d,m.TRIANGLES,w,Mn.disabled,y,Sn.backCCW,V,k,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class xd{constructor(i,u){this.context=new Yf(i),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qi.maxUnderzooming+Qi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new js}resize(i,u,d){if(this.width=Math.floor(i*d),this.height=Math.floor(u*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const i=this.context,u=new c.aV;u.emplaceBack(0,0),u.emplaceBack(c.W,0),u.emplaceBack(0,c.W),u.emplaceBack(c.W,c.W),this.tileExtentBuffer=i.createVertexBuffer(u,Ou.members),this.tileExtentSegments=c.$.simpleSegment(0,0,4,2);const d=new c.aV;d.emplaceBack(0,0),d.emplaceBack(c.W,0),d.emplaceBack(0,c.W),d.emplaceBack(c.W,c.W),this.debugBuffer=i.createVertexBuffer(d,Ou.members),this.debugSegments=c.$.simpleSegment(0,0,4,5);const m=new c.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(c.W,0,c.W,0),m.emplaceBack(0,c.W,0,c.W),m.emplaceBack(c.W,c.W,c.W,c.W),this.rasterBoundsBuffer=i.createVertexBuffer(m,Ve.members),this.rasterBoundsSegments=c.$.simpleSegment(0,0,4,2);const y=new c.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(y,Ou.members),this.viewportSegments=c.$.simpleSegment(0,0,4,2);const w=new c.aW;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(w);const I=new c.aX;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(I);const C=this.context.gl;this.stencilClearMode=new Mn({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const i=this.context,u=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=c.F();c.aN(d,0,this.width,this.height,0,0,1),c.J(d,d,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,u.TRIANGLES,We.disabled,this.stencilClearMode,ai.disabled,Sn.disabled,Uu(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,u){if(this.currentStencilSource===i.source||!i.isTileClipped()||!u||!u.length)return;this.currentStencilSource=i.source;const d=this.context,m=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(ai.disabled),d.setDepthMode(We.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of u){const I=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(d,m.TRIANGLES,We.disabled,new Mn({func:m.ALWAYS,mask:0},I,255,m.KEEP,m.KEEP,m.REPLACE),ai.disabled,Sn.disabled,Uu(w.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,u=this.context.gl;return new Mn({func:u.NOTEQUAL,mask:255},i,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(i){const u=this.context.gl;return new Mn({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(i){const u=this.context.gl,d=i.sort((w,I)=>I.overscaledZ-w.overscaledZ),m=d[d.length-1].overscaledZ,y=d[0].overscaledZ-m+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let I=0;I=0;this.currentLayer--){const C=this.style._layers[d[this.currentLayer]],P=m[C.source],D=y[C.source];this._renderTileClippingMasks(C,D),this.renderLayer(this,P,C,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerj.source&&!j.isHidden(D)?[P.sourceCaches[j.source]]:[]),X=V.filter(j=>j.getSource().type==="vector"),W=V.filter(j=>j.getSource().type!=="vector"),J=j=>{(!k||k.getSource().maxzoomJ(j)),k||W.forEach(j=>J(j)),k}(this.style,this.transform.zoom);C&&function(P,D,k){for(let V=0;V0),m&&(c.a_(u,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(y,w){const I=y.context,C=I.gl,P=ai.unblended,D=new We(C.LEQUAL,We.ReadWrite,[0,1]),k=w.getTerrainMesh(),V=w.sourceCache.getRenderableTiles(),X=y.useProgram("terrainDepth");I.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1});for(const W of V){const J=w.getTerrainData(W.tileID),j={u_matrix:y.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};X.draw(I,C.TRIANGLES,D,Mn.disabled,P,Sn.backCCW,j,J,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain),function(y,w){const I=y.context,C=I.gl,P=ai.unblended,D=new We(C.LEQUAL,We.ReadWrite,[0,1]),k=w.getTerrainMesh(),V=w.getCoordsTexture(),X=w.sourceCache.getRenderableTiles(),W=y.useProgram("terrainCoords");I.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1}),w.coordsIndex=[];for(const J of X){const j=w.getTerrainData(J.tileID);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,V.texture);const nt={u_matrix:y.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};W.draw(I,C.TRIANGLES,D,Mn.disabled,P,Sn.backCCW,nt,j,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),w.coordsIndex.push(J.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain))}renderLayer(i,u,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(y,w,I,C,P){if(y.renderPass!=="translucent")return;const D=Mn.disabled,k=y.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,X,W,J,j,nt,ft){const Q=X.transform,st=j==="map",mt=nt==="map";for(const gt of V){const xt=J.getTile(gt),Pt=xt.getBucket(W);if(!Pt||!Pt.text||!Pt.text.segments.get().length)continue;const Lt=c.ag(Pt.textSizeData,Q.zoom),zt=xe(xt,1,X.transform.zoom),Vt=Se(gt.posMatrix,mt,st,X.transform,zt),Te=W.layout.get("icon-text-fit")!=="none"&&Pt.hasIconData();if(Lt){const qt=Math.pow(2,Q.zoom-xt.tileID.overscaledZ);$u(Pt,st,mt,ft,Q,Vt,gt.posMatrix,qt,Lt,Te,X.style.map.terrain?(he,Le)=>X.style.map.terrain.getElevation(gt,he,Le):null)}}}(C,y,I,w,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),P),I.paint.get("icon-opacity").constantOr(1)!==0&&ec(y,w,I,C,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),D,k),I.paint.get("text-opacity").constantOr(1)!==0&&ec(y,w,I,C,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),D,k),w.map.showCollisionBoxes&&(Qu(y,w,I,C,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),!0),Qu(y,w,I,C,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),!1))})(i,u,d,m,this.style.placement.variableOffsets);break;case"circle":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("circle-opacity"),D=I.paint.get("circle-stroke-width"),k=I.paint.get("circle-stroke-opacity"),V=!I.layout.get("circle-sort-key").isConstant();if(P.constantOr(1)===0&&(D.constantOr(1)===0||k.constantOr(1)===0))return;const X=y.context,W=X.gl,J=y.depthModeForSublayer(0,We.ReadOnly),j=Mn.disabled,nt=y.colorModeForRenderPass(),ft=[];for(let Q=0;QQ.sortKey-st.sortKey);for(const Q of ft){const{programConfiguration:st,program:mt,layoutVertexBuffer:gt,indexBuffer:xt,uniformValues:Pt,terrainData:Lt}=Q.state;mt.draw(X,W.TRIANGLES,J,j,nt,Sn.disabled,Pt,Lt,I.id,gt,xt,Q.segments,I.paint,y.transform.zoom,st)}})(i,u,d,m);break;case"heatmap":(function(y,w,I,C){if(I.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const P=y.context,D=P.gl,k=Mn.disabled,V=new ai([D.ONE,D.ONE],c.aO.transparent,[!0,!0,!0,!0]);(function(X,W,J){const j=X.gl;X.activeTexture.set(j.TEXTURE1),X.viewport.set([0,0,W.width/4,W.height/4]);let nt=J.heatmapFbo;if(nt)j.bindTexture(j.TEXTURE_2D,nt.colorAttachment.get()),X.bindFramebuffer.set(nt.framebuffer);else{const ft=j.createTexture();j.bindTexture(j.TEXTURE_2D,ft),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),nt=J.heatmapFbo=X.createFramebuffer(W.width/4,W.height/4,!1,!1),function(Q,st,mt,gt){var xt,Pt;const Lt=Q.gl,zt=(xt=Q.HALF_FLOAT)!==null&&xt!==void 0?xt:Lt.UNSIGNED_BYTE,Vt=(Pt=Q.RGBA16F)!==null&&Pt!==void 0?Pt:Lt.RGBA;Lt.texImage2D(Lt.TEXTURE_2D,0,Vt,st.width/4,st.height/4,0,Lt.RGBA,zt,null),gt.colorAttachment.set(mt)}(X,W,ft,nt)}})(P,y,I),P.clear({color:c.aO.transparent});for(let X=0;X{const Q=c.F();c.aN(Q,0,J.width,J.height,0,0,1);const st=J.context.gl;return{u_matrix:Q,u_world:[st.drawingBufferWidth,st.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(P,D),null,D.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,D.paint,P.transform.zoom)}(y,I))})(i,u,d,m);break;case"line":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("line-opacity"),D=I.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const k=y.depthModeForSublayer(0,We.ReadOnly),V=y.colorModeForRenderPass(),X=I.paint.get("line-dasharray"),W=I.paint.get("line-pattern"),J=W.constantOr(1),j=I.paint.get("line-gradient"),nt=I.getCrossfadeParameters(),ft=J?"linePattern":X?"lineSDF":j?"lineGradient":"line",Q=y.context,st=Q.gl;let mt=!0;for(const gt of C){const xt=w.getTile(gt);if(J&&!xt.patternsLoaded())continue;const Pt=xt.getBucket(I);if(!Pt)continue;const Lt=Pt.programConfigurations.get(I.id),zt=y.context.program.get(),Vt=y.useProgram(ft,Lt),Te=mt||Vt.program!==zt,qt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(gt),he=W.constantOr(null);if(he&&xt.imageAtlas){const _e=xt.imageAtlas,De=_e.patternPositions[he.to.toString()],Ne=_e.patternPositions[he.from.toString()];De&&Ne&&Lt.setConstantPatternPositions(De,Ne)}const Le=qt?gt:null,Xe=J?ga(y,xt,I,nt,Le):X?Gu(y,xt,I,X,nt,Le):j?od(y,xt,I,Pt.lineClipsArray.length,Le):qu(y,xt,I,Le);if(J)Q.activeTexture.set(st.TEXTURE0),xt.imageAtlasTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE),Lt.updatePaintBuffers(nt);else if(X&&(Te||y.lineAtlas.dirty))Q.activeTexture.set(st.TEXTURE0),y.lineAtlas.bind(Q);else if(j){const _e=Pt.gradients[I.id];let De=_e.texture;if(I.gradientVersion!==_e.version){let Ne=256;if(I.stepInterpolant){const Jn=w.getSource().maxzoom,_n=gt.canonical.z===Jn?Math.ceil(1<0?u.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const u=this.imageManager.getPattern(i.from.toString()),d=this.imageManager.getPattern(i.to.toString());return!u||!d}useProgram(i,u){this.cache=this.cache||{};const d=i+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Zs(this.context,ql[i],u,sd[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:u}=this.context.gl;return this.width!==i||this.height!==u}}class Ws{constructor(i,u){this.points=i,this.planes=u}static fromInvProjectionMatrix(i,u,d){const m=Math.pow(2,d),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const C=1/(I=c.af([],I,i))[3]/u*m;return c.a$(I,I,[C,C,1/I[3],C])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const C=function(V,X){var W=X[0],J=X[1],j=X[2],nt=W*W+J*J+j*j;return nt>0&&(nt=1/Math.sqrt(nt)),V[0]=X[0]*nt,V[1]=X[1]*nt,V[2]=X[2]*nt,V}([],function(V,X,W){var J=X[0],j=X[1],nt=X[2],ft=W[0],Q=W[1],st=W[2];return V[0]=j*st-nt*Q,V[1]=nt*ft-J*st,V[2]=J*Q-j*ft,V}([],Ee([],y[I[0]],y[I[1]]),Ee([],y[I[2]],y[I[1]]))),P=-((D=C)[0]*(k=y[I[1]])[0]+D[1]*k[1]+D[2]*k[2]);var D,k;return C.concat(P)});return new Ws(y,w)}}class Xs{constructor(i,u){this.min=i,this.max=u,this.center=function(d,m,y){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,y){return d[0]=m[0]+y[0],d[1]=m[1]+y[1],d[2]=m[2]+y[2],d}([],this.min,this.max))}quadrant(i){const u=[i%2==0,i<2],d=Fe(this.min),m=Fe(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==u.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let I=0;Ithis.max[m]-this.min[m])return 0}return 1}}class tl{constructor(i=0,u=0,d=0,m=0){if(isNaN(i)||i<0||isNaN(u)||u<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=u,this.left=d,this.right=m}interpolate(i,u,d){return u.top!=null&&i.top!=null&&(this.top=c.z.number(i.top,u.top,d)),u.bottom!=null&&i.bottom!=null&&(this.bottom=c.z.number(i.bottom,u.bottom,d)),u.left!=null&&i.left!=null&&(this.left=c.z.number(i.left,u.left,d)),u.right!=null&&i.right!=null&&(this.right=c.z.number(i.right,u.right,d)),this}getCenter(i,u){const d=c.ac((this.left+i-this.right)/2,0,i),m=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(d,m)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new tl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Lh=85.051129;class ac{constructor(i,u,d,m,y){this.tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=i||0,this._maxZoom=u||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tl,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new ac(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const u=-c.b1(i,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,y){var w=m[0],I=m[1],C=m[2],P=m[3],D=Math.sin(y),k=Math.cos(y);d[0]=w*k+C*D,d[1]=I*k+P*D,d[2]=w*-D+C*k,d[3]=I*-D+P*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const u=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const u=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,u,d){this._unmodified=!1,this._edgeInsets.interpolate(i,u,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const u=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(i){const u=[new c.b2(0,i)];if(this._renderWorldCopies){const d=this.pointCoordinate(new c.P(0,0)),m=this.pointCoordinate(new c.P(this.width,0)),y=this.pointCoordinate(new c.P(this.width,this.height)),w=this.pointCoordinate(new c.P(0,this.height)),I=Math.floor(Math.min(d.x,m.x,y.x,w.x)),C=Math.floor(Math.max(d.x,m.x,y.x,w.x)),P=1;for(let D=I-P;D<=C+P;D++)D!==0&&u.push(new c.b2(D,i))}return u}coveringTiles(i){var u,d;let m=this.coveringZoomLevel(i);const y=m;if(i.minzoom!==void 0&&mi.maxzoom&&(m=i.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),I=c.Y.fromLngLat(this.center),C=Math.pow(2,m),P=[C*w.x,C*w.y,0],D=[C*I.x,C*I.y,0],k=Ws.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let V=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(V=m);const X=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,W=Q=>({aabb:new Xs([Q*C,0,0],[(Q+1)*C,C,0]),zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),J=[],j=[],nt=m,ft=i.reparseOverscaled?y:m;if(this._renderWorldCopies)for(let Q=1;Q<=3;Q++)J.push(W(-Q)),J.push(W(Q));for(J.push(W(0));J.length>0;){const Q=J.pop(),st=Q.x,mt=Q.y;let gt=Q.fullyVisible;if(!gt){const Vt=Q.aabb.intersects(k);if(Vt===0)continue;gt=Vt===2}const xt=i.terrain?P:D,Pt=Q.aabb.distanceX(xt),Lt=Q.aabb.distanceY(xt),zt=Math.max(Math.abs(Pt),Math.abs(Lt));if(Q.zoom===nt||zt>X+(1<=V){const Vt=nt-Q.zoom,Te=P[0]-.5-(st<>1),he=Q.zoom+1;let Le=Q.aabb.quadrant(Vt);if(i.terrain){const Xe=new c.Q(he,Q.wrap,he,Te,qt),_e=i.terrain.getMinMaxElevation(Xe),De=(u=_e.minElevation)!==null&&u!==void 0?u:this.elevation,Ne=(d=_e.maxElevation)!==null&&d!==void 0?d:this.elevation;Le=new Xs([Le.min[0],Le.min[1],De],[Le.max[0],Le.max[1],Ne])}J.push({aabb:Le,zoom:he,x:Te,y:qt,wrap:Q.wrap,fullyVisible:gt})}}return j.sort((Q,st)=>Q.distanceSq-st.distanceSq).map(Q=>Q.tileID)}resize(i,u){this.width=i,this.height=u,this.pixelsToGLUnits=[2/i,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const u=c.ac(i.lat,-85.051129,Lh);return new c.P(c.N(i.lng)*this.worldSize,c.O(u)*this.worldSize)}unproject(i){return new c.Y(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){const u=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,i),y=i.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-y))return;const w=d+u-y,I=Math.cos(this._pitch)*this.cameraToCenterDistance/w/c.b3(1,m.lat),C=this.scaleZoom(I/this.tileSize);this._elevation=y,this._center=m,this.zoom=C}setLocationAtPoint(i,u){const d=this.pointCoordinate(u),m=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(i),w=new c.Y(y.x-(d.x-m.x),y.y-(d.y-m.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,u){return u?this.coordinatePoint(this.locationCoordinate(i),u.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,u){return this.coordinateLocation(this.pointCoordinate(i,u))}locationCoordinate(i){return c.Y.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,u){if(u){const V=u.pointCoordinate(i);if(V!=null)return V}const d=[i.x,i.y,0,1],m=[i.x,i.y,1,1];c.af(d,d,this.pixelMatrixInverse),c.af(m,m,this.pixelMatrixInverse);const y=d[3],w=m[3],I=d[1]/y,C=m[1]/w,P=d[2]/y,D=m[2]/w,k=P===D?0:(0-P)/(D-P);return new c.Y(c.z.number(d[0]/y,m[0]/w,k)/this.worldSize,c.z.number(I,C,k)/this.worldSize)}coordinatePoint(i,u=0,d=this.pixelMatrix){const m=[i.x*this.worldSize,i.y*this.worldSize,u,1];return c.af(m,m,d),new c.P(m[0]/m[3],m[1]/m[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new Ct().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ct([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Lh])}calculatePosMatrix(i,u=!1){const d=i.key,m=u?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const y=i.canonical,w=this.worldSize/this.zoomScale(y.z),I=y.x+Math.pow(2,y.z)*i.wrap,C=c.an(new Float64Array(16));return c.H(C,C,[I*w,y.y*w,0]),c.J(C,C,[w/c.W,w/c.W,1]),c.K(C,u?this.alignedProjMatrix:this.projMatrix,C),m[d]=new Float32Array(C),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,u){u=c.ac(+u,this.minZoom,this.maxZoom);const d={center:new c.M(i.lng,i.lat),zoom:u};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const Q=179.9999999999;m=[-Q,Q]}const y=this.tileSize*this.zoomScale(d.zoom);let w=0,I=y,C=0,P=y,D=0,k=0;const{x:V,y:X}=this.size;if(this.latRange){const Q=this.latRange;w=c.O(Q[1])*y,I=c.O(Q[0])*y,I-wI&&(nt=I-Q)}if(m){const Q=(C+P)/2;let st=W;this._renderWorldCopies&&(st=c.b1(W,Q-y/2,Q+y/2));const mt=V/2;st-mtP&&(j=P-mt)}if(j!==void 0||nt!==void 0){const Q=new c.P(j??W,nt??J);d.center=this.unproject.call({worldSize:y},Q).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:u,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=d,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,u=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b3(1,this.center.lat)*this.worldSize;let m=c.an(new Float64Array(16));c.J(m,m,[this.width/2,-this.height/2,1]),c.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=c.an(new Float64Array(16)),c.J(m,m,[1,-1,1]),c.H(m,m,[-1,-1,0]),c.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),I=y-w*this._pixelPerMeter/Math.cos(this._pitch),C=w<0?I:y,P=Math.PI/2+this._pitch,D=this._fov*(.5+i.y/this.height),k=Math.sin(D)*C/Math.sin(c.ac(Math.PI-P-D,.01,Math.PI-.01)),V=this.getHorizon(),X=2*Math.atan(V/this.cameraToCenterDistance)*(.5+i.y/(2*V)),W=Math.sin(X)*C/Math.sin(c.ac(Math.PI-P-X,.01,Math.PI-.01)),J=Math.min(k,W),j=1.01*(Math.cos(Math.PI/2-this._pitch)*J+C),nt=this.height/50;m=new Float64Array(16),c.b4(m,this._fov,this.width/this.height,nt,j),m[8]=2*-i.x/this.width,m[9]=2*i.y/this.height,c.J(m,m,[1,-1,1]),c.H(m,m,[0,0,-this.cameraToCenterDistance]),c.b5(m,m,this._pitch),c.ad(m,m,this.angle),c.H(m,m,[-u,-d,0]),this.mercatorMatrix=c.J([],m,[this.worldSize,this.worldSize,this.worldSize]),c.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.K(new Float64Array(16),this.labelPlaneMatrix,m),c.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=c.ar([],m),this.pixelMatrix3D=c.K(new Float64Array(16),this.labelPlaneMatrix,m);const ft=this.width%2/2,Q=this.height%2/2,st=Math.cos(this.angle),mt=Math.sin(this.angle),gt=u-Math.round(u)+st*ft+mt*Q,xt=d-Math.round(d)+st*Q+mt*ft,Pt=new Float64Array(m);if(c.H(Pt,Pt,[gt>.5?gt-1:gt,xt>.5?xt-1:xt,0]),this.alignedProjMatrix=Pt,m=c.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),u=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const u=this.getCameraPoint();if(i.length===1)return[i[0],u];{let d=u.x,m=u.y,y=u.x,w=u.y;for(const I of i)d=Math.min(d,I.x),m=Math.min(m,I.y),y=Math.max(y,I.x),w=Math.max(w,I.y);return[new c.P(d,m),new c.P(y,m),new c.P(y,w),new c.P(d,w),new c.P(d,m)]}}lngLatToCameraDepth(i,u){const d=this.locationCoordinate(i),m=[d.x*this.worldSize,d.y*this.worldSize,u,1];return c.af(m,m,this.projMatrix),m[2]/m[3]}}function Ph(_,i){let u,d=!1,m=null,y=null;const w=()=>{m=null,d&&(_.apply(y,u),m=setTimeout(w,i),d=!1)};return(...I)=>(d=!0,y=this,u=I,m||w(),m)}class Ah{constructor(i){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let d;return u.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:d,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,u)}catch{}},this._updateHash=Ph(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){const u=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,m),w=Math.round(u.lng*y)/y,I=Math.round(u.lat*y)/y,C=this._map.getBearing(),P=this._map.getPitch();let D="";if(D+=i?`/${w}/${I}/${d}`:`${d}/${I}/${w}`,(C||P)&&(D+="/"+Math.round(10*C)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){const k=this._hashName;let V=!1;const X=window.location.hash.slice(1).split("&").map(W=>{const J=W.split("=")[0];return J===k?(V=!0,`${J}=${D}`):W}).filter(W=>W);return V||X.push(`${k}=${D}`),`#${X.join("&")}`}return`#${D}`}}const Kl={linearity:.3,easing:c.b6(0,0,.3,1)},xa=c.e({deceleration:2500,maxSpeed:1400},Kl),bd=c.e({deceleration:20,maxSpeed:1400},Kl),wd=c.e({deceleration:1e3,maxSpeed:360},Kl),Id=c.e({deceleration:1e3,maxSpeed:90},Kl);class Ed{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:N.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,u=N.now();for(;i.length>0&&u-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)u.zoom+=y.zoomDelta||0,u.bearing+=y.bearingDelta||0,u.pitch+=y.pitchDelta||0,y.panDelta&&u.pan._add(y.panDelta),y.around&&(u.around=y.around),y.pinchAround&&(u.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(u.pan.mag()){const y=Ql(u.pan.mag(),d,c.e({},xa,i||{}));m.offset=u.pan.mult(y.amount/u.pan.mag()),m.center=this._map.transform.center,Jl(m,y)}if(u.zoom){const y=Ql(u.zoom,d,bd);m.zoom=this._map.transform.zoom+y.amount,Jl(m,y)}if(u.bearing){const y=Ql(u.bearing,d,wd);m.bearing=this._map.transform.bearing+c.ac(y.amount,-179,179),Jl(m,y)}if(u.pitch){const y=Ql(u.pitch,d,Id);m.pitch=this._map.transform.pitch+y.amount,Jl(m,y)}if(m.zoom||m.bearing){const y=u.pinchAround===void 0?u.around:u.pinchAround;m.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),c.e(m,{noMoveStart:!0})}}function Jl(_,i){(!_.duration||_.durationu.unproject(C)),I=y.reduce((C,P,D,k)=>C.add(P.div(k.length)),new c.P(0,0));super(i,{points:y,point:I,lngLats:w,lngLat:u.unproject(I),originalEvent:d}),this._defaultPrevented=!1}}class Mh extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,d){super(i,{originalEvent:d}),this._defaultPrevented=!1}}class wo{constructor(i,u){this._map=i,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Mh(i.type,this._map,i))}mousedown(i,u){return this._mousedownPos=u,this._firePreventable(new Pr(i.type,this._map,i))}mouseup(i){this._map.fire(new Pr(i.type,this._map,i))}click(i,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Pr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Pr(i.type,this._map,i))}mouseover(i){this._map.fire(new Pr(i.type,this._map,i))}mouseout(i){this._map.fire(new Pr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Yo(i.type,this._map,i))}touchmove(i){this._map.fire(new Yo(i.type,this._map,i))}touchend(i){this._map.fire(new Yo(i.type,this._map,i))}touchcancel(i){this._map.fire(new Yo(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ko{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Pr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Pr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class el{constructor(i){this._map=i}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class Io{constructor(i,u){this._map=i,this._tr=new el(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,u){this.isEnabled()&&i.shiftKey&&i.button===0&&(U.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(i,u){if(!this._active)return;const d=u;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,u){return this._map.fire(new c.k(i,{originalEvent:u}))}}function ba(_,i){if(_.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${i.length}`);const u={};for(let d=0;d<_.length;d++)u[_[d].identifier]=i[d];return u}class Jf{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,u,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const y=new c.P(0,0);for(const w of m)y._add(w);return y.div(m.length)}(u),this.touches=ba(d,u)))}touchmove(i,u,d){if(this.aborted||!this.centroid)return;const m=ba(d,u);for(const y in this.touches){const w=m[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(i,u,d){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class Dh{constructor(i){this.singleTap=new Jf(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,u,d){this.singleTap.touchstart(i,u,d)}touchmove(i,u,d){this.singleTap.touchmove(i,u,d)}touchend(i,u,d){const m=this.singleTap.touchend(i,u,d);if(m){const y=i.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(m)<30;if(y&&w||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Qf{constructor(i){this._tr=new el(i),this._zoomIn=new Dh({numTouches:1,numTaps:2}),this._zoomOut=new Dh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,u,d){this._zoomIn.touchstart(i,u,d),this._zoomOut.touchstart(i,u,d)}touchmove(i,u,d){this._zoomIn.touchmove(i,u,d),this._zoomOut.touchmove(i,u,d)}touchend(i,u,d){const m=this._zoomIn.touchend(i,u,d),y=this._zoomOut.touchend(i,u,d),w=this._tr;return m?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(m)},{originalEvent:i})}):y?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nl{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const u=this._moveFunction(...i);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(i,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,u){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const m=u.length?u[0]:u;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(i){i.preventDefault()}},il=({enable:_,clickTolerance:i,bearingDegreesPerPixelMoved:u=.8})=>{const d=new Jo({checkCorrectEvent:m=>U.mouseButton(m)===0&&m.ctrlKey||U.mouseButton(m)===2});return new nl({clickTolerance:i,move:(m,y)=>({bearingDelta:(y.x-m.x)*u}),moveStateManager:d,enable:_,assignEvents:lc})},rl=({enable:_,clickTolerance:i,pitchDegreesPerPixelMoved:u=-.5})=>{const d=new Jo({checkCorrectEvent:m=>U.mouseButton(m)===0&&m.ctrlKey||U.mouseButton(m)===2});return new nl({clickTolerance:i,move:(m,y)=>({pitchDelta:(y.y-m.y)*u}),moveStateManager:d,enable:_,assignEvents:lc})};class Sd{constructor(i,u){this._clickTolerance=i.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(i,u,d){return this._calculateTransform(i,u,d)}touchmove(i,u,d){if(this._active&&!(d.length0&&(this._active=!0);const m=ba(d,u),y=new c.P(0,0),w=new c.P(0,0);let I=0;for(const P in m){const D=m[P],k=this._touches[P];k&&(y._add(D),w._add(D.sub(k)),I++,m[P]=D)}if(this._touches=m,IMath.abs(_.x)}class Ld extends Wt{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,u,d){super.touchstart(i,u,d),this._currentTouchCount=d.length}_start(i){this._lastPoints=i,cc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,u,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=i[0].sub(this._lastPoints[0]),y=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,y,d.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(m.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(i,u,d){if(this._valid!==void 0)return this._valid;const m=i.mag()>=2,y=u.mag()>=2;if(!m&&!y)return;if(!m||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const w=i.y>0==u.y>0;return cc(i)&&cc(u)&&w}}const $f={panStep:100,bearingStep:15,pitchStep:10};class Ys{constructor(i){this._tr=new el(i);const u=$f;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let u=0,d=0,m=0,y=0,w=0;switch(i.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:i.shiftKey?d=-1:(i.preventDefault(),y=-1);break;case 39:i.shiftKey?d=1:(i.preventDefault(),y=1);break;case 38:i.shiftKey?m=1:(i.preventDefault(),w=-1);break;case 40:i.shiftKey?m=-1:(i.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:I=>{const C=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:kn,zoom:u?Math.round(C.zoom)+u*(i.shiftKey?2:1):C.zoom,bearing:C.bearing+d*this._bearingStep,pitch:C.pitch+m*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:C.center},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function kn(_){return _*(2-_)}const tu=4.000244140625;class hc{constructor(i,u){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=i,this._tr=new el(i),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!i[this._map.cooperativeGestures._bypassKey])return;let u=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const d=N.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,u!==0&&u%tu==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(m*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),i.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=i,this._delta-=u,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=U.mousePos(this._map.getCanvas(),i),d=this._tr;this._around=u.y>d.transform.height/2-d.transform.getHorizon()?c.M.convert(this._aroundCenter?d.center:d.unproject(u)):c.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const I=this._type==="wheel"&&Math.abs(this._delta)>tu?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*I)));this._delta<0&&C!==0&&(C=1/C);const P=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(P*C))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,d=this._startZoom,m=this._easing;let y,w=!1;if(this._type==="wheel"&&d&&m){const I=Math.min((N.now()-this._lastWheelEventTime)/200,1),C=m(I);y=c.z.number(d,u,C),I<1?this._frameId||(this._frameId=!0):w=!0}else y=u,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let u=c.b7;if(this._prevEase){const d=this._prevEase,m=(N.now()-d.start)/d.duration,y=d.easing(m+.01)-d.easing(m),w=.27/Math.sqrt(y*y+1e-4)*.01,I=Math.sqrt(.0729-w*w);u=c.b6(w,I,.25,1)}return this._prevEase={start:N.now(),duration:i,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Nh{constructor(i,u){this._clickZoom=i,this._tapZoom=u}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Pd{constructor(i){this._tr=new el(i),this.reset()}reset(){this._active=!1}dblclick(i,u){return i.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ad{constructor(){this._tap=new Dh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(i,u,d){if(!this._swipePoint)if(this._tapTime){const m=u[0],y=i.timeStamp-this._tapTime<500,w=this._tapPoint.dist(m)<30;y&&w?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(i,u,d)}touchmove(i,u,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=u[0],y=m.y-this._swipePoint.y;return this._swipePoint=m,i.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(i,u,d)}touchend(i,u,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(i,u,d);m&&(this._tapTime=i.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Md{constructor(i,u,d){this._el=i,this._mousePan=u,this._touchPan=d}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Eo{constructor(i,u,d){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=u,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class eu{constructor(i,u,d,m){this._el=i,this._touchZoom=u,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ne{constructor(i,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",i);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=u,this._container.appendChild(m);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(U.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(i){this._onCooperativeGesture(i.touches.length===1)}wheel(i){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!i[this._bypassKey])}_onCooperativeGesture(i){this._enabled&&i&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ue=_=>_.zoom||_.drag||_.pitch||_.rotate;class pc extends c.k{}function nu(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class kh{constructor(i,u){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,y)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=m.type==="renderFrame"?void 0:m,I={needsRenderFrame:!1},C={},P={},D=m.touches,k=D?this._getMapTouches(D):void 0,V=k?U.touchPos(this._map.getCanvas(),k):U.mousePos(this._map.getCanvas(),m);for(const{handlerName:J,handler:j,allowed:nt}of this._handlers){if(!j.isEnabled())continue;let ft;this._blockedByActive(P,nt,J)?j.reset():j[y||m.type]&&(ft=j[y||m.type](m,V,k),this.mergeHandlerResult(I,C,ft,J,w),ft&&ft.needsRenderFrame&&this._triggerRenderFrame()),(ft||j.isActive())&&(P[J]=j)}const X={};for(const J in this._previousActiveHandlers)P[J]||(X[J]=w);this._previousActiveHandlers=P,(Object.keys(X).length||nu(I))&&(this._changes.push([I,C,X]),this._triggerRenderFrame()),(Object.keys(P).length||nu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:W}=I;W&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],W(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ed(i),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,y,w]of this._listeners)U.addEventListener(m,y,m===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[i,u,d]of this._listeners)U.removeEventListener(i,u,i===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(i){const u=this._map,d=u.getCanvasContainer();this._add("mapEvent",new wo(u,i));const m=u.boxZoom=new Io(u,i);this._add("boxZoom",m),i.interactive&&i.boxZoom&&m.enable();const y=u.cooperativeGestures=new ne(u,i.cooperativeGestures);this._add("cooperativeGestures",y),i.cooperativeGestures&&y.enable();const w=new Qf(u),I=new Pd(u);u.doubleClickZoom=new Nh(I,w),this._add("tapZoom",w),this._add("clickZoom",I),i.interactive&&i.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Ad;this._add("tapDragZoom",C);const P=u.touchPitch=new Ld(u);this._add("touchPitch",P),i.interactive&&i.touchPitch&&u.touchPitch.enable(i.touchPitch);const D=il(i),k=rl(i);u.dragRotate=new Eo(i,D,k),this._add("mouseRotate",D,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]),i.interactive&&i.dragRotate&&u.dragRotate.enable();const V=(({enable:ft,clickTolerance:Q})=>{const st=new Jo({checkCorrectEvent:mt=>U.mouseButton(mt)===0&&!mt.ctrlKey});return new nl({clickTolerance:Q,move:(mt,gt)=>({around:gt,panDelta:gt.sub(mt)}),activateOnStart:!0,moveStateManager:st,enable:ft,assignEvents:lc})})(i),X=new Sd(i,u);u.dragPan=new Md(d,V,X),this._add("mousePan",V),this._add("touchPan",X,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&u.dragPan.enable(i.dragPan);const W=new Rh,J=new Td;u.touchZoomRotate=new eu(d,J,W,C),this._add("touchRotate",W,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&u.touchZoomRotate.enable(i.touchZoomRotate);const j=u.scrollZoom=new hc(u,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),i.interactive&&i.scrollZoom&&u.scrollZoom.enable(i.scrollZoom);const nt=u.keyboard=new Ys(u);this._add("keyboard",nt),i.interactive&&i.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new Ko(u))}_add(i,u,d){this._handlers.push({handlerName:i,handler:u,allowed:d}),this._handlersById[i]=u}stop(i){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ue(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,u,d){for(const m in i)if(m!==d&&(!u||u.indexOf(m)<0))return!0;return!1}_getMapTouches(i){const u=[];for(const d of i)this._el.contains(d.target)&&u.push(d);return u}mergeHandlerResult(i,u,d,m,y){if(!d)return;c.e(i,d);const w={handlerName:m,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(u.zoom=w),d.panDelta!==void 0&&(u.drag=w),d.pitchDelta!==void 0&&(u.pitch=w),d.bearingDelta!==void 0&&(u.rotate=w)}_applyChanges(){const i={},u={},d={};for(const[m,y,w]of this._changes)m.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(m.panDelta)),m.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(i.around=m.around),m.pinchAround!==void 0&&(i.pinchAround=m.pinchAround),m.noInertia&&(i.noInertia=m.noInertia),c.e(u,y),c.e(d,w);this._updateMapTransform(i,u,d),this._changes=[]}_updateMapTransform(i,u,d){const m=this._map,y=m._getTransformForUpdate(),w=m.terrain;if(!(nu(i)||w&&this._terrainMovement))return this._fireEvents(u,d,!0);let{panDelta:I,zoomDelta:C,bearingDelta:P,pitchDelta:D,around:k,pinchAround:V}=i;V!==void 0&&(k=V),m._stop(!0),k=k||m.transform.centerPoint;const X=y.pointLocation(I?k.sub(I):k);P&&(y.bearing+=P),D&&(y.pitch+=D),C&&(y.zoom+=C),w?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(I)):y.setLocationAtPoint(X,k):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(X,k),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(m.terrain)})):y.setLocationAtPoint(X,k),m._applyUpdatedTransform(y),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(u,d,!0)}_fireEvents(i,u,d){const m=ue(this._eventsInProgress),y=ue(i),w={};for(const D in i){const{originalEvent:k}=i[D];this._eventsInProgress[D]||(w[`${D}start`]=k),this._eventsInProgress[D]=i[D]}!m&&y&&this._fireEvent("movestart",y.originalEvent);for(const D in w)this._fireEvent(D,w[D]);y&&this._fireEvent("move",y.originalEvent);for(const D in i){const{originalEvent:k}=i[D];this._fireEvent(D,k)}const I={};let C;for(const D in this._eventsInProgress){const{handlerName:k,originalEvent:V}=this._eventsInProgress[D];this._handlersById[k].isActive()||(delete this._eventsInProgress[D],C=u[k]||V,I[`${D}end`]=C)}for(const D in I)this._fireEvent(D,I[D]);const P=ue(this._eventsInProgress);if(d&&(m||y)&&!P){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=V=>V!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new pc("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ar extends c.E{constructor(i,u){super(),this._renderFrameCallback=()=>{const d=Math.min((N.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.M(this.transform.center.lng,this.transform.center.lat)}setCenter(i,u){return this.jumpTo({center:i},u)}panBy(i,u,d){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},u),d)}panTo(i,u,d){return this.easeTo(c.e({center:i},u),d)}getZoom(){return this.transform.zoom}setZoom(i,u){return this.jumpTo({zoom:i},u),this}zoomTo(i,u,d){return this.easeTo(c.e({zoom:i},u),d)}zoomIn(i,u){return this.zoomTo(this.getZoom()+1,i,u),this}zoomOut(i,u){return this.zoomTo(this.getZoom()-1,i,u),this}getBearing(){return this.transform.bearing}setBearing(i,u){return this.jumpTo({bearing:i},u),this}getPadding(){return this.transform.padding}setPadding(i,u){return this.jumpTo({padding:i},u),this}rotateTo(i,u,d){return this.easeTo(c.e({bearing:i},u),d)}resetNorth(i,u){return this.rotateTo(0,c.e({duration:1e3},i),u),this}resetNorthPitch(i,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),u),this}snapToNorth(i,u){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=c.z.number(y,j,xt)),this._rotating&&(m.bearing=c.z.number(w,P,xt)),this._pitching&&(m.pitch=c.z.number(I,D,xt)),this._padding&&(m.interpolatePadding(C,k,xt),X=m.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(xt),st)m.setLocationAtPoint(st,mt);else{const Pt=m.zoomScale(m.zoom-y),Lt=j>y?Math.min(2,Q):Math.max(.5,Q),zt=Math.pow(Lt,1-xt),Vt=m.unproject(nt.add(ft.mult(xt*zt)).mult(Pt));m.setLocationAtPoint(m.renderWorldCopies?Vt.wrap():Vt,X)}this._applyUpdatedTransform(m),this._fireMoveEvents(u)},xt=>{this.terrain&&this._finalizeElevation(),this._afterEase(u,xt)},i),this}_prepareEase(i,u,d={}){this._moving=!0,u||d.moving||this.fire(new c.k("movestart",i)),this._zooming&&!d.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!d.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!d.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&u!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(d-(u-(d*i+this._elevationStart))/(1-i)),this._elevationTarget=u}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;const u=i.clone(),{center:d,zoom:m,pitch:y,bearing:w,elevation:I}=this.transformCameraUpdate(u);d&&(u.center=d),m!==void 0&&(u.zoom=m),y!==void 0&&(u.pitch=y),w!==void 0&&(u.bearing=w),I!==void 0&&(u.elevation=I),this.transform.apply(u)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const d=this._zooming,m=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new c.k("zoomend",i)),m&&this.fire(new c.k("rotateend",i)),y&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,u){var d;if(!i.essential&&N.prefersReducedMotion){const Xe=c.L(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Xe,u)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b7},i);const m=this._getTransformForUpdate(),y=this.getZoom(),w=this.getBearing(),I=this.getPitch(),C=this.getPadding(),P="bearing"in i?this._normalizeBearing(i.bearing,w):w,D="pitch"in i?+i.pitch:I,k="padding"in i?i.padding:m.padding,V=c.P.convert(i.offset);let X=m.centerPoint.add(V);const W=m.pointLocation(X),{center:J,zoom:j}=m.getConstrained(c.M.convert(i.center||W),(d=i.zoom)!==null&&d!==void 0?d:y);this._normalizeCenter(J);const nt=m.zoomScale(j-y),ft=m.project(W),Q=m.project(J).sub(ft);let st=i.curve;const mt=Math.max(m.width,m.height),gt=mt/nt,xt=Q.mag();if("minZoom"in i){const Xe=c.ac(Math.min(i.minZoom,y,j),m.minZoom,m.maxZoom),_e=mt/m.zoomScale(Xe-y);st=Math.sqrt(_e/xt*2)}const Pt=st*st;function Lt(Xe){const _e=(gt*gt-mt*mt+(Xe?-1:1)*Pt*Pt*xt*xt)/(2*(Xe?gt:mt)*Pt*xt);return Math.log(Math.sqrt(_e*_e+1)-_e)}function zt(Xe){return(Math.exp(Xe)-Math.exp(-Xe))/2}function Vt(Xe){return(Math.exp(Xe)+Math.exp(-Xe))/2}const Te=Lt(!1);let qt=function(Xe){return Vt(Te)/Vt(Te+st*Xe)},he=function(Xe){return mt*((Vt(Te)*(zt(_e=Te+st*Xe)/Vt(_e))-zt(Te))/Pt)/xt;var _e},Le=(Lt(!0)-Te)/st;if(Math.abs(xt)<1e-6||!isFinite(Le)){if(Math.abs(mt-gt)<1e-6)return this.easeTo(i,u);const Xe=gti.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=w!==P,this._pitching=D!==I,this._padding=!m.isPaddingEqual(k),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(J),this._ease(Xe=>{const _e=Xe*Le,De=1/qt(_e);m.zoom=Xe===1?j:y+m.scaleZoom(De),this._rotating&&(m.bearing=c.z.number(w,P,Xe)),this._pitching&&(m.pitch=c.z.number(I,D,Xe)),this._padding&&(m.interpolatePadding(C,k,Xe),X=m.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(Xe);const Ne=Xe===1?J:m.unproject(ft.add(Q.mult(he(_e))).mult(De));m.setLocationAtPoint(m.renderWorldCopies?Ne.wrap():Ne,X),this._applyUpdatedTransform(m),this._fireMoveEvents(u)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(u)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,u)}if(!i){const d=this.handlers;d&&d.stop(!1)}return this}_ease(i,u,d){d.animate===!1||d.duration===0?(i(1),u()):(this._easeStart=N.now(),this._easeOptions=d,this._onEaseFrame=i,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,u){i=c.b1(i,-180,180);const d=Math.abs(i-u);return Math.abs(i-360-u)180?-360:d<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.M.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const zh={compact:!0,customAttribution:'MapLibre'};class So{constructor(i=zh){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){U.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(i,u){const d=this._map._getUIString(`AttributionControl.${u}`);i.title=d,i.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const u=this._map.style.sourceCaches;for(const m in u){const y=u[m];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&i.indexOf(w.attribution)<0&&i.push(w.attribution)}}i=i.filter(m=>String(m).trim()),i.sort((m,y)=>m.length-y.length),i=i.filter((m,y)=>{for(let w=y+1;w=0)return!1;return!0});const d=i.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,i.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Dd{constructor(i={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const d=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const u=U.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class iu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const u=++this._id;return this._queue.push({callback:i,id:u,cancelled:!1}),u}remove(i){const u=this._currentlyRunning,d=u?this._queue.concat(u):this._queue;for(const m of d)if(m.id===i)return void(m.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const d of u)if(!d.cancelled&&(d.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Kn=c.X([{name:"a_pos3d",type:"Int16",components:3}]);class li extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,u){this.sourceCache.update(i,u),this._renderableTilesKeys=[];const d={};for(const m of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),c.aN(m.posMatrix,0,c.W,0,c.W,0,1),this._tiles[m.key]=new Zo(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(i){for(const u in this._tiles){const d=this._tiles[u];(!i||d.tileID.equals(i)||d.tileID.isChildOf(i)||i.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const u={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16),c.aN(y.posMatrix,0,c.W,0,c.W,0,1),u[d]=y}else if(m.canonical.isChildOf(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=m.canonical.z-i.canonical.z,I=m.canonical.x-(m.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,P,0,P,0,1),c.H(y.posMatrix,y.posMatrix,[-I*P,-C*P,0]),u[d]=y}else if(i.canonical.isChildOf(m.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=i.canonical.z-m.canonical.z,I=i.canonical.x-(i.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,c.W,0,c.W,0,1),c.H(y.posMatrix,y.posMatrix,[I*P,C*P,0]),c.J(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),u[d]=y}}return u}getSourceTile(i,u){const d=this.sourceCache._source;let m=i.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(i.scaledTo(m--).key);return y}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=i)}}class Rd{constructor(i,u,d){this.painter=i,this.sourceCache=new li(u),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,u,d,m=c.W){var y;if(!(u>=0&&u=0&&di.canonical.z&&(i.canonical.z>=m?y=i.canonical.z-m:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=i.canonical.x-(i.canonical.x>>y<>y<>8<<4|y>>8,u[w+3]=0;const d=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),m=new Nt(i,d,i.gl.RGBA,{premultiply:!1});return m.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),d=this.painter.context,m=d.gl,y=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(y,I-w-1,1,1,m.RGBA,m.UNSIGNED_BYTE,u),d.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),P=u[1]+((15&u[2])<<8),D=this.coordsIndex[255-u[3]],k=D&&this.sourceCache.getTileByID(D);if(!k)return null;const V=this._coordsTextureSize,X=(1<i.id!==u),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length!i.inUse)===!1}}const xs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Oh{constructor(i,u){this.painter=i,this.terrain=u,this.pool=new ru(i.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(d=>!i._layers[d].isHidden(u)),this._coordsDescendingInv={};for(const d in i.sourceCaches){this._coordsDescendingInv[d]={};const m=i.sourceCaches[d].getVisibleCoordinates();for(const y of m){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const I in w)this._coordsDescendingInv[d][I]||(this._coordsDescendingInv[d][I]=[]),this._coordsDescendingInv[d][I].push(w[I])}}this._coordsDescendingInvStr={};for(const d of i._order){const m=i._layers[d],y=m.source;if(xs[m.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(I=>I.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[m][d.tileID.key];y&&y!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const u=i.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(xs[u]&&(this._prevType&&xs[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(i.id),!m))return!0;if(xs[this._prevType]||xs[u]&&m){this._prevType=u;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(sc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[y]){const P=this.pool.getObjectForId(I.rtt[y].id);if(P.stamp===I.rtt[y].stamp){this.pool.useObject(P);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),I.rtt[y]={id:C.id,stamp:C.stamp},d.context.bindFramebuffer.set(C.fbo.framebuffer),d.context.clear({color:c.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let P=0;P{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Vh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Uh{constructor(i,u,d=!1){this.mousedown=w=>{this.startMouse(c.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=i.dragRotate._mouseRotate.getClickTolerance(),y=i.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=il({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:I,bearingDegreesPerPixelMoved:C=.8})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,k)=>({bearingDelta:(k.x-D.x)*C}),moveStateManager:P,enable:w,assignEvents:dc})})({clickTolerance:m,enable:!0}),this.map=i,d&&(this.mousePitch=rl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:I,pitchDegreesPerPixelMoved:C=-.5})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,k)=>({pitchDelta:(k.y-D.y)*C}),moveStateManager:P,enable:w,assignEvents:dc})})({clickTolerance:y,enable:!0})),U.addEventListener(u,"mousedown",this.mousedown),U.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(u,"touchcancel",this.reset)}startMouse(i,u){this.mouseRotate.dragStart(i,u),this.mousePitch&&this.mousePitch.dragStart(i,u),U.disableDrag()}startTouch(i,u){this.touchRotate.dragStart(i,u),this.touchPitch&&this.touchPitch.dragStart(i,u),U.disableDrag()}moveMouse(i,u){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(i,u)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(i,u){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(i,u)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const i=this.element;U.removeEventListener(i,"mousedown",this.mousedown),U.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let bs;function fc(_,i,u){const d=new c.M(_.lng,_.lat);if(_=new c.M(_.lng,_.lat),i){const m=new c.M(_.lng-360,_.lat),y=new c.M(_.lng+360,_.lat),w=u.locationPoint(_).distSqr(i);u.locationPoint(m).distSqr(i)180;){const m=u.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=u.width&&m.y<=u.height)break;_.lng>u.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&u.locationPoint(_).y>u.height/2-u.getHorizon()?_:d}const su={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function mc(_,i,u){const d=_.classList;for(const m in su)d.remove(`maplibregl-${u}-anchor-${m}`);d.add(`maplibregl-${u}-anchor-${i}`)}class au extends c.E{constructor(i){if(super(),this._onKeyPress=u=>{const d=u.code,m=u.charCode||u.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=u=>{const d=u.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=u=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?fc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),u&&u.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${su[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${y}`),N.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=u.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div"),this._element.setAttribute("aria-label","Map marker");const u=U.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${d}px`),u.setAttributeNS(null,"width",`${m}px`),u.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const y=U.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const I=U.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const C=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const nt of C){const ft=U.createNS("http://www.w3.org/2000/svg","ellipse");ft.setAttributeNS(null,"opacity","0.04"),ft.setAttributeNS(null,"cx","10.5"),ft.setAttributeNS(null,"cy","5.80029008"),ft.setAttributeNS(null,"rx",nt.rx),ft.setAttributeNS(null,"ry",nt.ry),I.appendChild(ft)}const P=U.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const D=U.createNS("http://www.w3.org/2000/svg","path");D.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),P.appendChild(D);const k=U.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const V=U.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),k.appendChild(V);const X=U.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(6.0, 7.0)"),X.setAttributeNS(null,"fill","#FFFFFF");const W=U.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const j=U.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),W.appendChild(J),W.appendChild(j),w.appendChild(I),w.appendChild(P),w.appendChild(k),w.appendChild(X),w.appendChild(W),u.appendChild(w),u.setAttributeNS(null,"height",d*this._scale+"px"),u.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),mc(this._element,this._anchor,"marker"),i&&i.className)for(const u of i.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.M.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const m=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var u,d;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,y=m.terrain.depthAtPoint(this._pos),w=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,w)-y<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/m.transform._pixelPerMeter,C=Math.sin(m.getPitch()*Math.PI/180)*I,P=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),D=m.transform.lngLatToCameraDepth(this._lngLat,w+C)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,u){return i===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const gc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let sl=0,wa=!1;const _c={maxWidth:100,unit:"metric"};function yc(_,i,u){const d=u&&u.maxWidth||100,m=_._container.clientHeight/2,y=_.unproject([0,m]),w=_.unproject([d,m]),I=y.distanceTo(w);if(u&&u.unit==="imperial"){const C=3.2808*I;C>5280?Ia(i,d,C/5280,_._getUIString("ScaleControl.Miles")):Ia(i,d,C,_._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?Ia(i,d,I/1852,_._getUIString("ScaleControl.NauticalMiles")):I>=1e3?Ia(i,d,I/1e3,_._getUIString("ScaleControl.Kilometers")):Ia(i,d,I,_._getUIString("ScaleControl.Meters"))}function Ia(_,i,u,d){const m=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let I=y/w;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(C){const P=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*P)/P}(I),w*I}(u);_.style.width=i*(m/u)+"px",_.innerHTML=`${m} ${d}`}const qh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Gh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function vc(_){if(_){if(typeof _=="number"){const i=Math.round(Math.abs(_)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,_),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-_),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(_,0),right:new c.P(-_,0)}}if(_ instanceof c.P||Array.isArray(_)){const i=c.P.convert(_);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:c.P.convert(_.center||[0,0]),top:c.P.convert(_.top||[0,0]),"top-left":c.P.convert(_["top-left"]||[0,0]),"top-right":c.P.convert(_["top-right"]||[0,0]),bottom:c.P.convert(_.bottom||[0,0]),"bottom-left":c.P.convert(_["bottom-left"]||[0,0]),"bottom-right":c.P.convert(_["bottom-right"]||[0,0]),left:c.P.convert(_.left||[0,0]),right:c.P.convert(_.right||[0,0])}}return vc(new c.P(0,0))}const Nd=S;f.AJAXError=c.be,f.Evented=c.E,f.LngLat=c.M,f.MercatorCoordinate=c.Y,f.Point=c.P,f.addProtocol=c.bf,f.config=c.a,f.removeProtocol=c.bg,f.AttributionControl=So,f.BoxZoomHandler=Io,f.CanvasSource=Za,f.CooperativeGesturesHandler=ne,f.DoubleClickZoomHandler=Nh,f.DragPanHandler=Md,f.DragRotateHandler=Eo,f.EdgeInsets=tl,f.FullscreenControl=class extends c.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var i;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=u==null?void 0:u.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},f.GeoJSONSource=qs,f.GeolocateControl=class extends c.E{constructor(_){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const u=new c.M(i.coords.longitude,i.coords.latitude),d=i.coords.accuracy,m=this._map.getBearing(),y=c.e({bearing:m},this.options.fitBoundsOptions),w=Ct.fromLngLat(u,d);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const u=new c.M(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&wa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",u=>u.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new au({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},gc,_)}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return c._(this,arguments,void 0,function*(i=!1){if(bs!==void 0&&!i)return bs;if(window.navigator.permissions===void 0)return bs=!!window.navigator.geolocation,bs;try{bs=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{bs=!!window.navigator.geolocation}return bs})}().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,sl=0,wa=!1}_isOutOfMapMaxBounds(_){const i=this._map.getMaxBounds(),u=_.coords;return i&&(u.longitudei.getEast()||u.latitudei.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),i=_.getSouthEast(),u=_.getNorthEast(),d=i.distanceTo(u),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":sl--,wa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),sl++,sl>1?(_={maximumAge:6e5,timeout:0},wa=!0):(_=this.options.positionOptions,wa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},f.Hash=Ah,f.ImageSource=wi,f.KeyboardHandler=Ys,f.LngLatBounds=Ct,f.LogoControl=Dd,f.Map=class extends Ar{constructor(_){if(c.bc.mark(c.bd.create),(_=c.e({},ou,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ac(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=i=>{i.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:i}))},this._contextRestored=i=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:i}))},this._onMapScroll=i=>{if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new iu,this._controls=[],this._mapId=c.a3(),this._locale=c.e({},Fh,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=Bt.addThrottleControl(()=>this.isMoving()),this._requestManager=new ie(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let i=!1;const u=Ph(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{i?u(d):i=!0}),this._resizeObserver.observe(this._container)}this.handlers=new kh(this,_),this._hash=_.hash&&new Ah(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,c.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new So(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Dd,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update(i.dataType==="style"),this.fire(new c.k(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new c.k(`${i.dataType}dataloading`,i))}),this.on("dataabort",i=>{this.fire(new c.k("sourcedataabort",i))})}_getMapId(){return this._mapId}addControl(_,i){if(i===void 0&&(i=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[i];return i.indexOf("bottom")!==-1?d.insertBefore(u,d.firstChild):d.appendChild(u),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(_);return i>-1&&this._controls.splice(i,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,i,u,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,i,u,d)}resize(_){var i;const u=this._containerDimensions(),d=u[0],m=u[1],y=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,y),this.painter.resize(d,m,y),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const C=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,C),this.painter.resize(d,m,C)}this.transform.resize(d,m),(i=this._requestedCameraState)===null||i===void 0||i.resize(d,m);const w=!this._moving;return w&&(this.stop(),this.fire(new c.k("movestart",_)).fire(new c.k("move",_))),this.fire(new c.k("resize",_)),w&&this.fire(new c.k("moveend",_)),this}_getClampedPixelRatio(_,i){const{0:u,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),y=_*m,w=i*m;return Math.min(y>u?u/y:1,w>d?d/w:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Ct.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(c.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(c.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,i,u){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:y=>{const w=this.getLayer(i)?this.queryRenderedFeatures(y.point,{layers:[i]}):[];w.length?d||(d=!0,u.call(this,new Pr(_,this,y.originalEvent,{features:w}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:w=>{(this.getLayer(i)?this.queryRenderedFeatures(w.point,{layers:[i]}):[]).length?d=!0:d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))},mouseout:w=>{d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))}}}}{const d=m=>{const y=this.getLayer(i)?this.queryRenderedFeatures(m.point,{layers:[i]}):[];y.length&&(m.features=y,u.call(this,m),delete m.features)};return{layer:i,listener:u,delegates:{[_]:d}}}}on(_,i,u){if(u===void 0)return super.on(_,i);const d=this._createDelegatedListener(_,i,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,i,u){if(u===void 0)return super.once(_,i);const d=this._createDelegatedListener(_,i,u);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,i,u){return u===void 0?super.off(_,i):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,i));const u=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Gr(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,i,u):this.style.loadJSON(_,i,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,i){if(typeof _=="string"){const u=this._requestManager.transformRequest(_,"Style");c.h(u,new AbortController).then(d=>{this._updateDiff(d.data,i)}).catch(d=>{d&&this.fire(new c.j(d))})}else typeof _=="object"&&this._updateDiff(_,i)}_updateDiff(_,i){try{this.style.setState(_,i)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(_,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(_,i){return this._lazyInitEmptyStyle(),this.style.addSource(_,i),this._update(!0)}isSourceLoaded(_){const i=this.style&&this.style.sourceCaches[_];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const i=this.style.sourceCaches[_.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&i.reload();for(const u in this.style._layers){const d=this.style._layers[u];d.type==="hillshade"&&d.source===_.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Rd(this.painter,i,_),this.painter.renderToTexture=new Oh(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:_})),this}getTerrain(){var _,i;return(i=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const i in _){const u=_[i]._tiles;for(const d in u){const m=u[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,i,u={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:y,stretchY:w,content:I}=u;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:P,data:D}=i,k=i;return this.style.addImage(_,{data:new c.R({width:C,height:P},new Uint8Array(D)),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:m,version:0,userImage:k}),k.onAdd&&k.onAdd(this,_),this}}{const{width:C,height:P,data:D}=N.getImageData(i);this.style.addImage(_,{data:new c.R({width:C,height:P},D),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:m,version:0})}}updateImage(_,i){const u=this.style.getImage(_);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=i instanceof HTMLImageElement||c.b(i)?N.getImageData(i):i,{width:m,height:y,data:w}=d;if(m===void 0||y===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==u.data.width||y!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(i instanceof HTMLImageElement||c.b(i));return u.data.replace(w,I),this.style.updateImage(_,u),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return Bt.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,i){return this._lazyInitEmptyStyle(),this.style.addLayer(_,i),this._update(!0)}moveLayer(_,i){return this.style.moveLayer(_,i),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,i,u){return this.style.setLayerZoomRange(_,i,u),this._update(!0)}setFilter(_,i,u={}){return this.style.setFilter(_,i,u),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,i,u,d={}){return this.style.setPaintProperty(_,i,u,d),this._update(!0)}getPaintProperty(_,i){return this.style.getPaintProperty(_,i)}setLayoutProperty(_,i,u,d={}){return this.style.setLayoutProperty(_,i,u,d),this._update(!0)}getLayoutProperty(_,i){return this.style.getLayoutProperty(_,i)}setGlyphs(_,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,i,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,i,u,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,i,u=>{u||this._update(!0)}),this}setLight(_,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,i){return this.style.setFeatureState(_,i),this._update()}removeFeatureState(_,i){return this.style.removeFeatureState(_,i),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,i=0;return this._container&&(_=this._container.clientWidth||400,i=this._container.clientHeight||300),[_,i]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const i=this._canvasContainer=U.create("div","maplibregl-canvas-container",_);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions(),d=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],d);const m=this._controlContainer=U.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=U.create("div",`maplibregl-ctrl-${w} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,i,u){this._canvas.width=Math.floor(u*_),this._canvas.height=Math.floor(u*i),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{i={requestedAttributes:_},d&&(i.statusMessage=d.statusMessage,i.type=d.type)},{once:!0});const u=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!u){const d="Failed to initialize WebGL";throw i?(i.message=d,new Error(JSON.stringify(i))):new Error(d)}this.painter=new xd(u,this.transform),lt.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,y=N.now();this.style.zoomHistory.update(m,y);const w=new c.a8(m,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=w.crossFadingFactor();I===1&&I===this._crossFadingFactor||(u=!0,this._crossFadingFactor=I),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bc.mark(c.bd.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.bc.mark(c.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const u of this._controls)u.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Bt.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bc.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(_=>{c.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Bh}getCameraTargetElevation(){return this.transform.elevation}},f.MapMouseEvent=Pr,f.MapTouchEvent=Yo,f.MapWheelEvent=Mh,f.Marker=au,f.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const i=this._map.getZoom(),u=i===this._map.getMaxZoom(),d=i===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,u)=>{const d=this._map._getUIString(`NavigationControl.${u}`);i.title=d,i.setAttribute("aria-label",d)},this.options=c.e({},Vh,_),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,i){const u=U.create("button",_,this._container);return u.type="button",u.addEventListener("click",i),u}},f.Popup=class extends c.E{constructor(_){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?fc(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!i)return;const d=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const y=vc(this.options.offset);if(!m){const I=this._container.offsetWidth,C=this._container.offsetHeight;let P;P=d.y+y.bottom.ythis._map.transform.height-C?["bottom"]:[],d.xthis._map.transform.width-I/2&&P.push("right"),m=P.length===0?"bottom":P.join("-")}let w=d.add(y[m]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${su[m]} translate(${w.x}px,${w.y}px)`),mc(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(qh),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=c.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const i=document.createDocumentFragment(),u=document.createElement("body");let d;for(u.innerHTML=_;d=u.firstChild,d;)i.appendChild(d);return this.setDOMContent(i)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Gh);_&&_.focus()}},f.RasterDEMTileSource=hr,f.RasterTileSource=yt,f.ScaleControl=class{constructor(_){this._onMove=()=>{yc(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,yc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},_c),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},f.ScrollZoomHandler=hc,f.Style=Gr,f.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},f.TwoFingersTouchPitchHandler=Ld,f.TwoFingersTouchRotateHandler=Rh,f.TwoFingersTouchZoomHandler=Td,f.TwoFingersTouchZoomRotateHandler=eu,f.VectorTileSource=si,f.VideoSource=ja,f.addSourceType=(_,i)=>c._(void 0,void 0,void 0,function*(){if(Wa(_))throw new Error(`A source type called "${_}" already exists.`);((u,d)=>{Ha[u]=d})(_,i)}),f.clearPrewarmedResources=function(){const _=fn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Be),fn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},f.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},f.getRTLTextPluginStatus=function(){return Ot().getRTLTextPluginStatus()},f.getVersion=function(){return Nd},f.getWorkerCount=function(){return un.workerCount},f.getWorkerUrl=function(){return c.a.WORKER_URL},f.importScriptInWorkers=function(_){return Gi().broadcast("IS",_)},f.prewarm=function(){An().acquire(Be)},f.setMaxParallelImageRequests=function(_){c.a.MAX_PARALLEL_IMAGE_REQUESTS=_},f.setRTLTextPlugin=function(_,i){return Ot().setRTLTextPlugin(_,i)},f.setWorkerCount=function(_){un.workerCount=_},f.setWorkerUrl=function(_){c.a.WORKER_URL=_}});var p=r;return p})})(P0);var fb=P0.exports;const Ps=db(fb);function yy(t){let e;return r=>{if(r)for(let s in r){let l=e==null?void 0:e[s],p=r[s];l!==p&&t(s,p,l)}else if(e)for(let s in e)t(s,void 0,e[s]);e=r}}function mb(t,...e){let r=[t];for(let s of e)if(s)Array.isArray(s)&&s[0]===t?r.push(...s.slice(1)):r.push(s);else continue;if(r.length!==1)return r.length===2?r[1]:r}function gb(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function _2(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var M0=_b;function _b(t){var e,r,s;if(t){if(Array.isArray(t)){for(e=[],r=t.length,s=0;s{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(l)}}}function vb(t,e,r){let s,l,p,f,c,S,L,R,N,U,lt,ht,{$$slots:vt={},$$scope:wt}=e,{id:Mt=dg("layer")}=e,{source:Dt=void 0}=e,{sourceLayer:Bt=void 0}=e,{beforeId:ie=void 0}=e,{beforeLayerType:de=void 0}=e,{type:Fe}=e,{paint:ce=void 0}=e,{layout:Ee=void 0}=e,{filter:ge=void 0}=e,{applyToClusters:ve=void 0}=e,{minzoom:Nt=void 0}=e,{maxzoom:Jt=void 0}=e,{manageHoverState:ke=!1}=e,{hovered:ye=null}=e,{interactive:Ze=!0}=e,{hoverCursor:In=void 0}=e,{eventsIfTopMost:fe=!1}=e;const Ke=hg(),{map:Pn,source:xi,self:ln,minzoom:Be,maxzoom:un,eventTopMost:En,layerInfo:fn}=cb();Qr(t,Pn,Ut=>r(31,N=Ut)),Qr(t,xi,Ut=>r(32,U=Ut)),Qr(t,ln,Ut=>r(0,R=Ut)),Qr(t,Be,Ut=>r(34,ht=Ut)),Qr(t,un,Ut=>r(33,lt=Ut)),mu(()=>{R&&N&&(fn.delete(R),N==null||N.removeLayer(R))});let cn;function An(Ut){var yt,hr;if(!Ze||!R||!N||fe&&En(Ut)!==R)return;let Ct=Ut.features??[],bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id,si={event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct};Ke(Ut.type,si)}function Wn(Ut){var yt,hr;if(!Ze||!R||!N||fe&&En(Ut)!==R)return;In&&(N.getCanvas().style.cursor=In);let Ct=Ut.features??[];r(6,ye=Ct[0]??null);let bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id;Ke("mouseenter",{event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct})}function Gi(Ut){var yt,hr,qs;if(!Ze||!N)return;if(fe&&En(Ut)!==R){r(6,ye=null),ke&&cn!==void 0&&(N==null||N.setFeatureState({source:c,sourceLayer:Bt,id:cn},{hover:!1}),cn=void 0);return}N.getCanvas().style.cursor=In;let Ct=Ut.features??[],bi=(hr=(yt=Ct[0])==null?void 0:yt.properties)==null?void 0:hr.cluster_id,si=(qs=Ct[0])==null?void 0:qs.id;si!==cn&&(ke&&(cn!==void 0&&(N==null||N.setFeatureState({source:c,id:cn,sourceLayer:Bt},{hover:!1})),N==null||N.setFeatureState({source:c,id:si,sourceLayer:Bt},{hover:!0})),cn=si,r(6,ye=Ct[0]??null)),Ke("mousemove",{event:Ut,map:N,clusterId:bi,layer:R,source:c,features:Ct})}function At(Ut){if(!(!Ze||!R||!N)){if(In&&(N.getCanvas().style.cursor=""),r(6,ye=null),ke&&cn!==void 0){const Ct={source:c,id:cn,sourceLayer:Bt};N==null||N.setFeatureState(Ct,{hover:!1}),cn=void 0}Ke("mouseleave",{map:N,layer:R,source:c})}}let we=!0;function qe(Ut){N&&(N.off("click",Ut,An),N.off("dblclick",Ut,An),N.off("contextmenu",Ut,An),N.off("mouseenter",Ut,Wn),N.off("mousemove",Ut,Gi),N.off("mouseleave",Ut,At))}return mu(()=>{N&&R&&qe(R)}),t.$$set=Ut=>{"id"in Ut&&r(7,Mt=Ut.id),"source"in Ut&&r(8,Dt=Ut.source),"sourceLayer"in Ut&&r(9,Bt=Ut.sourceLayer),"beforeId"in Ut&&r(10,ie=Ut.beforeId),"beforeLayerType"in Ut&&r(11,de=Ut.beforeLayerType),"type"in Ut&&r(12,Fe=Ut.type),"paint"in Ut&&r(13,ce=Ut.paint),"layout"in Ut&&r(14,Ee=Ut.layout),"filter"in Ut&&r(15,ge=Ut.filter),"applyToClusters"in Ut&&r(16,ve=Ut.applyToClusters),"minzoom"in Ut&&r(17,Nt=Ut.minzoom),"maxzoom"in Ut&&r(18,Jt=Ut.maxzoom),"manageHoverState"in Ut&&r(19,ke=Ut.manageHoverState),"hovered"in Ut&&r(6,ye=Ut.hovered),"interactive"in Ut&&r(20,Ze=Ut.interactive),"hoverCursor"in Ut&&r(21,In=Ut.hoverCursor),"eventsIfTopMost"in Ut&&r(22,fe=Ut.eventsIfTopMost),"$$scope"in Ut&&r(35,wt=Ut.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,s=gb(ve)),t.$$.dirty[0]&1073774592&&r(24,l=mb("all",s,ge)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,p=Nt??ht),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,f=Jt??lt),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,c=Dt||U),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&N&&R!==Mt&&c){R&&(qe(R),fn.delete(R));let Ut=ie;if(!ie&&de){let Ct=N.getStyle().layers,bi=typeof de=="function"?de:yt=>yt.type===de,si=Ct==null?void 0:Ct.find(bi);si&&(Ut=si.id)}wp(ln,R=Mt,R),N.addLayer(M0({id:R,type:Fe,source:c,"source-layer":Bt,filter:l,paint:ce,layout:Ee,minzoom:p,maxzoom:f}),Ut),r(23,we=!0),N.on("click",R,An),N.on("dblclick",R,An),N.on("contextmenu",R,An),N.on("mouseenter",R,Wn),N.on("mousemove",R,Gi),N.on("mouseleave",R,At)}t.$$.dirty[0]&1048577&&R&&fn.set(R,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,S=R?yy((Ut,Ct)=>N==null?void 0:N.setPaintProperty(R,Ut,Ct)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,L=R?yy((Ut,Ct)=>N==null?void 0:N.setLayoutProperty(R,Ut,Ct)):void 0),t.$$.dirty[0]&268443648&&(S==null||S(ce)),t.$$.dirty[0]&134234112&&(L==null||L(Ee)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&R&&(N==null||N.setLayerZoomRange(R,p,f)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&R&&(we?r(23,we=!1):N==null||N.setFilter(R,l))},[R,Pn,xi,ln,Be,un,ye,Mt,Dt,Bt,ie,de,Fe,ce,Ee,ge,ve,Nt,Jt,ke,Ze,In,fe,we,l,f,p,L,S,c,s,N,U,lt,ht,wt,vt]}class D0 extends ao{constructor(e){super(),so(this,e,vb,yb,Cr,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function xb(t){let e;const r=t[16].default,s=wl(r,t,t[24],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&16777216)&&El(s,r,l,l[24],e?Il(r,l[24],p,null):Sl(l[24]),null)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function bb(t){let e,r,s;function l(f){t[17](f)}let p={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[xb]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new D0({props:p}),Vc.push(()=>f0(e,"hovered",l)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){du(e.$$.fragment)},m(f,c){_l(e,f,c),s=!0},p(f,[c]){const S={};c&2&&(S.id=f[1]),c&4&&(S.source=f[2]),c&8&&(S.sourceLayer=f[3]),c&16&&(S.beforeId=f[4]),c&32&&(S.beforeLayerType=f[5]),c&64&&(S.paint=f[6]),c&128&&(S.layout=f[7]),c&256&&(S.filter=f[8]),c&512&&(S.applyToClusters=f[9]),c&1024&&(S.minzoom=f[10]),c&2048&&(S.maxzoom=f[11]),c&4096&&(S.hoverCursor=f[12]),c&8192&&(S.manageHoverState=f[13]),c&16384&&(S.eventsIfTopMost=f[14]),c&32768&&(S.interactive=f[15]),c&16777216&&(S.$$scope={dirty:c,ctx:f}),!r&&c&1&&(r=!0,S.hovered=f[0],p0(()=>r=!1)),e.$set(S)},i(f){s||(dn(e.$$.fragment,f),s=!0)},o(f){Fn(e.$$.fragment,f),s=!1},d(f){yl(e,f)}}}function wb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=dg("circle")}=e,{source:f=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:N=void 0}=e,{filter:U=void 0}=e,{applyToClusters:lt=void 0}=e,{minzoom:ht=void 0}=e,{maxzoom:vt=void 0}=e,{hoverCursor:wt=void 0}=e,{manageHoverState:Mt=!1}=e,{hovered:Dt=null}=e,{eventsIfTopMost:Bt=!1}=e,{interactive:ie=!0}=e;function de(Jt){Dt=Jt,r(0,Dt)}function Fe(Jt){is.call(this,t,Jt)}function ce(Jt){is.call(this,t,Jt)}function Ee(Jt){is.call(this,t,Jt)}function ge(Jt){is.call(this,t,Jt)}function ve(Jt){is.call(this,t,Jt)}function Nt(Jt){is.call(this,t,Jt)}return t.$$set=Jt=>{"id"in Jt&&r(1,p=Jt.id),"source"in Jt&&r(2,f=Jt.source),"sourceLayer"in Jt&&r(3,c=Jt.sourceLayer),"beforeId"in Jt&&r(4,S=Jt.beforeId),"beforeLayerType"in Jt&&r(5,L=Jt.beforeLayerType),"paint"in Jt&&r(6,R=Jt.paint),"layout"in Jt&&r(7,N=Jt.layout),"filter"in Jt&&r(8,U=Jt.filter),"applyToClusters"in Jt&&r(9,lt=Jt.applyToClusters),"minzoom"in Jt&&r(10,ht=Jt.minzoom),"maxzoom"in Jt&&r(11,vt=Jt.maxzoom),"hoverCursor"in Jt&&r(12,wt=Jt.hoverCursor),"manageHoverState"in Jt&&r(13,Mt=Jt.manageHoverState),"hovered"in Jt&&r(0,Dt=Jt.hovered),"eventsIfTopMost"in Jt&&r(14,Bt=Jt.eventsIfTopMost),"interactive"in Jt&&r(15,ie=Jt.interactive),"$$scope"in Jt&&r(24,l=Jt.$$scope)},[Dt,p,f,c,S,L,R,N,U,lt,ht,vt,wt,Mt,Bt,ie,s,de,Fe,ce,Ee,ge,ve,Nt,l]}class y2 extends ao{constructor(e){super(),so(this,e,wb,bb,Cr,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Ib(t,e,r){let s;const{map:l}=ah();Qr(t,l,S=>r(4,s=S));let{position:p="top-left"}=e,{container:f=void 0}=e,c=null;return mu(()=>{s!=null&&s.loaded()&&c&&s.removeControl(c)}),t.$$set=S=>{"position"in S&&r(1,p=S.position),"container"in S&&r(2,f=S.container)},t.$$.update=()=>{if(t.$$.dirty&30&&s&&!c){let S;typeof f=="string"?S=document.querySelector(f)??void 0:S=f,r(3,c=new Ps.FullscreenControl({container:S})),s.addControl(c,p)}},[l,p,f,c,s]}class Eb extends ao{constructor(e){super(),so(this,e,Ib,null,Cr,{position:1,container:2})}}function Sb(t,e,r){let s;const{map:l}=ah();Qr(t,l,U=>r(8,s=U));let{position:p="top-left"}=e,{positionOptions:f=void 0}=e,{fitBoundsOptions:c=void 0}=e,{trackUserLocation:S=!1}=e,{showAccuracyCircle:L=!0}=e,{showUserLocation:R=!0}=e,N=null;return mu(()=>{s!=null&&s.loaded()&&N&&s.removeControl(N)}),t.$$set=U=>{"position"in U&&r(1,p=U.position),"positionOptions"in U&&r(2,f=U.positionOptions),"fitBoundsOptions"in U&&r(3,c=U.fitBoundsOptions),"trackUserLocation"in U&&r(4,S=U.trackUserLocation),"showAccuracyCircle"in U&&r(5,L=U.showAccuracyCircle),"showUserLocation"in U&&r(6,R=U.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&s&&!N&&(r(7,N=new Ps.GeolocateControl({positionOptions:f,fitBoundsOptions:c,trackUserLocation:S,showAccuracyCircle:L,showUserLocation:R})),s.addControl(N,p))},[l,p,f,c,S,L,R,N,s]}class Cb extends ao{constructor(e){super(),so(this,e,Sb,null,Cr,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function Tb(t){let e;const r=t[15].default,s=wl(r,t,t[23],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&8388608)&&El(s,r,l,l[23],e?Il(r,l[23],p,null):Sl(l[23]),null)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Lb(t){let e,r,s;function l(f){t[16](f)}let p={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[Tb]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new D0({props:p}),Vc.push(()=>f0(e,"hovered",l)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){du(e.$$.fragment)},m(f,c){_l(e,f,c),s=!0},p(f,[c]){const S={};c&2&&(S.id=f[1]),c&4&&(S.source=f[2]),c&8&&(S.sourceLayer=f[3]),c&16&&(S.beforeId=f[4]),c&32&&(S.beforeLayerType=f[5]),c&64&&(S.paint=f[6]),c&128&&(S.layout=f[7]),c&256&&(S.filter=f[8]),c&512&&(S.minzoom=f[9]),c&1024&&(S.maxzoom=f[10]),c&2048&&(S.hoverCursor=f[11]),c&4096&&(S.manageHoverState=f[12]),c&8192&&(S.eventsIfTopMost=f[13]),c&16384&&(S.interactive=f[14]),c&8388608&&(S.$$scope={dirty:c,ctx:f}),!r&&c&1&&(r=!0,S.hovered=f[0],p0(()=>r=!1)),e.$set(S)},i(f){s||(dn(e.$$.fragment,f),s=!0)},o(f){Fn(e.$$.fragment,f),s=!1},d(f){yl(e,f)}}}function Pb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=dg("line")}=e,{source:f=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:N=void 0}=e,{filter:U=void 0}=e,{minzoom:lt=void 0}=e,{maxzoom:ht=void 0}=e,{hoverCursor:vt=void 0}=e,{manageHoverState:wt=!1}=e,{hovered:Mt=null}=e,{eventsIfTopMost:Dt=!1}=e,{interactive:Bt=!0}=e;function ie(Nt){Mt=Nt,r(0,Mt)}function de(Nt){is.call(this,t,Nt)}function Fe(Nt){is.call(this,t,Nt)}function ce(Nt){is.call(this,t,Nt)}function Ee(Nt){is.call(this,t,Nt)}function ge(Nt){is.call(this,t,Nt)}function ve(Nt){is.call(this,t,Nt)}return t.$$set=Nt=>{"id"in Nt&&r(1,p=Nt.id),"source"in Nt&&r(2,f=Nt.source),"sourceLayer"in Nt&&r(3,c=Nt.sourceLayer),"beforeId"in Nt&&r(4,S=Nt.beforeId),"beforeLayerType"in Nt&&r(5,L=Nt.beforeLayerType),"paint"in Nt&&r(6,R=Nt.paint),"layout"in Nt&&r(7,N=Nt.layout),"filter"in Nt&&r(8,U=Nt.filter),"minzoom"in Nt&&r(9,lt=Nt.minzoom),"maxzoom"in Nt&&r(10,ht=Nt.maxzoom),"hoverCursor"in Nt&&r(11,vt=Nt.hoverCursor),"manageHoverState"in Nt&&r(12,wt=Nt.manageHoverState),"hovered"in Nt&&r(0,Mt=Nt.hovered),"eventsIfTopMost"in Nt&&r(13,Dt=Nt.eventsIfTopMost),"interactive"in Nt&&r(14,Bt=Nt.interactive),"$$scope"in Nt&&r(23,l=Nt.$$scope)},[Mt,p,f,c,S,L,R,N,U,lt,ht,vt,wt,Dt,Bt,s,ie,de,Fe,ce,Ee,ge,ve,l]}class v2 extends ao{constructor(e){super(),so(this,e,Pb,Lb,Cr,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function Ab(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,s=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,s),p=Math.round(e.lat*l)/l,f=Math.round(e.lng*l)/l,c=`${r}/${p}/${f}`,S=t.getBearing(),L=t.getPitch();return(S||L)&&(c+=`/${Math.round(S*10)/10}`),L&&(c+=`/${Math.round(L)}`),`#${c}`}function Mb(t){return t.replace("#","").split("/").map(parseFloat)}var sf=gg;function gg(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?by(t,e):{}.toString.call(t)=="[object Set]"?by(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?Rb(t,e):Db(t,e)}function Db(t,e){return t.toString()===e.toString()}function by(t,e){var r=t.length;if(r!=e.length)return!1;for(var s=0;sr(6,s=R));let{position:p="top-left"}=e,{showCompass:f=!0}=e,{showZoom:c=!0}=e,{visualizePitch:S=!1}=e,L=null;return mu(()=>{s!=null&&s.loaded()&&L&&s.removeControl(L)}),t.$$set=R=>{"position"in R&&r(1,p=R.position),"showCompass"in R&&r(2,f=R.showCompass),"showZoom"in R&&r(3,c=R.showZoom),"visualizePitch"in R&&r(4,S=R.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&s&&!L&&(r(5,L=new Ps.NavigationControl({showCompass:f,showZoom:c,visualizePitch:S})),s.addControl(L,p))},[l,p,f,c,S,L,s]}class kb extends ao{constructor(e){super(),so(this,e,Nb,null,Cr,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function zb(t,e,r){let s;const{map:l}=ah();Qr(t,l,L=>r(5,s=L));let{position:p="bottom-left"}=e,{maxWidth:f=void 0}=e,{unit:c="metric"}=e,S=null;return mu(()=>{s!=null&&s.loaded()&&S&&s.removeControl(S)}),t.$$set=L=>{"position"in L&&r(1,p=L.position),"maxWidth"in L&&r(2,f=L.maxWidth),"unit"in L&&r(3,c=L.unit)},t.$$.update=()=>{t.$$.dirty&62&&s&&!S&&(r(4,S=new Ps.ScaleControl({maxWidth:f,unit:c})),s.addControl(S,p))},[l,p,f,c,S,s]}class Ob extends ao{constructor(e){super(),so(this,e,zb,null,Cr,{position:1,maxWidth:2,unit:3})}}const{window:Fb}=r1,Bb=t=>({map:t[0]&8,loadedImages:t[0]&16,allImagesLoaded:t[0]&32}),wy=t=>({map:t[3],loadedImages:t[4],allImagesLoaded:t[5]});function Iy(t){let e,r,s=t[2]&&Ey(t);const l=t[38].default,p=wl(l,t,t[37],wy);return{c(){s&&s.c(),e=Hi(),p&&p.c()},m(f,c){s&&s.m(f,c),hn(f,e,c),p&&p.m(f,c),r=!0},p(f,c){f[2]?s?(s.p(f,c),c[0]&4&&dn(s,1)):(s=Ey(f),s.c(),dn(s,1),s.m(e.parentNode,e)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh()),p&&p.p&&(!r||c[0]&56|c[1]&64)&&El(p,l,f,f[37],r?Il(l,f[37],c,Bb):Sl(f[37]),wy)},i(f){r||(dn(s),dn(p,f),r=!0)},o(f){Fn(s),Fn(p,f),r=!1},d(f){f&&an(e),s&&s.d(f),p&&p.d(f)}}}function Ey(t){let e,r,s,l,p,f,c,S;return e=new kb({props:{position:t[6]}}),s=new Cb({props:{position:t[6],fitBoundsOptions:{maxZoom:12}}}),p=new Eb({props:{position:t[6]}}),c=new Ob({props:{position:t[6]}}),{c(){du(e.$$.fragment),r=Hi(),du(s.$$.fragment),l=Hi(),du(p.$$.fragment),f=Hi(),du(c.$$.fragment)},m(L,R){_l(e,L,R),hn(L,r,R),_l(s,L,R),hn(L,l,R),_l(p,L,R),hn(L,f,R),_l(c,L,R),S=!0},p(L,R){const N={};R[0]&64&&(N.position=L[6]),e.$set(N);const U={};R[0]&64&&(U.position=L[6]),s.$set(U);const lt={};R[0]&64&&(lt.position=L[6]),p.$set(lt);const ht={};R[0]&64&&(ht.position=L[6]),c.$set(ht)},i(L){S||(dn(e.$$.fragment,L),dn(s.$$.fragment,L),dn(p.$$.fragment,L),dn(c.$$.fragment,L),S=!0)},o(L){Fn(e.$$.fragment,L),Fn(s.$$.fragment,L),Fn(p.$$.fragment,L),Fn(c.$$.fragment,L),S=!1},d(L){L&&(an(r),an(l),an(f)),yl(e,L),yl(s,L),yl(p,L),yl(c,L)}}}function Vb(t){let e,r,s,l,p,f=t[3]&&t[0]&&Iy(t);return{c(){e=sn("div"),f&&f.c(),Tn(e,"class",r=cy(t[1])+" svelte-p00lfq"),Tn(e,"data-testid","map-container"),py(e,"expand-map",!t[1])},m(c,S){hn(c,e,S),f&&f.m(e,null),s=!0,l||(p=[yp(Fb,"hashchange",t[10]),i1(t[9].call(null,e))],l=!0)},p(c,S){c[3]&&c[0]?f?(f.p(c,S),S[0]&9&&dn(f,1)):(f=Iy(c),f.c(),dn(f,1),f.m(e,null)):f&&(oh(),Fn(f,1,1,()=>{f=null}),sh()),(!s||S[0]&2&&r!==(r=cy(c[1])+" svelte-p00lfq"))&&Tn(e,"class",r),(!s||S[0]&2)&&py(e,"expand-map",!c[1])},i(c){s||(dn(f),s=!0)},o(c){Fn(f),s=!1},d(c){c&&an(e),f&&f.d(),l=!1,Lu(p)}}}function Ub(t,e,r){let s,l,p,f,{$$slots:c={},$$scope:S}=e,{map:L=null}=e,{class:R=void 0}=e,{style:N}=e,{diffStyleUpdates:U=!1}=e,{center:lt=void 0}=e,{zoom:ht=void 0}=e,{pitch:vt=0}=e,{bearing:wt=0}=e,{bounds:Mt=void 0}=e,{hash:Dt=!1}=e,{loaded:Bt=!1}=e,{minZoom:ie=0}=e,{maxZoom:de=22}=e,{antialias:Fe=void 0}=e,{zoomOnDoubleClick:ce=!0}=e,{locale:Ee=void 0}=e,{interactive:ge=!0}=e,{attributionControl:ve=!0}=e,{cooperativeGestures:Nt=!1}=e,{preserveDrawingBuffer:Jt=!1}=e,{maxBounds:ke=void 0}=e,{images:ye=[]}=e,{standardControls:Ze=!1}=e,{filterLayers:In=void 0}=e,{transformRequest:fe=void 0}=e;const Ke=hg(),{map:Pn,loadedImages:xi}=ub();Qr(t,Pn,At=>r(3,p=At)),Qr(t,xi,At=>r(4,f=At));let ln=new Set;async function Be(At,we=!1){if(p&&!(!p.loaded()&&!we))if("url"in At){ln.add(At.id);try{let qe=await p.loadImage(At.url);p==null||p.addImage(At.id,qe.data,At.options),f.add(At.id),xi.set(f)}catch(qe){Ke("error",qe)}finally{ln.delete(At.id)}}else p.addImage(At.id,At.data,At.options),f.add(At.id),xi.set(f)}let un,En,fn,cn;function An(At){return Gi(),wp(Pn,p=new Ps.Map(M0({container:At,style:N,locale:Ee,center:lt,zoom:ht,pitch:vt,bearing:wt,minZoom:ie,maxZoom:de,antialias:Fe,interactive:ge,preserveDrawingBuffer:Jt,maxBounds:ke,bounds:Mt,attributionControl:ve,transformRequest:fe,cooperativeGestures:Nt})),p),p.on("load",we=>{we.target.getContainer().setAttribute("data-testid","map"),we.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,Bt=!0),Ke("load",p)}),p.on("error",we=>Ke("error",{...we,map:p})),p.on("movestart",we=>Ke("movestart",{...we,map:p})),p.on("moveend",we=>{if(r(11,lt=we.target.getCenter()),r(12,ht=we.target.getZoom()),r(13,Mt=we.target.getBounds()),Ke("moveend",{...we,map:p}),Dt){let qe=window.location.href.replace(/(#.+)?$/,Ab(p));window.history.replaceState(window.history.state,"",qe)}}),p.on("zoomstart",we=>Ke("zoomstart",{...we,map:p})),p.on("zoom",we=>{r(12,ht=we.target.getZoom()),Ke("zoom",{...we,map:p})}),p.on("zoomend",we=>{r(12,ht=we.target.getZoom()),Ke("zoomend",{...we,map:p})}),p.on("style.load",()=>{if(p){const we=p.getStyle();if(r(34,un=we.layers.map(qe=>qe.id)),r(35,En=Object.keys(we.sources)),cn)for(const[qe,Ut]of Object.entries(cn))p.addSource(qe,Ut);if(fn)for(const qe of fn)p.addLayer(qe);for(const qe of ye)Be(qe,!0)}}),p.on("styledata",we=>{if(p&&In){const qe=p.getStyle().layers;if(qe)for(let Ut of qe)In(Ut)||p.setLayoutProperty(Ut.id,"visibility","none")}Ke("styledata",{...we,map:p})}),{destroy(){r(0,Bt=!1),p==null||p.remove(),wp(Pn,p=null,p)}}}let Wn=N;function Gi(){if(Dt){let At=Mb(window.location.hash);At.length>=3&&(r(12,ht=At[0]),r(11,lt=[At[2],At[1]])),At.length==5&&(r(16,wt=At[3]),r(15,vt=At[4]))}}return t.$$set=At=>{"map"in At&&r(14,L=At.map),"class"in At&&r(1,R=At.class),"style"in At&&r(17,N=At.style),"diffStyleUpdates"in At&&r(18,U=At.diffStyleUpdates),"center"in At&&r(11,lt=At.center),"zoom"in At&&r(12,ht=At.zoom),"pitch"in At&&r(15,vt=At.pitch),"bearing"in At&&r(16,wt=At.bearing),"bounds"in At&&r(13,Mt=At.bounds),"hash"in At&&r(19,Dt=At.hash),"loaded"in At&&r(0,Bt=At.loaded),"minZoom"in At&&r(20,ie=At.minZoom),"maxZoom"in At&&r(21,de=At.maxZoom),"antialias"in At&&r(22,Fe=At.antialias),"zoomOnDoubleClick"in At&&r(23,ce=At.zoomOnDoubleClick),"locale"in At&&r(24,Ee=At.locale),"interactive"in At&&r(25,ge=At.interactive),"attributionControl"in At&&r(26,ve=At.attributionControl),"cooperativeGestures"in At&&r(27,Nt=At.cooperativeGestures),"preserveDrawingBuffer"in At&&r(28,Jt=At.preserveDrawingBuffer),"maxBounds"in At&&r(29,ke=At.maxBounds),"images"in At&&r(30,ye=At.images),"standardControls"in At&&r(2,Ze=At.standardControls),"filterLayers"in At&&r(31,In=At.filterLayers),"transformRequest"in At&&r(32,fe=At.transformRequest),"$$scope"in At&&r(37,S=At.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&4&&r(6,s=typeof Ze=="boolean"?void 0:Ze),t.$$.dirty[0]&8&&r(14,L=p),t.$$.dirty[0]&393224|t.$$.dirty[1]&56&&p&&!sf(N,Wn)){const At=p.getStyle();if(un&&(fn=At.layers.filter(we=>!un.includes(we.id))),En){const we=Object.keys(At.sources).filter(qe=>!En.includes(qe));cn={};for(const qe of we)cn[qe]=At.sources[qe]}r(36,Wn=N),p.setStyle(N,{diff:U}),wp(xi,f=new Set,f),r(33,ln=new Set)}if(t.$$.dirty[0]&1073741849|t.$$.dirty[1]&4&&Bt&&p!=null&&p.loaded())for(let At of ye)!f.has(At.id)&&!ln.has(At.id)&&!p.hasImage(At.id)&&Be(At);t.$$.dirty[0]&1073741840&&r(5,l=ye.every(At=>f.has(At.id))),t.$$.dirty[0]&2056&<&&!sf(lt,p==null?void 0:p.getCenter())&&(p==null||p.panTo(lt)),t.$$.dirty[0]&4104&&ht&&!sf(ht,p==null?void 0:p.getZoom())&&(p==null||p.zoomTo(ht)),t.$$.dirty[0]&8200&&Mt&&!sf(Mt,p==null?void 0:p.getBounds())&&(p==null||p.fitBounds(Mt)),t.$$.dirty[0]&8388616&&(ce?p==null||p.doubleClickZoom.enable():p==null||p.doubleClickZoom.disable())},[Bt,R,Ze,p,f,l,s,Pn,xi,An,Gi,lt,ht,Mt,L,vt,wt,N,U,Dt,ie,de,Fe,ce,Ee,ge,ve,Nt,Jt,ke,ye,In,fe,ln,un,En,Wn,S,c]}class x2 extends ao{constructor(e){super(),so(this,e,Ub,Vb,Cr,{map:14,class:1,style:17,diffStyleUpdates:18,center:11,zoom:12,pitch:15,bearing:16,bounds:13,hash:19,loaded:0,minZoom:20,maxZoom:21,antialias:22,zoomOnDoubleClick:23,locale:24,interactive:25,attributionControl:26,cooperativeGestures:27,preserveDrawingBuffer:28,maxBounds:29,images:30,standardControls:2,filterLayers:31,transformRequest:32},null,[-1,-1])}}const qb=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),Sy=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function Cy(t){let e,r,s=(t[4]||t[3]instanceof Ps.Marker)&&Ty(t);return{c(){e=sn("div"),s&&s.c()},m(l,p){hn(l,e,p),s&&s.m(e,null),t[32](e),r=!0},p(l,p){l[4]||l[3]instanceof Ps.Marker?s?(s.p(l,p),p[0]&24&&dn(s,1)):(s=Ty(l),s.c(),dn(s,1),s.m(e,null)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(),t[32](null)}}}function Ty(t){let e;const r=t[30].default,s=wl(r,t,t[29],Sy);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p[0]&536870933)&&El(s,r,l,l[29],e?Il(r,l[29],p,qb):Sl(l[29]),Sy)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Gb(t){let e,r,s=t[9].default&&Cy(t);return{c(){s&&s.c(),e=If()},m(l,p){s&&s.m(l,p),hn(l,e,p),r=!0},p(l,p){l[9].default?s?(s.p(l,p),p[0]&512&&dn(s,1)):(s=Cy(l),s.c(),dn(s,1),s.m(e.parentNode,e)):s&&(oh(),Fn(s,1,1,()=>{s=null}),sh())},i(l){r||(dn(s),r=!0)},o(l){Fn(s),r=!1},d(l){l&&an(e),s&&s.d(l)}}}function jb(t,e,r){let s,l,p,f,c,S,{$$slots:L={},$$scope:R}=e;const N=n1(L);let{closeButton:U=void 0}=e,{closeOnClickOutside:lt=!0}=e,{closeOnClickInside:ht=!1}=e,{closeOnMove:vt=!1}=e,{openOn:wt="click"}=e,{openIfTopMost:Mt=!0}=e,{focusAfterOpen:Dt=!0}=e,{anchor:Bt=void 0}=e,{offset:ie=void 0}=e,{popupClass:de=void 0}=e,{maxWidth:Fe=void 0}=e,{lngLat:ce=void 0}=e,{html:Ee=void 0}=e,{open:ge=!1}=e;const ve=hg(),{map:Nt,popupTarget:Jt,layerEvent:ke,layer:ye,eventTopMost:Ze}=ah();Qr(t,Nt,Ct=>r(2,p=Ct)),Qr(t,Jt,Ct=>r(3,c=Ct)),Qr(t,ke,Ct=>r(28,f=Ct)),Qr(t,ye,Ct=>r(35,S=Ct));const In=["click","dblclick","contextmenu"];let fe,Ke=!1,Pn;function xi(){if(!fe)return;let Ct=fe.getElement();!Ct||Ct===Pn||(Pn=Ct,wt==="hover"&&(Pn.style.pointerEvents="none"),Pn.addEventListener("mouseenter",()=>{r(24,Ke=!0)},{passive:!0}),Pn.addEventListener("mouseleave",()=>{r(24,Ke=!1)},{passive:!0}),Pn.addEventListener("click",()=>{ht&&r(0,ge=!1)},{passive:!0}))}u1(()=>{if(p)return p.on("click",At),p.on("contextmenu",At),typeof c=="string"&&(p.on("click",c,En),p.on("dblclick",c,En),p.on("contextmenu",c,En),p.on("mousemove",c,Gi),p.on("mouseleave",c,Wn),p.on("touchstart",c,cn),p.on("touchend",c,An)),()=>{p!=null&&p.loaded()&&(fe==null||fe.remove(),p.off("click",At),p.off("contextmenu",At),c instanceof Ps.Marker?c.getPopup()===fe&&c.setPopup(void 0):typeof c=="string"&&(p.off("click",c,En),p.off("dblclick",c,En),p.off("contextmenu",c,En),p.off("mousemove",c,Gi),p.off("mouseleave",c,Wn),p.off("touchstart",c,cn),p.off("touchend",c,An)))}});function ln(Ct){return Mt?!("marker"in Ct)&&!hb(Ct)&&Ze(Ct)!==S:!1}let Be=null,un="normal";function En(Ct){Ct.type===wt&&(ln(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(r(10,ce=Ct.coordinate),r(4,Be=Ct.object?[Ct.object]:null)):(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[])):(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[])),setTimeout(()=>r(0,ge=!0))))}let fn=null;function cn(Ct){fn=Ct.point}function An(Ct){if(!fn||wt!=="hover")return;let bi=fn.dist(Ct.point);fn=null,bi<3&&(r(10,ce=Ct.lngLat),r(4,Be=Ct.features??[]),fe.isOpen()?r(25,un="justOpened"):(r(25,un="opening"),r(0,ge=!0)))}function Wn(Ct){wt!=="hover"||fn||un!=="normal"||(r(0,ge=!1),r(4,Be=null))}function Gi(Ct){if(!(wt!=="hover"||fn||un!=="normal")){if(ln(Ct)){r(0,ge=!1),r(4,Be=null);return}r(0,ge=!0),r(4,Be=Ct.features??[]),r(10,ce=Ct.lngLat)}}function At(Ct){if(un==="justOpened"){r(25,un="normal");return}if(!lt)return;let bi=[Pn,c instanceof Ps.Marker?c==null?void 0:c.getElement():null];ge&&fe.isOpen()&&!bi.some(si=>si==null?void 0:si.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&wt==="contextmenu"||Ct.type!=="contextmenu")&&r(0,ge=!1)}mu(()=>{p&&(fe!=null&&fe.isOpen())&&fe.remove()});let we;const qe=()=>r(0,ge=!1);function Ut(Ct){Vc[Ct?"unshift":"push"](()=>{we=Ct,r(1,we)})}return t.$$set=Ct=>{"closeButton"in Ct&&r(11,U=Ct.closeButton),"closeOnClickOutside"in Ct&&r(12,lt=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&r(13,ht=Ct.closeOnClickInside),"closeOnMove"in Ct&&r(14,vt=Ct.closeOnMove),"openOn"in Ct&&r(15,wt=Ct.openOn),"openIfTopMost"in Ct&&r(16,Mt=Ct.openIfTopMost),"focusAfterOpen"in Ct&&r(17,Dt=Ct.focusAfterOpen),"anchor"in Ct&&r(18,Bt=Ct.anchor),"offset"in Ct&&r(19,ie=Ct.offset),"popupClass"in Ct&&r(20,de=Ct.popupClass),"maxWidth"in Ct&&r(21,Fe=Ct.maxWidth),"lngLat"in Ct&&r(10,ce=Ct.lngLat),"html"in Ct&&r(22,Ee=Ct.html),"open"in Ct&&r(0,ge=Ct.open),"$$scope"in Ct&&r(29,R=Ct.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,s=U??(!lt&&!ht)),t.$$.dirty[0]&146685952&&(fe||(r(23,fe=new Ps.Popup({closeButton:s,closeOnClick:!1,closeOnMove:vt,focusAfterOpen:Dt,maxWidth:Fe,className:de,anchor:Bt,offset:ie})),Pn=fe.getElement(),fe.on("open",()=>{r(0,ge=!0),xi(),ve("open",fe)}),fe.on("close",()=>{r(0,ge=!1),ve("close",fe)}),fe.on("hover",()=>{ve("hover",fe)}))),t.$$.dirty[0]&8421384&&fe&&c instanceof Ps.Marker&&(wt==="click"?c.setPopup(fe):c.getPopup()===fe&&c.setPopup(void 0)),t.$$.dirty[0]&268468224&&In.includes(wt)&&(f==null?void 0:f.type)===wt&&(En(f),wp(ke,f=null,f)),t.$$.dirty[0]&268468224&&r(26,l=wt==="hover"&&((f==null?void 0:f.type)==="mousemove"||(f==null?void 0:f.type)==="mouseenter")),t.$$.dirty[0]&352354304&&wt==="hover"&&ke&&(l&&f&&(f.layerType==="deckgl"?(r(10,ce=f.coordinate),r(4,Be=f.object?[f.object]:null)):(r(10,ce=f.lngLat),r(4,Be=f.features??[]))),r(0,ge=(l||Ke)??!1)),t.$$.dirty[0]&12582914&&(we?fe.setDOMContent(we):Ee&&fe.setHTML(Ee)),t.$$.dirty[0]&8389632&&ce&&fe.setLngLat(ce),t.$$.dirty[0]&41943045&&p){let Ct=fe.isOpen();ge&&!Ct?(fe.addTo(p),un==="opening"&&r(25,un="justOpened")):!ge&&Ct&&fe.remove()}},[ge,we,p,c,Be,Nt,Jt,ke,ye,N,ce,U,lt,ht,vt,wt,Mt,Dt,Bt,ie,de,Fe,Ee,fe,Ke,un,l,s,f,R,L,qe,Ut]}class Zb extends ao{constructor(e){super(),so(this,e,jb,Gb,Cr,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}let mp={origins:"blue",destinations:"purple",lts1:"#009e73",lts2:"#56b4e9",lts3:"#e69f00",lts4:"#d55e00",lts_not_allowed:"red"},b2=["match",["get","lts"],0,mp.lts_not_allowed,1,mp.lts1,2,mp.lts2,3,mp.lts3,4,mp.lts4,"red"],w2=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],I2={lts1:"LTS 1 - suitable for children",lts2:"LTS 2 - low stress",lts3:"LTS 3 - medium stress",lts4:"LTS 4 - high stress",lts_not_allowed:"Cyclists not allowed"},E2=[0,3,5,8,10,20,100],S2=["#267300","#70A800","#FFAA00","#E60000","#A80000","#730000"];const Ly="/od2net/assets/logo-fbff26ba.png";function Hb(t){let e,r,s,l,p,f,c,S,L,R,N,U,lt,ht,vt,wt,Mt,Dt,Bt,ie,de,Fe,ce,Ee,ge,ve,Nt,Jt,ke;return{c(){e=sn("div"),r=sn("img"),l=Hi(),p=sn("select"),f=sn("option"),f.textContent="Pre-built route networks",c=sn("option"),c.textContent="Interactively generate route networks",S=sn("option"),S.textContent="Explore edge costs",L=Hi(),R=sn("dialog"),N=sn("div"),U=sn("h1"),U.textContent="About od2net",lt=Hi(),ht=sn("button"),ht.textContent="Close",vt=Hi(),wt=sn("img"),Dt=Hi(),Bt=sn("p"),Bt.innerHTML=`od2net is an open-source project by Dustin Carlino , part of the @@ -588,7 +588,7 @@ uniform ${D} ${k} u_${V}; for the logo and Stuart Lynn for feedback and help with pmtiles, both from - the Alan Turing Institute`,Fe=Hi(),ce=sn("button"),ce.textContent="About",Ee=Hi(),ge=sn("br"),ve=Hi(),Nt=sn("br"),uy(r.src,s=Ly)||Tn(r,"src",s),Tn(r,"width","100"),Tn(r,"alt","od2net logo by Hadrien Salat"),Tn(r,"class","svelte-1ey54bq"),f.__value="main",Vm(f,f.__value),Tn(f,"class","svelte-1ey54bq"),c.__value="interactive",Vm(c,c.__value),Tn(c,"class","svelte-1ey54bq"),S.__value="costs",Vm(S,S.__value),Tn(S,"class","svelte-1ey54bq"),Tn(p,"class","svelte-1ey54bq"),t[0]===void 0&&pf(()=>t[3].call(p)),Ro(e,"display","flex"),Ro(e,"justify-content","space-between"),Tn(e,"class","svelte-1ey54bq"),Tn(U,"class","svelte-1ey54bq"),Tn(ht,"class","svelte-1ey54bq"),Ro(N,"display","flex"),Ro(N,"justify-content","space-between"),Tn(N,"class","svelte-1ey54bq"),uy(wt.src,Mt=Ly)||Tn(wt,"src",Mt),Tn(wt,"width","300"),Tn(wt,"alt","od2net logo by Hadrien Salat"),Tn(wt,"class","svelte-1ey54bq"),Tn(Bt,"class","svelte-1ey54bq"),Tn(de,"class","svelte-1ey54bq"),Tn(R,"class","svelte-1ey54bq"),Tn(ce,"class","svelte-1ey54bq"),Tn(ge,"class","svelte-1ey54bq"),Tn(Nt,"class","svelte-1ey54bq")},m(ye,Ze){hn(ye,e,Ze),Cn(e,r),Cn(e,l),Cn(e,p),Cn(p,f),Cn(p,c),Cn(p,S),hy(p,t[0],!0),hn(ye,L,Ze),hn(ye,R,Ze),Cn(R,N),Cn(N,U),Cn(N,lt),Cn(N,ht),Cn(R,vt),Cn(R,wt),Cn(R,Dt),Cn(R,Bt),Cn(R,ie),Cn(R,de),t[5](R),hn(ye,Fe,Ze),hn(ye,ce,Ze),hn(ye,Ee,Ze),hn(ye,ge,Ze),hn(ye,ve,Ze),hn(ye,Nt,Ze),Jt||(ke=[yp(p,"change",t[3]),yp(p,"change",t[2]),yp(ht,"click",t[4]),yp(ce,"click",t[6])],Jt=!0)},p(ye,[Ze]){Ze&1&&hy(p,ye[0])},i:wr,o:wr,d(ye){ye&&(an(e),an(L),an(R),an(Fe),an(ce),an(Ee),an(ge),an(ve),an(Nt)),t[5](null),Jt=!1,Lu(ke)}}}function Wb(t,e,r){let{app:s}=e,l;function p(){s=="main"?window.location.href="index.html":s=="interactive"?window.location.href="interactive.html":s=="costs"&&(window.location.href="edge_cost.html")}function f(){s=a1(this),r(0,s)}const c=()=>l.close();function S(R){Vc[R?"unshift":"push"](()=>{l=R,r(1,l)})}const L=()=>l.showModal();return t.$$set=R=>{"app"in R&&r(0,s=R.app)},[s,l,p,f,c,S,L]}class T2 extends ao{constructor(e){super(),so(this,e,Wb,Hb,Cr,{app:0})}}const Xb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xb);const Yb=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Kb={decimalLatitude:40.123,decimalLongitude:-74.123},Jb=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Qb=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function $b(){const t=[];return Yb.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Kb})}),[...t,...Jb,...Qb]}const tw=$b();tw.map(t=>t.verbatimCoordinates);/** + the Alan Turing Institute`,Fe=Hi(),ce=sn("button"),ce.textContent="About",Ee=Hi(),ge=sn("br"),ve=Hi(),Nt=sn("br"),uy(r.src,s=Ly)||Tn(r,"src",s),Tn(r,"width","100"),Tn(r,"alt","od2net logo by Hadrien Salat"),Tn(r,"class","svelte-1ey54bq"),f.__value="main",Vm(f,f.__value),Tn(f,"class","svelte-1ey54bq"),c.__value="interactive",Vm(c,c.__value),Tn(c,"class","svelte-1ey54bq"),S.__value="costs",Vm(S,S.__value),Tn(S,"class","svelte-1ey54bq"),Tn(p,"class","svelte-1ey54bq"),t[0]===void 0&&pf(()=>t[3].call(p)),Ro(e,"display","flex"),Ro(e,"justify-content","space-between"),Tn(e,"class","svelte-1ey54bq"),Tn(U,"class","svelte-1ey54bq"),Tn(ht,"class","svelte-1ey54bq"),Ro(N,"display","flex"),Ro(N,"justify-content","space-between"),Tn(N,"class","svelte-1ey54bq"),uy(wt.src,Mt=Ly)||Tn(wt,"src",Mt),Tn(wt,"width","300"),Tn(wt,"alt","od2net logo by Hadrien Salat"),Tn(wt,"class","svelte-1ey54bq"),Tn(Bt,"class","svelte-1ey54bq"),Tn(de,"class","svelte-1ey54bq"),Tn(R,"class","svelte-1ey54bq"),Tn(ce,"class","svelte-1ey54bq"),Tn(ge,"class","svelte-1ey54bq"),Tn(Nt,"class","svelte-1ey54bq")},m(ye,Ze){hn(ye,e,Ze),Cn(e,r),Cn(e,l),Cn(e,p),Cn(p,f),Cn(p,c),Cn(p,S),hy(p,t[0],!0),hn(ye,L,Ze),hn(ye,R,Ze),Cn(R,N),Cn(N,U),Cn(N,lt),Cn(N,ht),Cn(R,vt),Cn(R,wt),Cn(R,Dt),Cn(R,Bt),Cn(R,ie),Cn(R,de),t[5](R),hn(ye,Fe,Ze),hn(ye,ce,Ze),hn(ye,Ee,Ze),hn(ye,ge,Ze),hn(ye,ve,Ze),hn(ye,Nt,Ze),Jt||(ke=[yp(p,"change",t[3]),yp(p,"change",t[2]),yp(ht,"click",t[4]),yp(ce,"click",t[6])],Jt=!0)},p(ye,[Ze]){Ze&1&&hy(p,ye[0])},i:wr,o:wr,d(ye){ye&&(an(e),an(L),an(R),an(Fe),an(ce),an(Ee),an(ge),an(ve),an(Nt)),t[5](null),Jt=!1,Lu(ke)}}}function Wb(t,e,r){let{app:s}=e,l;function p(){s=="main"?window.location.href="index.html":s=="interactive"?window.location.href="interactive.html":s=="costs"&&(window.location.href="edge_cost.html")}function f(){s=a1(this),r(0,s)}const c=()=>l.close();function S(R){Vc[R?"unshift":"push"](()=>{l=R,r(1,l)})}const L=()=>l.showModal();return t.$$set=R=>{"app"in R&&r(0,s=R.app)},[s,l,p,f,c,S,L]}class C2 extends ao{constructor(e){super(),so(this,e,Wb,Hb,Cr,{app:0})}}const Xb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xb);const Yb=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Kb={decimalLatitude:40.123,decimalLongitude:-74.123},Jb=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Qb=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function $b(){const t=[];return Yb.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Kb})}),[...t,...Jb,...Qb]}const tw=$b();tw.map(t=>t.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -612,5 +612,5 @@ and limitations under the License. `);var p=e+(r?" ":"│ ");t.left&&ng(t.left,p,!1,s,l),t.right&&ng(t.right,p,!0,s,l)}}var _g=function(){function t(e){e===void 0&&(e=nw),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,r){return this._size++,this._root=Xm(e,r,this._root,this._comparator)},t.prototype.add=function(e,r){var s=new Tl(e,r);this._root===null&&(s.left=s.right=null,this._size++,this._root=s);var l=this._comparator,p=ml(e,this._root,l),f=l(e,p.key);return f===0?this._root=p:(f<0?(s.left=p.left,s.right=p,p.left=null):f>0&&(s.right=p.right,s.left=p,p.right=null),this._size++,this._root=s),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,r,s){var l;if(r===null)return null;r=ml(e,r,s);var p=s(e,r.key);return p===0?(r.left===null?l=r.right:(l=ml(e,r.left,s),l.right=r.right),this._size--,l):r},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=ml(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return r;l<0?r=r.left:r=r.right}return null},t.prototype.find=function(e){return this._root&&(this._root=ml(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return!0;l<0?r=r.left:r=r.right}return!1},t.prototype.forEach=function(e,r){for(var s=this._root,l=[],p=!1;!p;)s!==null?(l.push(s),s=s.left):l.length!==0?(s=l.pop(),e.call(r,s),s=s.right):p=!0;return this},t.prototype.range=function(e,r,s,l){for(var p=[],f=this._comparator,c=this._root,S;p.length!==0||c;)if(c)p.push(c),c=c.left;else{if(c=p.pop(),S=f(c.key,r),S>0)break;if(f(c.key,e)>=0&&s.call(l,c))return this;c=c.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(r){var s=r.key;return e.push(s)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(r){var s=r.data;return e.push(s)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var r=this._root,s=!1,l=0,p=[];!s;)if(r)p.push(r),r=r.left;else if(p.length>0){if(r=p.pop(),l===e)return r;l++,r=r.right}else s=!0;return null},t.prototype.next=function(e){var r=this._root,s=null;if(e.right){for(s=e.right;s.left;)s=s.left;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?(s=r,r=r.left):r=r.right}return s},t.prototype.prev=function(e){var r=this._root,s=null;if(e.left!==null){for(s=e.left;s.right;)s=s.right;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?r=r.left:(s=r,r=r.right)}return s},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return ow(this._root)},t.prototype.load=function(e,r,s){r===void 0&&(r=[]),s===void 0&&(s=!1);var l=e.length,p=this._comparator;if(s&&og(e,r,0,l-1,p),this._root===null)this._root=ig(e,r,0,l),this._size=l;else{var f=sw(this.toList(),rw(e,r),p);l=this._size+l,this._root=rg({head:f},0,l)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(s){return String(s.key)});var r=[];return ng(this._root,"",!0,function(s){return r.push(s)},e),r.join("")},t.prototype.update=function(e,r,s){var l=this._comparator,p=Py(e,this._root,l),f=p.left,c=p.right;l(e,r)<0?c=Xm(r,s,c,l):f=Xm(r,s,f,l),this._root=iw(f,c,l)},t.prototype.split=function(e){return Py(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,r,s;return ew(this,function(l){switch(l.label){case 0:e=this._root,r=[],s=!1,l.label=1;case 1:return s?[3,6]:e===null?[3,2]:(r.push(e),e=e.left,[3,5]);case 2:return r.length===0?[3,4]:(e=r.pop(),[4,e]);case 3:return l.sent(),e=e.right,[3,5];case 4:s=!0,l.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function ig(t,e,r,s){var l=s-r;if(l>0){var p=r+Math.floor(l/2),f=t[p],c=e[p],S=new Tl(f,c);return S.left=ig(t,e,r,p),S.right=ig(t,e,p+1,s),S}return null}function rw(t,e){for(var r=new Tl(null,null),s=r,l=0;l0?(e=p=p.next=r.pop(),e=e.right):s=!0;return p.next=null,l.next}function rg(t,e,r){var s=r-e;if(s>0){var l=e+Math.floor(s/2),p=rg(t,e,l),f=t.head;return f.left=p,t.head=t.head.next,f.right=rg(t,l+1,r),f}return null}function sw(t,e,r){for(var s=new Tl(null,null),l=s,p=t,f=e;p!==null&&f!==null;)r(p.key,f.key)<0?(l.next=p,p=p.next):(l.next=f,f=f.next),l=l.next;return p!==null?l.next=p:f!==null&&(l.next=f),s.next}function og(t,e,r,s,l){if(!(r>=s)){for(var p=t[r+s>>1],f=r-1,c=s+1;;){do f++;while(l(t[f],p)<0);do c--;while(l(t[c],p)>0);if(f>=c)break;var S=t[f];t[f]=t[c],t[c]=S,S=e[f],e[f]=e[c],e[c]=S}og(t,e,r,c,l),og(t,e,c+1,s,l)}}function _s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ay(t,e){for(var r=0;rr.x?1:e.yr.y?1:0}}]);function t(e,r){_s(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return to(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var r=e.point.events,s=0,l=r.length;s=0&&N>=0?LU?-1:0:S<0&&N<0?LU?1:0:NS?1:0}}}]),t}(),pw=0,gf=function(){to(t,null,[{key:"compare",value:function(e,r){var s=e.leftSE.point.x,l=r.leftSE.point.x,p=e.rightSE.point.x,f=r.rightSE.point.x;if(fc&&S>L)return-1;var N=e.comparePoint(r.leftSE.point);if(N<0)return 1;if(N>0)return-1;var U=r.comparePoint(e.rightSE.point);return U!==0?U:-1}if(s>l){if(cS&&c>R)return 1;var lt=r.comparePoint(e.leftSE.point);if(lt!==0)return lt;var ht=e.comparePoint(r.rightSE.point);return ht<0?1:ht>0?-1:1}if(cS)return 1;if(pf){var wt=e.comparePoint(r.rightSE.point);if(wt<0)return 1;if(wt>0)return-1}if(p!==f){var Mt=L-c,Dt=p-s,Bt=R-S,ie=f-l;if(Mt>Dt&&Btie)return-1}return p>f?1:pR?1:e.idr.id?1:0}}]);function t(e,r,s,l){_s(this,t),this.id=++pw,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=s,this.windings=l}return to(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:er?e:r}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var r=this.leftSE.point,s=this.rightSE.point,l=this.vector();if(r.x===s.x)return e.x===r.x?0:e.x0&&c.swapEvents(),ia.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(l.checkForConsuming(),p.checkForConsuming()),r}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var r=0,s=this.windings.length;r0){var p=r;r=s,s=p}if(r.prev===s){var f=r;r=s,s=f}for(var c=0,S=s.rings.length;c0)l=r,p=e,f=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var S=new ia(l,!0),L=new ia(p,!1);return new t(S,L,[s],[f])}}]),t}(),ky=function(){function t(e,r,s){if(_s(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=s,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=Pp.round(e[0][0],e[0][1]);this.bbox={ll:{x:l.x,y:l.y},ur:{x:l.x,y:l.y}};for(var p=l,f=1,c=e.length;fthis.bbox.ur.x&&(this.bbox.ur.x=S.x),S.y>this.bbox.ur.y&&(this.bbox.ur.y=S.y),p=S)}(l.x!==p.x||l.y!==p.y)&&this.segments.push(gf.fromRing(p,l,this))}return to(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.segments.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.interiorRings.push(p)}this.multiPoly=r}return to(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),r=0,s=this.interiorRings.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.polys.push(p)}this.isSubject=r}return to(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.polys.length;r0&&(e=l)}for(var p=e.segment.prevInResult(),f=p?p.prevInResult():null;;){if(!p)return null;if(!f)return p.ringOut;if(f.ringOut!==p.ringOut)return f.ringOut.enclosingRing()!==p.ringOut?p.ringOut:p.ringOut.enclosingRing();p=f.prevInResult(),f=p?p.prevInResult():null}}}]),t}(),Oy=function(){function t(e){_s(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return to(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var r=0,s=this.interiorRings.length;r1&&arguments[1]!==void 0?arguments[1]:gf.compare;_s(this,t),this.queue=e,this.tree=new _g(r),this.segments=[]}return to(t,[{key:"process",value:function(e){var r=e.segment,s=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(r),s;var l=e.isLeft?this.tree.insert(r):this.tree.find(r);if(!l)throw new Error("Unable to find segment #".concat(r.id," ")+"[".concat(r.leftSE.point.x,", ").concat(r.leftSE.point.y,"] -> ")+"[".concat(r.rightSE.point.x,", ").concat(r.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var p=l,f=l,c=void 0,S=void 0;c===void 0;)p=this.tree.prev(p),p===null?c=null:p.key.consumedBy===void 0&&(c=p.key);for(;S===void 0;)f=this.tree.next(f),f===null?S=null:f.key.consumedBy===void 0&&(S=f.key);if(e.isLeft){var L=null;if(c){var R=c.getIntersection(r);if(R!==null&&(r.isAnEndpoint(R)||(L=R),!c.isAnEndpoint(R)))for(var N=this._splitSafely(c,R),U=0,lt=N.length;U0?(this.tree.remove(r),s.push(e)):(this.segments.push(r),r.prev=c)}else{if(c&&S){var Ee=c.getIntersection(S);if(Ee!==null){if(!c.isAnEndpoint(Ee))for(var ge=this._splitSafely(c,Ee),ve=0,Nt=ge.length;veFy)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var ie=new gw(ht),de=ht.size,Fe=ht.pop();Fe;){var ce=Fe.key;if(ht.size===de){var Ee=ce.segment;throw new Error("Unable to pop() ".concat(ce.isLeft?"left":"right"," SweepEvent ")+"[".concat(ce.point.x,", ").concat(ce.point.y,"] from segment #").concat(Ee.id," ")+"[".concat(Ee.leftSE.point.x,", ").concat(Ee.leftSE.point.y,"] -> ")+"[".concat(Ee.rightSE.point.x,", ").concat(Ee.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(ht.size>Fy)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(ie.segments.length>_w)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ge=ie.process(ce),ve=0,Nt=ge.length;ver[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]e.x?1:this.ye.y?1:0};ct.prototype.clone=function(){};ct.prototype.copy=function(){return new ct(this)};ct.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};ct.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,s=this.z-t.z;return Math.sqrt(e*e+r*r+s*s)};ct.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)};ct.prototype.hashCode=function(){var t=17;return t=37*t+ct.hashCode(this.x),t=37*t+ct.hashCode(this.y),t};ct.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};ct.prototype.interfaces_=function(){return[xo,Ef,bo]};ct.prototype.getClass=function(){return ct};ct.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=be.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Pu.DimensionalComparator.get=function(){return Da};Pu.serialVersionUID.get=function(){return 6683108902428367e3};Pu.NULL_ORDINATE.get=function(){return be.NaN};Pu.X.get=function(){return 0};Pu.Y.get=function(){return 1};Pu.Z.get=function(){return 2};Object.defineProperties(ct,Pu);var Da=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Rn("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Da.prototype.compare=function(t,e){var r=t,s=e,l=Da.compare(r.x,s.x);if(l!==0)return l;var p=Da.compare(r.y,s.y);if(p!==0)return p;if(this._dimensionsToTest<=2)return 0;var f=Da.compare(r.z,s.z);return f};Da.prototype.interfaces_=function(){return[Uc]};Da.prototype.getClass=function(){return Da};Da.compare=function(t,e){return te?1:be.isNaN(t)?be.isNaN(e)?0:-1:be.isNaN(e)?1:0};var qc=function(){};qc.prototype.create=function(){};qc.prototype.interfaces_=function(){return[]};qc.prototype.getClass=function(){return qc};var dt=function(){},Zp={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};dt.prototype.interfaces_=function(){return[]};dt.prototype.getClass=function(){return dt};dt.toLocationSymbol=function(t){switch(t){case dt.EXTERIOR:return"e";case dt.BOUNDARY:return"b";case dt.INTERIOR:return"i";case dt.NONE:return"-"}throw new Rn("Unknown location value: "+t)};Zp.INTERIOR.get=function(){return 0};Zp.BOUNDARY.get=function(){return 1};Zp.EXTERIOR.get=function(){return 2};Zp.NONE.get=function(){return-1};Object.defineProperties(dt,Zp);var me=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},eo=function(){},z0={LOG_10:{configurable:!0}};eo.prototype.interfaces_=function(){return[]};eo.prototype.getClass=function(){return eo};eo.log10=function(t){var e=Math.log(t);return be.isInfinite(e)||be.isNaN(e)?e:e/eo.LOG_10};eo.min=function(t,e,r,s){var l=t;return er?r:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],l=arguments[1],p=arguments[2];return sp?p:s}};eo.wrap=function(t,e){return t<0?e- -t%e:t%e};eo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2],s=t;return e>s&&(s=e),r>s&&(s=r),s}else if(arguments.length===4){var l=arguments[0],p=arguments[1],f=arguments[2],c=arguments[3],S=l;return p>S&&(S=p),f>S&&(S=f),c>S&&(S=c),S}};eo.average=function(t,e){return(t+e)/2};z0.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(eo,z0);var ys=function(t){this.str=t};ys.prototype.append=function(t){this.str+=t};ys.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};ys.prototype.toString=function(t){return this.str};var as=function(t){this.value=t};as.prototype.intValue=function(){return this.value};as.prototype.compareTo=function(t){return this.valuet?1:0};as.isNaN=function(t){return Number.isNaN(t)};var Ap=function(){};Ap.isWhitespace=function(t){return t<=32&&t>=0||t===127};Ap.toUpperCase=function(t){return t.toUpperCase()};var _t=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var s=arguments[0];t.call(this,t.parse(s))}}else if(arguments.length===2){var l=arguments[0],p=arguments[1];this.init(l,p)}},Go={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};_t.prototype.le=function(t){return(this._hi9?(R=!0,N="9"):N="0"+L,f.append(N),r=r.subtract(_t.valueOf(L)).multiply(_t.TEN),R&&r.selfAdd(_t.TEN);var U=!0,lt=_t.magnitude(r._hi);if(lt<0&&Math.abs(lt)>=c-S&&(U=!1),!U)break}return e[0]=s,f.toString()};_t.prototype.sqr=function(){return this.multiply(this)};_t.prototype.doubleValue=function(){return this._hi+this._lo};_t.prototype.subtract=function(){if(arguments[0]instanceof _t){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};_t.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};_t.prototype.isZero=function(){return this._hi===0&&this._lo===0};_t.prototype.selfSubtract=function(){if(arguments[0]instanceof _t){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};_t.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};_t.prototype.min=function(t){return this.le(t)?this:t};_t.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof _t){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,f=null,c=null,S=null,L=null,R=null,N=null;return S=this._hi/r,L=_t.SPLIT*S,l=L-S,N=_t.SPLIT*r,l=L-l,p=S-l,f=N-r,R=S*r,f=N-f,c=r-f,N=l*f-R+l*c+p*f+p*c,L=(this._hi-R-N+this._lo-S*s)/r,N=S+L,this._hi=N,this._lo=S-N+L,this}};_t.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};_t.prototype.divide=function(){if(arguments[0]instanceof _t){var t=arguments[0],e=null,r=null,s=null,l=null,p=null,f=null,c=null,S=null;p=this._hi/t._hi,f=_t.SPLIT*p,e=f-p,S=_t.SPLIT*t._hi,e=f-e,r=p-e,s=S-t._hi,c=p*t._hi,s=S-s,l=t._hi-s,S=e*s-c+e*l+r*s+r*l,f=(this._hi-c-S+this._lo-p*t._lo)/t._hi,S=p+f;var L=S,R=p-S+f;return new _t(L,R)}else if(typeof arguments[0]=="number"){var N=arguments[0];return be.isNaN(N)?_t.createNaN():_t.copy(this).selfDivide(N,0)}};_t.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};_t.prototype.pow=function(t){if(t===0)return _t.valueOf(1);var e=new _t(this),r=_t.valueOf(1),s=Math.abs(t);if(s>1)for(;s>0;)s%2===1&&r.selfMultiply(e),s/=2,s>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r};_t.prototype.ceil=function(){if(this.isNaN())return _t.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new _t(t,e)};_t.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};_t.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};_t.prototype.setValue=function(){if(arguments[0]instanceof _t){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};_t.prototype.max=function(t){return this.ge(t)?this:t};_t.prototype.sqrt=function(){if(this.isZero())return _t.valueOf(0);if(this.isNegative())return _t.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=_t.valueOf(e),s=this.subtract(r.sqr()),l=s._hi*(t*.5);return r.add(l)};_t.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof _t){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],r=null,s=null,l=null,p=null,f=null,c=null;return l=this._hi+e,f=l-this._hi,p=l-f,p=e-f+(this._hi-p),c=p+this._lo,r=l+c,s=c+(l-r),this._hi=r+s,this._lo=s+(r-this._hi),this}}else if(arguments.length===2){var S=arguments[0],L=arguments[1],R=null,N=null,U=null,lt=null,ht=null,vt=null,wt=null,Mt=null;ht=this._hi+S,U=this._lo+L,wt=ht-this._hi,Mt=U-this._lo,vt=ht-wt,lt=U-Mt,vt=S-wt+(this._hi-vt),lt=L-Mt+(this._lo-lt),wt=vt+U,R=ht+wt,N=wt+(ht-R),wt=lt+N;var Dt=R+wt,Bt=wt+(R-Dt);return this._hi=Dt,this._lo=Bt,this}};_t.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof _t){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,f=null,c=null,S=null,L=null;S=_t.SPLIT*this._hi,l=S-this._hi,L=_t.SPLIT*r,l=S-l,p=this._hi-l,f=L-r,S=this._hi*r,f=L-f,c=r-f,L=l*f-S+l*c+p*f+p*c+(this._hi*s+this._lo*r);var R=S+L;l=S-R;var N=L+l;return this._hi=R,this._lo=N,this}};_t.prototype.selfSqr=function(){return this.selfMultiply(this)};_t.prototype.floor=function(){if(this.isNaN())return _t.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new _t(t,e)};_t.prototype.negate=function(){return this.isNaN()?this:new _t(-this._hi,-this._lo)};_t.prototype.clone=function(){};_t.prototype.multiply=function(){if(arguments[0]instanceof _t){var t=arguments[0];return t.isNaN()?_t.createNaN():_t.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return be.isNaN(e)?_t.createNaN():_t.copy(this).selfMultiply(e,0)}};_t.prototype.isNaN=function(){return be.isNaN(this._hi)};_t.prototype.intValue=function(){return Math.trunc(this._hi)};_t.prototype.toString=function(){var t=_t.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};_t.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),s=e[0]+1,l=r;if(r.charAt(0)===".")l="0"+r;else if(s<0)l="0."+_t.stringOfChar("0",-s)+r;else if(r.indexOf(".")===-1){var p=s-r.length,f=_t.stringOfChar("0",p);l=r+f+".0"}return this.isNegative()?"-"+l:l};_t.prototype.reciprocal=function(){var t=null,e=null,r=null,s=null,l=null,p=null,f=null,c=null;l=1/this._hi,p=_t.SPLIT*l,t=p-l,c=_t.SPLIT*this._hi,t=p-t,e=l-t,r=c-this._hi,f=l*this._hi,r=c-r,s=this._hi-r,c=t*r-f+t*s+e*r+e*s,p=(1-f-c-l*this._lo)/this._hi;var S=l+p,L=l-S+p;return new _t(S,L)};_t.prototype.toSciNotation=function(){if(this.isZero())return _t.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),s=_t.SCI_NOT_EXPONENT_CHAR+e[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var l="";r.length>1&&(l=r.substring(1));var p=r.charAt(0)+"."+l;return this.isNegative()?"-"+p+s:p+s};_t.prototype.abs=function(){return this.isNaN()?_t.NaN:this.isNegative()?this.negate():new _t(this)};_t.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};_t.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};_t.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};_t.prototype.trunc=function(){return this.isNaN()?_t.NaN:this.isPositive()?this.floor():this.ceil()};_t.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};_t.prototype.interfaces_=function(){return[bo,xo,Ef]};_t.prototype.getClass=function(){return _t};_t.sqr=function(t){return _t.valueOf(t).selfMultiply(t)};_t.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return _t.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new _t(e)}};_t.sqrt=function(t){return _t.valueOf(t).sqrt()};_t.parse=function(t){for(var e=0,r=t.length;Ap.isWhitespace(t.charAt(e));)e++;var s=!1;if(e=r);){var L=t.charAt(e);if(e++,Ap.isDigit(L)){var R=L-"0";p.selfMultiply(_t.TEN),p.selfAdd(R),f++;continue}if(L==="."){c=f;continue}if(L==="e"||L==="E"){var N=t.substring(e);try{S=as.parseInt(N)}catch(wt){throw wt instanceof Error?new Error("Invalid exponent "+N+" in string "+t):wt}finally{}break}throw new Error("Unexpected character '"+L+"' at position "+e+" in string "+t)}var U=p,lt=f-c-S;if(lt===0)U=p;else if(lt>0){var ht=_t.TEN.pow(lt);U=p.divide(ht)}else if(lt<0){var vt=_t.TEN.pow(-lt);U=p.multiply(vt)}return s?U.negate():U};_t.createNaN=function(){return new _t(be.NaN,be.NaN)};_t.copy=function(t){return new _t(t)};_t.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),s=Math.trunc(Math.floor(r)),l=Math.pow(10,s);return l*10<=e&&(s+=1),s};_t.stringOfChar=function(t,e){for(var r=new ys,s=0;s0){if(p<=0)return xr.signum(f);s=l+p}else if(l<0){if(p>=0)return xr.signum(f);s=-l-p}else return xr.signum(f);var c=xr.DP_SAFE_EPSILON*s;return f>=c||-f>=c?xr.signum(f):2};xr.signum=function(t){return t>0?1:t<0?-1:0};O0.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(xr,O0);var Ye=function(){},Hp={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Hp.X.get=function(){return 0};Hp.Y.get=function(){return 1};Hp.Z.get=function(){return 2};Hp.M.get=function(){return 3};Ye.prototype.setOrdinate=function(t,e,r){};Ye.prototype.size=function(){};Ye.prototype.getOrdinate=function(t,e){};Ye.prototype.getCoordinate=function(){};Ye.prototype.getCoordinateCopy=function(t){};Ye.prototype.getDimension=function(){};Ye.prototype.getX=function(t){};Ye.prototype.clone=function(){};Ye.prototype.expandEnvelope=function(t){};Ye.prototype.copy=function(){};Ye.prototype.getY=function(t){};Ye.prototype.toCoordinateArray=function(){};Ye.prototype.interfaces_=function(){return[Ef]};Ye.prototype.getClass=function(){return Ye};Object.defineProperties(Ye,Hp);var F0=function(){},lh=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(F0),Bi=function(){};Bi.arraycopy=function(t,e,r,s,l){for(var p=0,f=e;ft._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,s=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&s>=this._miny&&s<=this._maxy}};oe.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof oe){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||rthis._maxy||sthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=s,this._maxy=s):(rthis._maxx&&(this._maxx=r),sthis._maxy&&(this._maxy=s))}};oe.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};oe.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};oe.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};oe.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};oe.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};oe.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};oe.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};oe.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof oe){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof ct){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.covers(r,s)}};oe.prototype.centre=function(){return this.isNull()?null:new ct((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};oe.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ct){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof oe){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r.x,s.x,r.y,s.y)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],f=arguments[2],c=arguments[3];lt._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxyt._maxy&&(r=this._miny-t._maxy),e===0?r:r===0?e:Math.sqrt(e*e+r*r)};oe.prototype.hashCode=function(){var t=17;return t=37*t+ct.hashCode(this._minx),t=37*t+ct.hashCode(this._maxx),t=37*t+ct.hashCode(this._miny),t=37*t+ct.hashCode(this._maxy),t};oe.prototype.interfaces_=function(){return[xo,bo]};oe.prototype.getClass=function(){return oe};oe.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.xe.x?t.x:e.x)&&r.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],p=arguments[2],f=arguments[3],c=Math.min(p.x,f.x),S=Math.max(p.x,f.x),L=Math.min(s.x,l.x),R=Math.max(s.x,l.x);return!(L>S||RS)||Rr?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};Bn.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};Bn.prototype.setPrecisionModel=function(t){this._precisionModel=t};Bn.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],r=0;rl?p=s:p=l;else{var f=Math.abs(t.x-e.x),c=Math.abs(t.y-e.y);s>l?p=f:p=c,p===0&&!t.equals(e)&&(p=Math.max(f,c))}return Pe.isTrue(!(p===0&&!t.equals(e)),"Bad distance calculation"),p};Bn.nonRobustComputeEdgeDistance=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=Math.sqrt(s*s+l*l);return Pe.isTrue(!(p===0&&!t.equals(e)),"Invalid distance calculation"),p};Au.DONT_INTERSECT.get=function(){return 0};Au.DO_INTERSECT.get=function(){return 1};Au.COLLINEAR.get=function(){return 2};Au.NO_INTERSECTION.get=function(){return 0};Au.POINT_INTERSECTION.get=function(){return 1};Au.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(Bn,Au);var Ol=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(r){var s=new oe(this._inputLines[0][0],this._inputLines[0][1]),l=new oe(this._inputLines[1][0],this._inputLines[1][1]);return s.contains(r)&&l.contains(r)},e.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];if(this._isProper=!1,oe.intersects(s,l,r)&&Kt.orientationIndex(s,l,r)===0&&Kt.orientationIndex(l,s,r)===0)return this._isProper=!0,(r.equals(s)||r.equals(l))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(r,s,l,p,f){f.x=this.smallestInAbsValue(r.x,s.x,l.x,p.x),f.y=this.smallestInAbsValue(r.y,s.y,l.y,p.y),r.x-=f.x,r.y-=f.y,s.x-=f.x,s.y-=f.y,l.x-=f.x,l.y-=f.y,p.x-=f.x,p.y-=f.y},e.prototype.safeHCoordinateIntersection=function(r,s,l,p){var f=null;try{f=No.intersection(r,s,l,p)}catch(c){if(c instanceof lh)f=e.nearestEndpoint(r,s,l,p);else throw c}finally{}return f},e.prototype.intersection=function(r,s,l,p){var f=this.intersectionWithNormalization(r,s,l,p);return this.isInSegmentEnvelopes(f)||(f=new ct(e.nearestEndpoint(r,s,l,p))),this._precisionModel!==null&&this._precisionModel.makePrecise(f),f},e.prototype.smallestInAbsValue=function(r,s,l,p){var f=r,c=Math.abs(f);return Math.abs(s)1e-4&&Bi.out.println("Distance = "+f.distance(c))},e.prototype.intersectionWithNormalization=function(r,s,l,p){var f=new ct(r),c=new ct(s),S=new ct(l),L=new ct(p),R=new ct;this.normalizeToEnvCentre(f,c,S,L,R);var N=this.safeHCoordinateIntersection(f,c,S,L);return N.x+=R.x,N.y+=R.y,N},e.prototype.computeCollinearIntersection=function(r,s,l,p){var f=oe.intersects(r,s,l),c=oe.intersects(r,s,p),S=oe.intersects(l,p,r),L=oe.intersects(l,p,s);return f&&c?(this._intPt[0]=l,this._intPt[1]=p,t.COLLINEAR_INTERSECTION):S&&L?(this._intPt[0]=r,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):f&&S?(this._intPt[0]=l,this._intPt[1]=r,l.equals(r)&&!c&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):f&&L?(this._intPt[0]=l,this._intPt[1]=s,l.equals(s)&&!c&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&S?(this._intPt[0]=p,this._intPt[1]=r,p.equals(r)&&!f&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&L?(this._intPt[0]=p,this._intPt[1]=s,p.equals(s)&&!f&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(r,s,l,p,f){var c=r.xs.x?r.x:s.x,R=r.y>s.y?r.y:s.y,N=l.xp.x?l.x:p.x,ht=l.y>p.y?l.y:p.y,vt=c>N?c:N,wt=LU?S:U,Dt=R0&&c>0||f<0&&c<0)return t.NO_INTERSECTION;var S=Kt.orientationIndex(l,p,r),L=Kt.orientationIndex(l,p,s);if(S>0&&L>0||S<0&&L<0)return t.NO_INTERSECTION;var R=f===0&&c===0&&S===0&&L===0;return R?this.computeCollinearIntersection(r,s,l,p):(f===0||c===0||S===0||L===0?(this._isProper=!1,r.equals2D(l)||r.equals2D(p)?this._intPt[0]=r:s.equals2D(l)||s.equals2D(p)?this._intPt[0]=s:f===0?this._intPt[0]=new ct(l):c===0?this._intPt[0]=new ct(p):S===0?this._intPt[0]=new ct(r):L===0&&(this._intPt[0]=new ct(s))):(this._isProper=!0,this._intPt[0]=this.intersection(r,s,l,p)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(r,s,l,p){var f=r,c=Kt.distancePointLine(r,l,p),S=Kt.distancePointLine(s,l,p);return S0?r>0?-l:l:r>0?l:-l;if(e===0||r===0)return s>0?t>0?l:-l:t>0?-l:l;if(e>0?s>0?e<=s||(l=-l,p=t,t=r,r=p,p=e,e=s,s=p):e<=-s?(l=-l,r=-r,s=-s):(p=t,t=-r,r=p,p=e,e=-s,s=p):s>0?-e<=s?(l=-l,t=-t,e=-e):(p=-t,t=r,r=p,p=-e,e=s,s=p):e>=s?(t=-t,e=-e,r=-r,s=-s):(l=-l,p=-t,t=-r,r=p,p=-e,e=-s,s=p),t>0)if(r>0){if(!(t<=r))return l}else return l;else{if(r>0)return-l;if(t>=r)l=-l,t=-t,r=-r;else return-l}for(;;){if(f=Math.floor(r/t),r=r-f*t,s=s-f*e,s<0)return-l;if(s>e)return l;if(t>r+r){if(es+s)return-l;r=t-r,s=e-s,l=-l}if(s===0)return r===0?0:-l;if(r===0||(f=Math.floor(t/r),t=t-f*r,e=e-f*s,e<0))return l;if(e>s)return-l;if(r>t+t){if(se+e)return l;t=r-t,e=s-e,l=-l}if(e===0)return t===0?0:l;if(t===0)return-l}};var os=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};os.prototype.countSegment=function(t,e){if(t.xs&&(r=e.x,s=t.x),this._p.x>=r&&this._p.x<=s&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var l=t.x-this._p.x,p=t.y-this._p.y,f=e.x-this._p.x,c=e.y-this._p.y,S=_u.signOfDet2x2(l,p,f,c);if(S===0)return this._isPointOnSegment=!0,null;c0&&this._crossingCount++}};os.prototype.isPointInPolygon=function(){return this.getLocation()!==dt.EXTERIOR};os.prototype.getLocation=function(){return this._isPointOnSegment?dt.BOUNDARY:this._crossingCount%2===1?dt.INTERIOR:dt.EXTERIOR};os.prototype.isOnSegment=function(){return this._isPointOnSegment};os.prototype.interfaces_=function(){return[]};os.prototype.getClass=function(){return os};os.locatePointInRing=function(){if(arguments[0]instanceof ct&&me(arguments[1],Ye)){for(var t=arguments[0],e=arguments[1],r=new os(t),s=new ct,l=new ct,p=1;p1||S<0||S>1)&&(l=!0)}}return l?eo.min(Kt.distancePointLine(t,r,s),Kt.distancePointLine(e,r,s),Kt.distancePointLine(r,t,e),Kt.distancePointLine(s,t,e)):0};Kt.isPointInRing=function(t,e){return Kt.locatePointInRing(t,e)!==dt.EXTERIOR};Kt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,s=new ct;t.getCoordinate(0,s);for(var l=s.x,p=s.y,f=1;fr.y&&(r=p,s=l)}var f=s;do f=f-1,f<0&&(f=e);while(t[f].equals2D(r)&&f!==s);var c=s;do c=(c+1)%e;while(t[c].equals2D(r)&&c!==s);var S=t[f],L=t[c];if(S.equals2D(r)||L.equals2D(r)||S.equals2D(L))return!1;var R=Kt.computeOrientation(S,r,L),N=!1;return R===0?N=S.x>L.x:N=R>0,N};Kt.locatePointInRing=function(t,e){return os.locatePointInRing(t,e)};Kt.distancePointLinePerpendicular=function(t,e,r){var s=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),l=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/s;return Math.abs(l)*Math.sqrt(s)};Kt.computeOrientation=function(t,e,r){return Kt.orientationIndex(t,e,r)};Kt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Rn("Line array must contain at least one vertex");for(var r=t.distance(e[0]),s=0;s=1)return p.distance(c);var R=((f.y-p.y)*(c.x-f.x)-(f.x-p.x)*(c.y-f.y))/S;return Math.abs(R)*Math.sqrt(S)}};Kt.isOnLine=function(t,e){for(var r=new Ol,s=1;s0};jc.prototype.interfaces_=function(){return[_o]};jc.prototype.getClass=function(){return jc};var Zc=function(){};Zc.prototype.isInBoundary=function(t){return t>1};Zc.prototype.interfaces_=function(){return[_o]};Zc.prototype.getClass=function(){return Zc};var Hc=function(){};Hc.prototype.isInBoundary=function(t){return t===1};Hc.prototype.interfaces_=function(){return[_o]};Hc.prototype.getClass=function(){return Hc};var ci=function(){};ci.prototype.add=function(){};ci.prototype.addAll=function(){};ci.prototype.isEmpty=function(){};ci.prototype.iterator=function(){};ci.prototype.size=function(){};ci.prototype.toArray=function(){};ci.prototype.remove=function(){};function vg(t){this.message=t||""}vg.prototype=new Error;vg.prototype.name="IndexOutOfBoundsException";var uh=function(){};uh.prototype.hasNext=function(){};uh.prototype.next=function(){};uh.prototype.remove=function(){};var ko=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(ci);function ch(t){this.message=t||""}ch.prototype=new Error;ch.prototype.name="NoSuchElementException";var jt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof ci&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,ci]},e.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(r){for(var s=this,l=r.iterator();l.hasNext();)s.add(l.next());return!0},e.prototype.set=function(r,s){var l=this.array_[r];return this.array_[r]=s,l},e.prototype.iterator=function(){return new vw(this)},e.prototype.get=function(r){if(r<0||r>=this.size())throw new vg;return this.array_[r]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var r=this,s=[],l=0,p=this.array_.length;l=1){var L=this.get(this.size()-1);if(L.equals2D(c))return null}t.prototype.add.call(this,c)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],N=arguments[1];return this.add(R,N),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var U=arguments[0],lt=arguments[1],ht=arguments[2];if(ht)for(var vt=0;vt=0;wt--)s.add(U[wt],lt);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ct){var Mt=arguments[0],Dt=arguments[1],Bt=arguments[2];if(!Bt){var ie=this.size();if(ie>0){if(Mt>0){var de=this.get(Mt-1);if(de.equals2D(Dt))return null}if(Mtve&&(Nt=-1);for(var Jt=ge;Jt!==ve;Jt+=Nt)s.add(ce[Jt],Ee);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ct(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(jt),Oe=function(){},Cf={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Cf.ForwardComparator.get=function(){return Mp};Cf.BidirectionalComparator.get=function(){return Wc};Cf.coordArrayType.get=function(){return new Array(0).fill(null)};Oe.prototype.interfaces_=function(){return[]};Oe.prototype.getClass=function(){return Oe};Oe.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Oe.ptNotInList=function(t,e){for(var r=0;r=t?e:[]};Oe.indexOf=function(t,e){for(var r=0;r0)&&(e=t[r]);return e};Oe.extract=function(t,e,r){e=eo.clamp(e,0,t.length),r=eo.clamp(r,-1,t.length);var s=r-e+1;r<0&&(s=0),e>=t.length&&(s=0),rs.length)return 1;if(r.length===0)return 0;var l=Oe.compare(r,s),p=Oe.isEqualReversed(r,s);return p?0:l};Wc.prototype.OLDcompare=function(t,e){var r=t,s=e;if(r.lengths.length)return 1;if(r.length===0)return 0;for(var l=Oe.increasingDirection(r),p=Oe.increasingDirection(s),f=l>0?0:r.length-1,c=p>0?0:r.length-1,S=0;S0)e=e.right;else return e.value}return null};Yi.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ra,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r=this.root_,s,l;do if(s=r,l=t.compareTo(r.key),l<0)r=r.left;else if(l>0)r=r.right;else{var p=r.value;return r.value=e,p}while(r!==null);var f={key:t,left:null,right:null,value:e,parent:s,color:ra,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=f:s.right=f,this.fixAfterInsertion(f),this.size_++,null};Yi.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=fl;t!=null&&t!==this.root_&&t.parent.color===fl;)if(xn(t)===Ym(xn(xn(t)))){var r=Uy(xn(xn(t)));Vy(r)===fl?(ea(xn(t),ra),ea(r,ra),ea(xn(xn(t)),fl),t=xn(xn(t))):(t===Uy(xn(t))&&(t=xn(t),e.rotateLeft(t)),ea(xn(t),ra),ea(xn(xn(t)),fl),e.rotateRight(xn(xn(t))))}else{var s=Ym(xn(xn(t)));Vy(s)===fl?(ea(xn(t),ra),ea(s,ra),ea(xn(xn(t)),fl),t=xn(xn(t))):(t===Ym(xn(t))&&(t=xn(t),e.rotateRight(t)),ea(xn(t),ra),ea(xn(xn(t)),fl),e.rotateLeft(xn(xn(t))))}this.root_.color=ra};Yi.prototype.values=function(){var t=new jt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Yi.successor(e))!==null;)t.add(e.value);return t};Yi.prototype.entrySet=function(){var t=new xg,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Yi.successor(e))!==null;)t.add(e);return t};Yi.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};Yi.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};Yi.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Yi.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var r=t.parent,s=t;r!==null&&s===r.right;)s=r,r=r.parent;return r}};Yi.prototype.size=function(){return this.size_};var Dp=function(){};Dp.prototype.interfaces_=function(){return[]};Dp.prototype.getClass=function(){return Dp};function V0(){}V0.prototype=new Tf;function ls(){this.array_=[],arguments[0]instanceof ci&&this.addAll(arguments[0])}ls.prototype=new V0;ls.prototype.contains=function(t){for(var e=this,r=0,s=this.array_.length;r=0;){var f=l.substring(0,p);s.add(f),l=l.substring(p+r),p=l.indexOf(e)}l.length>0&&s.add(l);for(var c=new Array(s.size()).fill(null),S=0;S0)for(var p=l;p0&&s.append(" ");for(var p=0;p0&&s.append(","),s.append(mo.toString(t.getOrdinate(l,p)))}return s.append(")"),s.toString()}};ti.ensureValidRing=function(t,e){var r=e.size();if(r===0)return e;if(r<=3)return ti.createClosedRing(t,e,4);var s=e.getOrdinate(0,Ye.X)===e.getOrdinate(r-1,Ye.X)&&e.getOrdinate(0,Ye.Y)===e.getOrdinate(r-1,Ye.Y);return s?e:ti.createClosedRing(t,e,r+1)};ti.createClosedRing=function(t,e,r){var s=t.create(r,e.getDimension()),l=e.size();ti.copy(e,0,s,0,l);for(var p=l;p0&&ti.reverse(s._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Qe.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Kt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var s=this._points.copy();ti.reverse(s);var l=this.getFactory().createLineString(s);return l},e.prototype.compareToSameClass=function(){var s=this;if(arguments.length===1){for(var l=arguments[0],p=l,f=0,c=0;f= 2)");this._points=s},e.prototype.isCoordinate=function(s){for(var l=this,p=0;p=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Zn),As=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return pe.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.isEquivalentClass(s)?t.prototype.equalsExact.call(this,s,l):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var s=this,l=this._geometries.length,p=new Array(l).fill(null),f=0;f0?e.createPoint(r[0]):e.createPoint():t};kp.prototype.interfaces_=function(){return[yo.GeometryEditorOperation]};kp.prototype.getClass=function(){return kp};var zp=function(){};zp.prototype.edit=function(t,e){return t instanceof Rs?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Zn?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Or?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};zp.prototype.interfaces_=function(){return[yo.GeometryEditorOperation]};zp.prototype.getClass=function(){return zp};var Qn=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r0){var e=new ys(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var r=1;r3&&(s=3),s<2?new Qn(r):new Qn(r,s)}};Ns.prototype.interfaces_=function(){return[qc,bo]};Ns.prototype.getClass=function(){return Ns};Ns.instance=function(){return Ns.instanceObject};wg.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};wg.instanceObject.get=function(){return new Ns};Object.defineProperties(Ns,wg);var q0=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(r){return this.map_.get(r)||null},e.prototype.put=function(r,s){return this.map_.set(r,s),s},e.prototype.values=function(){for(var r=new jt,s=this.map_.values(),l=s.next();!l.done;)r.add(l.value),l=s.next();return r},e.prototype.entrySet=function(){var r=new xg;return this.map_.entries().forEach(function(s){return r.add(s)}),r},e.prototype.size=function(){return this.map_.size()},e}(Du),nn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof cs){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var s=arguments[0];this._modelType=s._modelType,this._scale=s._scale}}},Ig={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};nn.prototype.equals=function(t){if(!(t instanceof nn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};nn.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),s=e.getMaximumSignificantDigits();return new as(r).compareTo(new as(s))};nn.prototype.getScale=function(){return this._scale};nn.prototype.isFloating=function(){return this._modelType===nn.FLOATING||this._modelType===nn.FLOATING_SINGLE};nn.prototype.getType=function(){return this._modelType};nn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===nn.FLOATING?t="Floating":this._modelType===nn.FLOATING_SINGLE?t="Floating-Single":this._modelType===nn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};nn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(be.isNaN(t))return t;if(this._modelType===nn.FLOATING_SINGLE){var e=t;return e}return this._modelType===nn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof ct){var r=arguments[0];if(this._modelType===nn.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}};nn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===nn.FLOATING?t=16:this._modelType===nn.FLOATING_SINGLE?t=6:this._modelType===nn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};nn.prototype.setScale=function(t){this._scale=Math.abs(t)};nn.prototype.interfaces_=function(){return[bo,xo]};nn.prototype.getClass=function(){return nn};nn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};Ig.serialVersionUID.get=function(){return 7777263578777804e3};Ig.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(nn,Ig);var cs=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Eg={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};cs.prototype.readResolve=function(){return cs.nameToTypeMap.get(this._name)};cs.prototype.toString=function(){return this._name};cs.prototype.interfaces_=function(){return[bo]};cs.prototype.getClass=function(){return cs};Eg.serialVersionUID.get=function(){return-552860263173159e4};Eg.nameToTypeMap.get=function(){return new q0};Object.defineProperties(cs,Eg);nn.Type=cs;nn.FIXED=new cs("FIXED");nn.FLOATING=new cs("FLOATING");nn.FLOATING_SINGLE=new cs("FLOATING SINGLE");var Ue=function t(){this._precisionModel=new nn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?me(arguments[0],qc)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof nn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},G0={serialVersionUID:{configurable:!0}};Ue.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ct(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ct(t.getMinX(),t.getMinY()),new ct(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ct(t.getMinX(),t.getMinY()),new ct(t.getMinX(),t.getMaxY()),new ct(t.getMaxX(),t.getMaxY()),new ct(t.getMaxX(),t.getMinY()),new ct(t.getMinX(),t.getMinY())]),null)};Ue.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Zn(this.getCoordinateSequenceFactory().create(t),this);if(me(t,Ye))return new Zn(t,this)}else return new Zn(this.getCoordinateSequenceFactory().create([]),this)};Ue.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ll(null,this);if(arguments.length===1){var t=arguments[0];return new Ll(t,this)}};Ue.prototype.buildGeometry=function(t){for(var e=null,r=!1,s=!1,l=t.iterator();l.hasNext();){var p=l.next(),f=p.getClass();e===null&&(e=f),f!==e&&(r=!0),p.isGeometryCollectionOrDerived()&&(s=!0)}if(e===null)return this.createGeometryCollection();if(r||s)return this.createGeometryCollection(Ue.toGeometryArray(t));var c=t.iterator().next(),S=t.size()>1;if(S){if(c instanceof pi)return this.createMultiPolygon(Ue.toPolygonArray(t));if(c instanceof Zn)return this.createMultiLineString(Ue.toLineStringArray(t));if(c instanceof Or)return this.createMultiPoint(Ue.toPointArray(t));Pe.shouldNeverReachHere("Unhandled class: "+c.getClass().getName())}return c};Ue.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};Ue.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ct){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(me(arguments[0],Ye)){var e=arguments[0];return new Or(e,this)}}};Ue.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};Ue.prototype.createPolygon=function(){if(arguments.length===0)return new pi(null,null,this);if(arguments.length===1){if(me(arguments[0],Ye)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Rs){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return new pi(s,l,this)}};Ue.prototype.getSRID=function(){return this._SRID};Ue.prototype.createGeometryCollection=function(){if(arguments.length===0)return new ar(null,this);if(arguments.length===1){var t=arguments[0];return new ar(t,this)}};Ue.prototype.createGeometry=function(t){var e=new yo(this);return e.edit(t,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})};Ue.prototype.getPrecisionModel=function(){return this._precisionModel};Ue.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(me(arguments[0],Ye)){var e=arguments[0];return new Rs(e,this)}}};Ue.prototype.createMultiPolygon=function(){if(arguments.length===0)return new As(null,this);if(arguments.length===1){var t=arguments[0];return new As(t,this)}};Ue.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Xc(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Xc(e,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(me(arguments[0],Ye)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),p=0;p=this.size())throw new Error;return this.array_[t]};vs.prototype.push=function(t){return this.array_.push(t),t};vs.prototype.pop=function(t){if(this.array_.length===0)throw new Mf;return this.array_.pop()};vs.prototype.peek=function(){if(this.array_.length===0)throw new Mf;return this.array_[this.array_.length-1]};vs.prototype.empty=function(){return this.array_.length===0};vs.prototype.isEmpty=function(){return this.empty()};vs.prototype.search=function(t){return this.array_.indexOf(t)};vs.prototype.size=function(){return this.array_.length};vs.prototype.toArray=function(){for(var t=this,e=[],r=0,s=this.array_.length;r0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&s===Kt.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)};hs.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge(),s=r.getCoordinates();if(e<0||e+1>=s.length||s[e].y===s[e+1].y)return-1;var l=kt.LEFT;return s[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=s,e._minCoord=r[s])};hs.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};hs.prototype.findEdge=function(t){for(var e=this,r=t.iterator();r.hasNext();){var s=r.next();s.isForward()&&e.checkForRightmostCoordinate(s)}Pe.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var l=this.getRightmostSide(this._minDe,this._minIndex);l===kt.LEFT&&(this._orientedDe=this._minDe.getSym())};hs.prototype.interfaces_=function(){return[]};hs.prototype.getClass=function(){return hs};var ua=function(t){function e(r,s){t.call(this,e.msgWithCoord(r,s)),this.pt=s?new ct(s):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(r,s){return s?r:r+" [ "+s+" ]"},e}(aa),Df=function(){this.array_=[]};Df.prototype.addLast=function(t){this.array_.push(t)};Df.prototype.removeFirst=function(){return this.array_.shift()};Df.prototype.isEmpty=function(){return this.array_.length===0};var lr=function(){this._finder=null,this._dirEdgeList=new jt,this._nodes=new jt,this._rightMostCoord=null,this._env=null,this._finder=new hs};lr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};lr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};lr.prototype.computeNodeDepth=function(t){for(var e=this,r=null,s=t.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){r=l;break}}if(r===null)throw new ua("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(r);for(var p=t.getEdges().iterator();p.hasNext();){var f=p.next();f.setVisited(!0),e.copySymDepths(f)}};lr.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(kt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};lr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};lr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(kt.RIGHT)>=1&&e.getDepth(kt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};lr.prototype.computeDepths=function(t){var e=this,r=new xg,s=new Df,l=t.getNode();for(s.addLast(l),r.add(l),t.setVisited(!0);!s.isEmpty();){var p=s.removeFirst();r.add(p),e.computeNodeDepth(p);for(var f=p.getEdges().iterator();f.hasNext();){var c=f.next(),S=c.getSym();if(!S.isVisited()){var L=S.getNode();r.contains(L)||(s.addLast(L),r.add(L))}}}};lr.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};lr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new oe,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next(),s=r.getEdge().getCoordinates(),l=0;lthis.location.length){var r=new Array(3).fill(null);r[kt.ON]=this.location[kt.ON],r[kt.LEFT]=dt.NONE,r[kt.RIGHT]=dt.NONE,this.location=r}for(var s=0;s1&&t.append(dt.toLocationSymbol(this.location[kt.LEFT])),t.append(dt.toLocationSymbol(this.location[kt.ON])),this.location.length>1&&t.append(dt.toLocationSymbol(this.location[kt.RIGHT])),t.toString()};bn.prototype.setLocations=function(t,e,r){this.location[kt.ON]=t,this.location[kt.LEFT]=e,this.location[kt.RIGHT]=r};bn.prototype.get=function(t){return t1};bn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=s),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};oi.prototype.addPoints=function(t,e,r){var s=this,l=t.getCoordinates();if(e){var p=1;r&&(p=0);for(var f=p;f=0;S--)s._pts.add(l[S])}};oi.prototype.isHole=function(){return this._isHole};oi.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};oi.prototype.containsPoint=function(t){var e=this.getLinearRing(),r=e.getEnvelopeInternal();if(!r.contains(t)||!Kt.isPointInRing(t,e.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();){var l=s.next();if(l.containsPoint(t))return!1}return!0};oi.prototype.addHole=function(t){this._holes.add(t)};oi.prototype.isShell=function(){return this._shell===null};oi.prototype.getLabel=function(){return this._label};oi.prototype.getEdges=function(){return this._edges};oi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};oi.prototype.getShell=function(){return this._shell};oi.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=e.getLocation(r,kt.RIGHT);if(s===dt.NONE)return null;if(this._label.getLocation(r)===dt.NONE)return this._label.setLocation(r,s),null}};oi.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};oi.prototype.toPolygon=function(t){for(var e=this,r=new Array(this._holes.size()).fill(null),s=0;s=2,"found partial label"),this.computeIM(t)};no.prototype.isInResult=function(){return this._isInResult};no.prototype.isVisited=function(){return this._isVisited};no.prototype.interfaces_=function(){return[]};no.prototype.getClass=function(){return no};var Rf=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var r=arguments[0],s=arguments[1];this._coord=r,this._edges=s,this._label=new on(0,dt.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var s=r.next();if(s.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(r){},e.prototype.computeMergedLocation=function(r,s){var l=dt.NONE;if(l=this._label.getLocation(s),!r.isNull(s)){var p=r.getLocation(s);l!==dt.BOUNDARY&&(l=p)}return l},e.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1];this._label===null?this._label=new on(r,s):this._label.setLocation(r,s)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof e){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof on)for(var l=arguments[0],p=0;p<2;p++){var f=r.computeMergedLocation(l,p),c=r._label.getLocation(p);c===dt.NONE&&r._label.setLocation(p,f)}},e.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},e.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var s=dt.NONE;this._label!==null&&(s=this._label.getLocation(r));var l=null;switch(s){case dt.BOUNDARY:l=dt.INTERIOR;break;case dt.INTERIOR:l=dt.BOUNDARY;break;default:l=dt.BOUNDARY;break}this._label.setLocation(r,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(no),ps=function(){this.nodeMap=new Yi,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ps.prototype.find=function(t){return this.nodeMap.get(t)};ps.prototype.addNode=function(){if(arguments[0]instanceof ct){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof Rf){var r=arguments[0],s=this.nodeMap.get(r.getCoordinate());return s===null?(this.nodeMap.put(r.getCoordinate(),r),r):(s.mergeLabel(r),s)}};ps.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};ps.prototype.iterator=function(){return this.nodeMap.values().iterator()};ps.prototype.values=function(){return this.nodeMap.values()};ps.prototype.getBoundaryNodes=function(t){for(var e=new jt,r=this.iterator();r.hasNext();){var s=r.next();s.getLabel().getLocation(t)===dt.BOUNDARY&&e.add(s)}return e};ps.prototype.add=function(t){var e=t.getCoordinate(),r=this.addNode(e);r.add(t)};ps.prototype.interfaces_=function(){return[]};ps.prototype.getClass=function(){return ps};var pn=function(){},Yp={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};pn.prototype.interfaces_=function(){return[]};pn.prototype.getClass=function(){return pn};pn.isNorthern=function(t){return t===pn.NE||t===pn.NW};pn.isOpposite=function(t,e){if(t===e)return!1;var r=(t-e+4)%4;return r===2};pn.commonHalfPlane=function(t,e){if(t===e)return t;var r=(t-e+4)%4;if(r===2)return-1;var s=te?t:e;return s===0&&l===3?3:s};pn.isInHalfPlane=function(t,e){return e===pn.SE?t===pn.SE||t===pn.SW:t===e||t===e+1};pn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Rn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?pn.NE:pn.SE:e>=0?pn.NW:pn.SW}else if(arguments[0]instanceof ct&&arguments[1]instanceof ct){var r=arguments[0],s=arguments[1];if(s.x===r.x&&s.y===r.y)throw new Rn("Cannot compute the quadrant for two identical points "+r);return s.x>=r.x?s.y>=r.y?pn.NE:pn.SE:s.y>=r.y?pn.NW:pn.SW}};Yp.NE.get=function(){return 0};Yp.NW.get=function(){return 1};Yp.SW.get=function(){return 2};Yp.SE.get=function(){return 3};Object.defineProperties(pn,Yp);var Ki=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=null;this._edge=e,this.init(r,s),this._label=l}else if(arguments.length===4){var p=arguments[0],f=arguments[1],c=arguments[2],S=arguments[3];this._edge=p,this.init(f,c),this._label=S}};Ki.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){f.linkDirectedEdgesForMinimalEdgeRings();var c=f.buildMinimalRings(),S=s.findShell(c);S!==null?(s.placePolygonHoles(S,c),e.add(S)):r.addAll(c)}else l.add(f)}return l};Fr.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var r=e.next();if(r.containsPoint(t))return!0}return!1};Fr.prototype.buildMaximalEdgeRings=function(t){for(var e=this,r=new jt,s=t.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var p=new Pw(l,e._geometryFactory);r.add(p),p.setInResult()}}return r};Fr.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next();s.isHole()&&s.setShell(t)}};Fr.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Fr.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),s=r.getEnvelopeInternal(),l=r.getCoordinateN(0),p=null,f=null,c=e.iterator();c.hasNext();){var S=c.next(),L=S.getLinearRing(),R=L.getEnvelopeInternal();p!==null&&(f=p.getLinearRing().getEnvelopeInternal());var N=!1;R.contains(s)&&Kt.isPointInRing(l,L.getCoordinates())&&(N=!0),N&&(p===null||f.contains(R))&&(p=S)}return p};Fr.prototype.findShell=function(t){for(var e=0,r=null,s=t.iterator();s.hasNext();){var l=s.next();l.isHole()||(r=l,e++)}return Pe.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r};Fr.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],r=arguments[1];Vn.linkResultDirectedEdges(r);var s=this.buildMaximalEdgeRings(e),l=new jt,p=this.buildMinimalEdgeRings(s,this._shellList,l);this.sortShellsAndHoles(p,this._shellList,l),this.placeFreeHoles(this._shellList,l)}};Fr.prototype.interfaces_=function(){return[]};Fr.prototype.getClass=function(){return Fr};var Kc=function(){};Kc.prototype.getBounds=function(){};Kc.prototype.interfaces_=function(){return[]};Kc.prototype.getClass=function(){return Kc};var Fo=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Fo.prototype.getItem=function(){return this._item};Fo.prototype.getBounds=function(){return this._bounds};Fo.prototype.interfaces_=function(){return[Kc,bo]};Fo.prototype.getClass=function(){return Fo};var ca=function(){this._size=null,this._items=null,this._size=0,this._items=new jt,this._items.add(null)};ca.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};ca.prototype.size=function(){return this._size};ca.prototype.reorder=function(t){for(var e=this,r=null,s=this._items.get(t);t*2<=this._size&&(r=t*2,r!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(s)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,s)};ca.prototype.clear=function(){this._size=0,this._items.clear()};ca.prototype.isEmpty=function(){return this._size===0};ca.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)e._items.set(r,e._items.get(Math.trunc(r/2)));this._items.set(r,t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var za=function(){};za.prototype.visitItem=function(t){};za.prototype.interfaces_=function(){return[]};za.prototype.getClass=function(){return za};var yu=function(){};yu.prototype.insert=function(t,e){};yu.prototype.remove=function(t,e){};yu.prototype.query=function(){};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};var hi=function(){if(this._childBoundables=new jt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},j0={serialVersionUID:{configurable:!0}};hi.prototype.getLevel=function(){return this._level};hi.prototype.size=function(){return this._childBoundables.size()};hi.prototype.getChildBoundables=function(){return this._childBoundables};hi.prototype.addChildBoundable=function(t){Pe.isTrue(this._bounds===null),this._childBoundables.add(t)};hi.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};hi.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};hi.prototype.interfaces_=function(){return[Kc,bo]};hi.prototype.getClass=function(){return hi};j0.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(hi,j0);var Bo=function(){};Bo.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Bo.min=function(t){return Bo.sort(t),t.get(0)};Bo.sort=function(t,e){var r=t.toArray();e?xl.sort(r,e):xl.sort(r);for(var s=t.iterator(),l=0,p=r.length;lii.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(s)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Rn("neither boundable is composite")};ii.prototype.isLeaves=function(){return!(ii.isComposite(this._boundable1)||ii.isComposite(this._boundable2))};ii.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};ii.prototype.expand=function(t,e,r,s){for(var l=this,p=t.getChildBoundables(),f=p.iterator();f.hasNext();){var c=f.next(),S=new ii(c,e,l._itemDistance);S.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Nf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ri.prototype.getNodeCapacity=function(){return this._nodeCapacity};Ri.prototype.lastNode=function(t){return t.get(t.size()-1)};Ri.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],r=0,s=e.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof hi?r+=t.size(l):l instanceof Fo&&(r+=1)}return r}};Ri.prototype.removeItem=function(t,e){for(var r=null,s=t.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof Fo&&l.getItem()===e&&(r=l)}return r!==null?(t.getChildBoundables().remove(r),!0):!1};Ri.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new jt:e}else if(arguments.length===1){for(var r=arguments[0],s=new jt,l=r.getChildBoundables().iterator();l.hasNext();){var p=l.next();if(p instanceof hi){var f=t.itemsTree(p);f!==null&&s.add(f)}else p instanceof Fo?s.add(p.getItem()):Pe.shouldNeverReachHere()}return s.size()<=0?null:s}};Ri.prototype.insert=function(t,e){Pe.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Fo(t,e))};Ri.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],r=new jt;return this.boundablesAtLevel(e,this._root,r),r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];if(Pe.isTrue(s>-2),l.getLevel()===s)return p.add(l),null;for(var f=l.getChildBoundables().iterator();f.hasNext();){var c=f.next();c instanceof hi?t.boundablesAtLevel(s,c,p):(Pe.isTrue(c instanceof Fo),s===-1&&p.add(c))}return null}};Ri.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var r=new jt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}else if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(me(arguments[2],za)&&arguments[0]instanceof Object&&arguments[1]instanceof hi)for(var p=arguments[0],f=arguments[1],c=arguments[2],S=f.getChildBoundables(),L=0;Lr&&(r=p)}}return r+1}};Ri.prototype.createParentBoundables=function(t,e){var r=this;Pe.isTrue(!t.isEmpty());var s=new jt;s.add(this.createNode(e));var l=new jt(t);Bo.sort(l,this.getComparator());for(var p=l.iterator();p.hasNext();){var f=p.next();r.lastNode(s).getChildBoundables().size()===r.getNodeCapacity()&&s.add(r.createNode(e)),r.lastNode(s).addChildBoundable(f)}return s};Ri.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Ri.prototype.interfaces_=function(){return[bo]};Ri.prototype.getClass=function(){return Ri};Ri.compareDoubles=function(t,e){return t>e?1:t0);for(var f=new jt,c=0;c0;){var ht=lt.poll(),vt=ht.getDistance();if(vt>=N)break;ht.isLeaves()?(N=vt,U=ht):ht.expandToQueue(lt,N)}return[U.getBoundable(0).getItem(),U.getBoundable(1).getItem()]}}else if(arguments.length===3){var wt=arguments[0],Mt=arguments[1],Dt=arguments[2],Bt=new Fo(wt,Mt),ie=new ii(this.getRoot(),Bt,Dt);return this.nearestNeighbour(ie)[0]}},e.prototype.interfaces_=function(){return[yu,bo]},e.prototype.getClass=function(){return e},e.centreX=function(s){return e.avg(s.getMinX(),s.getMaxX())},e.avg=function(s,l){return(s+l)/2},e.centreY=function(s){return e.avg(s.getMinY(),s.getMaxY())},r.STRtreeNode.get=function(){return qy},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[Uc]},compare:function(s,l){return t.compareDoubles(e.centreX(s.getBounds()),e.centreX(l.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[Uc]},compare:function(s,l){return t.compareDoubles(e.centreY(s.getBounds()),e.centreY(l.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(s,l){return s.intersects(l)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Ri),qy=function(t){function e(){var r=arguments[0];t.call(this,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var r=null,s=this.getChildBoundables().iterator();s.hasNext();){var l=s.next();r===null?r=new oe(l.getBounds()):r.expandToInclude(l.getBounds())}return r},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(hi),vr=function(){};vr.prototype.interfaces_=function(){return[]};vr.prototype.getClass=function(){return vr};vr.relativeSign=function(t,e){return te?1:0};vr.compare=function(t,e,r){if(e.equals2D(r))return 0;var s=vr.relativeSign(e.x,r.x),l=vr.relativeSign(e.y,r.y);switch(t){case 0:return vr.compareValue(s,l);case 1:return vr.compareValue(l,s);case 2:return vr.compareValue(l,-s);case 3:return vr.compareValue(-s,l);case 4:return vr.compareValue(-s,-l);case 5:return vr.compareValue(-l,-s);case 6:return vr.compareValue(-l,s);case 7:return vr.compareValue(s,-l)}return Pe.shouldNeverReachHere("invalid octant value"),0};vr.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Oa=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._segString=t,this.coord=new ct(e),this.segmentIndex=r,this._segmentOctant=s,this._isInterior=!e.equals2D(t.getCoordinate(r))};Oa.prototype.getCoordinate=function(){return this.coord};Oa.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Oa.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:vr.compare(this._segmentOctant,this.coord,e.coord)};Oa.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Oa.prototype.isInterior=function(){return this._isInterior};Oa.prototype.interfaces_=function(){return[xo]};Oa.prototype.getClass=function(){return Oa};var ur=function(){this._nodeMap=new Yi,this._edge=null;var t=arguments[0];this._edge=t};ur.prototype.getSplitCoordinates=function(){var t=this,e=new Wp;this.addEndpoints();for(var r=this.iterator(),s=r.next();r.hasNext();){var l=r.next();t.addEdgeCoordinates(s,l,e),s=l}return e.toCoordinateArray()};ur.prototype.addCollapsedNodes=function(){var t=this,e=new jt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var r=e.iterator();r.hasNext();){var s=r.next().intValue();t.add(t._edge.getCoordinate(s),s)}};ur.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};ur.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,r=0;r=0?e>=0?r>=s?0:1:r>=s?7:6:e>=0?r>=s?3:2:r>=s?4:5}else if(arguments[0]instanceof ct&&arguments[1]instanceof ct){var l=arguments[0],p=arguments[1],f=p.x-l.x,c=p.y-l.y;if(f===0&&c===0)throw new Rn("Cannot compute the octant for two identical points "+l);return vu.octant(f,c)}};var ks=function(){};ks.prototype.getCoordinates=function(){};ks.prototype.size=function(){};ks.prototype.getCoordinate=function(t){};ks.prototype.isClosed=function(){};ks.prototype.setData=function(t){};ks.prototype.getData=function(){};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var Op=function(){};Op.prototype.addIntersection=function(t,e){};Op.prototype.interfaces_=function(){return[ks]};Op.prototype.getClass=function(){return Op};var ei=function(){this._nodeList=new ur(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ei.prototype.getCoordinates=function(){return this._pts};ei.prototype.size=function(){return this._pts.length};ei.prototype.getCoordinate=function(t){return this._pts[t]};ei.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ei.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};ei.prototype.setData=function(t){this._data=t};ei.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:vu.octant(t,e)};ei.prototype.getData=function(){return this._data};ei.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[3],p=new ct(r.getIntersection(l));this.addIntersection(p,s)}};ei.prototype.toString=function(){return zo.toLineString(new Qn(this._pts))};ei.prototype.getNodeList=function(){return this._nodeList};ei.prototype.addIntersectionNode=function(t,e){var r=e,s=r+1;if(s=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}else if(arguments[0]instanceof ct){var s=arguments[0];return Kt.orientationIndex(this.p0,this.p1,s)}};se.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};se.prototype.isVertical=function(){return this.p0.x===this.p1.x};se.prototype.equals=function(t){if(!(t instanceof se))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};se.prototype.intersection=function(t){var e=new Ol;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};se.prototype.project=function(){if(arguments[0]instanceof ct){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ct(t);var e=this.projectionFactor(t),r=new ct;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof se){var s=arguments[0],l=this.projectionFactor(s.p0),p=this.projectionFactor(s.p1);if(l>=1&&p>=1||l<=0&&p<=0)return null;var f=this.project(s.p0);l<0&&(f=this.p0),l>1&&(f=this.p1);var c=this.project(s.p1);return p<0&&(c=this.p0),p>1&&(c=this.p1),new se(f,c)}};se.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};se.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};se.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};se.prototype.distancePerpendicular=function(t){return Kt.distancePointLinePerpendicular(t,this.p0,this.p1)};se.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};se.prototype.midPoint=function(){return se.midPoint(this.p0,this.p1)};se.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,s=e*e+r*r;if(s<=0)return be.NaN;var l=((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/s;return l};se.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var r=new Array(2).fill(null),s=be.MAX_VALUE,l=null,p=this.closestPoint(t.p0);s=p.distance(t.p0),r[0]=p,r[1]=t.p0;var f=this.closestPoint(t.p1);l=f.distance(t.p1),l0&&e<1)return this.project(t);var r=this.p0.distance(t),s=this.p1.distance(t);return r1||be.isNaN(e))&&(e=1),e};se.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};se.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};se.prototype.distance=function(){if(arguments[0]instanceof se){var t=arguments[0];return Kt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof ct){var e=arguments[0];return Kt.distancePointLine(e,this.p0,this.p1)}};se.prototype.pointAlong=function(t){var e=new ct;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};se.prototype.hashCode=function(){var t=be.doubleToLongBits(this.p0.x);t^=be.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),r=be.doubleToLongBits(this.p1.x);r^=be.doubleToLongBits(this.p1.y)*31;var s=Math.trunc(r)^Math.trunc(r>>32);return e^s};se.prototype.interfaces_=function(){return[xo,bo]};se.prototype.getClass=function(){return se};se.midPoint=function(t,e){return new ct((t.x+e.x)/2,(t.y+e.y)/2)};H0.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(se,H0);var Fp=function(){this.tempEnv1=new oe,this.tempEnv2=new oe,this._overlapSeg1=new se,this._overlapSeg2=new se};Fp.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];t.getLineSegment(e,this._overlapSeg1),r.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Fp.prototype.interfaces_=function(){return[]};Fp.prototype.getClass=function(){return Fp};var Br=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=s};Br.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Br.prototype.computeSelect=function(t,e,r,s){var l=this._pts[e],p=this._pts[r];if(s.tempEnv1.init(l,p),r-e===1)return s.select(this,e),null;if(!t.intersects(s.tempEnv1))return null;var f=Math.trunc((e+r)/2);e=t.length-1)return t.length-1;for(var s=pn.quadrant(t[r],t[r+1]),l=e+1;lf.getId()&&(f.computeOverlaps(L,l),s._nOverlaps++),s._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return Gy},Object.defineProperties(e,r),e}(Bp),Gy=function(t){function e(){t.call(this),this._si=null;var r=arguments[0];this._si=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[2],p=arguments[3],f=r.getContext(),c=l.getContext();this._si.processIntersections(f,s,c,p)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fp),$e=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(s)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],f=arguments[2],c=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(p),this.setJoinStyle(f),this.setMitreLimit(c)}}},da={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};$e.prototype.getEndCapStyle=function(){return this._endCapStyle};$e.prototype.isSingleSided=function(){return this._isSingleSided};$e.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=$e.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=$e.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==$e.JOIN_ROUND&&(this._quadrantSegments=$e.DEFAULT_QUADRANT_SEGMENTS)};$e.prototype.getJoinStyle=function(){return this._joinStyle};$e.prototype.setJoinStyle=function(t){this._joinStyle=t};$e.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};$e.prototype.getSimplifyFactor=function(){return this._simplifyFactor};$e.prototype.getQuadrantSegments=function(){return this._quadrantSegments};$e.prototype.setEndCapStyle=function(t){this._endCapStyle=t};$e.prototype.getMitreLimit=function(){return this._mitreLimit};$e.prototype.setMitreLimit=function(t){this._mitreLimit=t};$e.prototype.setSingleSided=function(t){this._isSingleSided=t};$e.prototype.interfaces_=function(){return[]};$e.prototype.getClass=function(){return $e};$e.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};da.CAP_ROUND.get=function(){return 1};da.CAP_FLAT.get=function(){return 2};da.CAP_SQUARE.get=function(){return 3};da.JOIN_ROUND.get=function(){return 1};da.JOIN_MITRE.get=function(){return 2};da.JOIN_BEVEL.get=function(){return 3};da.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};da.DEFAULT_MITRE_LIMIT.get=function(){return 5};da.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties($e,da);var Hn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Kt.COUNTERCLOCKWISE,this._inputLine=t||null},Kp={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Hn.prototype.isDeletable=function(t,e,r,s){var l=this._inputLine[t],p=this._inputLine[e],f=this._inputLine[r];return!this.isConcave(l,p,f)||!this.isShallow(l,p,f,s)?!1:this.isShallowSampled(l,p,t,r,s)};Hn.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),s=this.findNextNonDeletedIndex(r),l=!1;s=0;l--)r.addPt(t[l])};io.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),r=t.distance(e);return rMath.PI;)t-=je.PI_TIMES_2;for(;t<=-Math.PI;)t+=je.PI_TIMES_2;return t};je.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=r.x-e.x,l=r.y-e.y;return Math.atan2(l,s)}};je.isAcute=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,f=r.y-e.y,c=s*p+l*f;return c>0};je.isObtuse=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,f=r.y-e.y,c=s*p+l*f;return c<0};je.interiorAngle=function(t,e,r){var s=je.angle(e,t),l=je.angle(e,r);return Math.abs(l-s)};je.normalizePositive=function(t){if(t<0){for(;t<0;)t+=je.PI_TIMES_2;t>=je.PI_TIMES_2&&(t=0)}else{for(;t>=je.PI_TIMES_2;)t-=je.PI_TIMES_2;t<0&&(t=0)}return t};je.angleBetween=function(t,e,r){var s=je.angle(e,t),l=je.angle(e,r);return je.diff(s,l)};je.diff=function(t,e){var r=null;return tMath.PI&&(r=2*Math.PI-r),r};je.toRadians=function(t){return t*Math.PI/180};je.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?je.COUNTERCLOCKWISE:r<0?je.CLOCKWISE:je.NONE};je.angleBetweenOriented=function(t,e,r){var s=je.angle(e,t),l=je.angle(e,r),p=l-s;return p<=-Math.PI?p+je.PI_TIMES_2:p>Math.PI?p-je.PI_TIMES_2:p};Ru.PI_TIMES_2.get=function(){return 2*Math.PI};Ru.PI_OVER_2.get=function(){return Math.PI/2};Ru.PI_OVER_4.get=function(){return Math.PI/4};Ru.COUNTERCLOCKWISE.get=function(){return Kt.COUNTERCLOCKWISE};Ru.CLOCKWISE.get=function(){return Kt.CLOCKWISE};Ru.NONE.get=function(){return Kt.COLLINEAR};Object.defineProperties(je,Ru);var Ln=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new se,this._seg1=new se,this._offset0=new se,this._offset1=new se,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],s=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new Ol,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===$e.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)},Jp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Ln.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=Kt.computeOrientation(this._s0,this._s1,this._s2),s=r===Kt.CLOCKWISE&&this._side===kt.LEFT||r===Kt.COUNTERCLOCKWISE&&this._side===kt.RIGHT;r===0?this.addCollinear(e):s?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)};Ln.prototype.addLineEndCap=function(t,e){var r=new se(t,e),s=new se;this.computeOffsetSegment(r,kt.LEFT,this._distance,s);var l=new se;this.computeOffsetSegment(r,kt.RIGHT,this._distance,l);var p=e.x-t.x,f=e.y-t.y,c=Math.atan2(f,p);switch(this._bufParams.getEndCapStyle()){case $e.CAP_ROUND:this._segList.addPt(s.p1),this.addFilletArc(e,c+Math.PI/2,c-Math.PI/2,Kt.CLOCKWISE,this._distance),this._segList.addPt(l.p1);break;case $e.CAP_FLAT:this._segList.addPt(s.p1),this._segList.addPt(l.p1);break;case $e.CAP_SQUARE:var S=new ct;S.x=Math.abs(this._distance)*Math.cos(c),S.y=Math.abs(this._distance)*Math.sin(c);var L=new ct(s.p1.x+S.x,s.p1.y+S.y),R=new ct(l.p1.x+S.x,l.p1.y+S.y);this._segList.addPt(L),this._segList.addPt(R);break}};Ln.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};Ln.prototype.addMitreJoin=function(t,e,r,s){var l=!0,p=null;try{p=No.intersection(e.p0,e.p1,r.p0,r.p1);var f=s<=0?1:p.distance(t)/Math.abs(s);f>this._bufParams.getMitreLimit()&&(l=!1)}catch(c){if(c instanceof lh)p=new ct(0,0),l=!1;else throw c}finally{}l?this._segList.addPt(p):this.addLimitedMitreJoin(e,r,s,this._bufParams.getMitreLimit())};Ln.prototype.addFilletCorner=function(t,e,r,s,l){var p=e.x-t.x,f=e.y-t.y,c=Math.atan2(f,p),S=r.x-t.x,L=r.y-t.y,R=Math.atan2(L,S);s===Kt.CLOCKWISE?c<=R&&(c+=2*Math.PI):c>=R&&(c-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,c,R,s,l),this._segList.addPt(r)};Ln.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new ct((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var s=new ct((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Ln.prototype.createCircle=function(t){var e=new ct(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Ln.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};Ln.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new io,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Ln.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Ln.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===$e.JOIN_BEVEL||this._bufParams.getJoinStyle()===$e.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Kt.CLOCKWISE,this._distance))};Ln.prototype.closeRing=function(){this._segList.closeRing()};Ln.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Jp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Jp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Jp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Jp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Ln,Jp);var Ir=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Ir.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var r=e<0,s=Math.abs(e),l=this.getSegGen(s);t.length<=1?this.computePointCurve(t[0],l):this.computeOffsetCurve(t,r,l);var p=l.getCoordinates();return r&&Oe.reverse(p),p};Ir.prototype.computeSingleSidedBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var f=p-2;f>=0;f--)r.addNextSegment(l[f],!0)}else{r.addSegments(t,!1);var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment(),r.closeRing()};Ir.prototype.computeRingBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);e===kt.RIGHT&&(s=-s);var l=Hn.simplify(t,s),p=l.length-1;r.initSideSegments(l[p-1],l[0],e);for(var f=1;f<=p;f++){var c=f!==1;r.addNextSegment(l[f],c)}r.closeRing()};Ir.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),s=Hn.simplify(t,r),l=s.length-1;e.initSideSegments(s[0],s[1],kt.LEFT);for(var p=2;p<=l;p++)e.addNextSegment(s[p],!0);e.addLastSegment(),e.addLineEndCap(s[l-1],s[l]);var f=Hn.simplify(t,-r),c=f.length-1;e.initSideSegments(f[c],f[c-1],kt.LEFT);for(var S=c-2;S>=0;S--)e.addNextSegment(f[S],!0);e.addLastSegment(),e.addLineEndCap(f[1],f[0]),e.closeRing()};Ir.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case $e.CAP_ROUND:e.createCircle(t);break;case $e.CAP_SQUARE:e.createSquare(t);break}};Ir.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var r=Math.abs(e),s=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],s);else if(this._bufParams.isSingleSided()){var l=e<0;this.computeSingleSidedBufferCurve(t,l,s)}else this.computeLineBufferCurve(t,s);var p=s.getCoordinates();return p};Ir.prototype.getBufferParameters=function(){return this._bufParams};Ir.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Ir.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(r===0)return Ir.copyCoordinates(t);var s=this.getSegGen(r);return this.computeRingBufferCurve(t,e,s),s.getCoordinates()};Ir.prototype.computeOffsetCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var f=p-2;f>=0;f--)r.addNextSegment(l[f],!0)}else{var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment()};Ir.prototype.getSegGen=function(t){return new Ln(this._precisionModel,this._bufParams,t)};Ir.prototype.interfaces_=function(){return[]};Ir.prototype.getClass=function(){return Ir};Ir.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;rp.getMaxY()||t.findStabbedSegments(e,l.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(me(arguments[2],ko)&&arguments[0]instanceof ct&&arguments[1]instanceof lg)for(var f=arguments[0],c=arguments[1],S=arguments[2],L=c.getEdge().getCoordinates(),R=0;Rt._seg.p1.y&&t._seg.reverse();var N=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Nt._seg.p1.y)&&Kt.computeOrientation(t._seg.p0,t._seg.p1,f)!==Kt.RIGHT){var U=c.getDepth(kt.LEFT);t._seg.p0.equals(L[R])||(U=c.getDepth(kt.RIGHT));var lt=new Al(t._seg,U);S.add(lt)}}else if(me(arguments[2],ko)&&arguments[0]instanceof ct&&me(arguments[1],ko))for(var ht=arguments[0],vt=arguments[1],wt=arguments[2],Mt=vt.iterator();Mt.hasNext();){var Dt=Mt.next();Dt.isForward()&&t.findStabbedSegments(ht,Dt,wt)}}};xu.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var r=Bo.min(e);return r._leftDepth};xu.prototype.interfaces_=function(){return[]};xu.prototype.getClass=function(){return xu};X0.DepthSegment.get=function(){return Al};Object.defineProperties(xu,X0);var Al=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new se(t),this._leftDepth=e};Al.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return r!==0||(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(e._upwardSeg)};Al.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return r!==0?r:t.p1.compareTo(e.p1)};Al.prototype.toString=function(){return this._upwardSeg.toString()};Al.prototype.interfaces_=function(){return[xo]};Al.prototype.getClass=function(){return Al};var tn=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};tn.prototype.area=function(){return tn.area(this.p0,this.p1,this.p2)};tn.prototype.signedArea=function(){return tn.signedArea(this.p0,this.p1,this.p2)};tn.prototype.interpolateZ=function(t){if(t===null)throw new Rn("Supplied point is null.");return tn.interpolateZ(t,this.p0,this.p1,this.p2)};tn.prototype.longestSideLength=function(){return tn.longestSideLength(this.p0,this.p1,this.p2)};tn.prototype.isAcute=function(){return tn.isAcute(this.p0,this.p1,this.p2)};tn.prototype.circumcentre=function(){return tn.circumcentre(this.p0,this.p1,this.p2)};tn.prototype.area3D=function(){return tn.area3D(this.p0,this.p1,this.p2)};tn.prototype.centroid=function(){return tn.centroid(this.p0,this.p1,this.p2)};tn.prototype.inCentre=function(){return tn.inCentre(this.p0,this.p1,this.p2)};tn.prototype.interfaces_=function(){return[]};tn.prototype.getClass=function(){return tn};tn.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)};tn.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2};tn.det=function(t,e,r,s){return t*s-e*r};tn.interpolateZ=function(t,e,r,s){var l=e.x,p=e.y,f=r.x-l,c=s.x-l,S=r.y-p,L=s.y-p,R=f*L-c*S,N=t.x-l,U=t.y-p,lt=(L*N-c*U)/R,ht=(-S*N+f*U)/R,vt=e.z+lt*(r.z-e.z)+ht*(s.z-e.z);return vt};tn.longestSideLength=function(t,e,r){var s=t.distance(e),l=e.distance(r),p=r.distance(t),f=s;return l>f&&(f=l),p>f&&(f=p),f};tn.isAcute=function(t,e,r){return!(!je.isAcute(t,e,r)||!je.isAcute(e,r,t)||!je.isAcute(r,t,e))};tn.circumcentre=function(t,e,r){var s=r.x,l=r.y,p=t.x-s,f=t.y-l,c=e.x-s,S=e.y-l,L=2*tn.det(p,f,c,S),R=tn.det(f,p*p+f*f,S,c*c+S*S),N=tn.det(p,p*p+f*f,c,c*c+S*S),U=s-R/L,lt=l+N/L;return new ct(U,lt)};tn.perpendicularBisector=function(t,e){var r=e.x-t.x,s=e.y-t.y,l=new No(t.x+r/2,t.y+s/2,1),p=new No(t.x-s+r/2,t.y+r+s/2,1);return new No(l,p)};tn.angleBisector=function(t,e,r){var s=e.distance(t),l=e.distance(r),p=s/(s+l),f=r.x-t.x,c=r.y-t.y,S=new ct(t.x+p*f,t.y+p*c);return S};tn.area3D=function(t,e,r){var s=e.x-t.x,l=e.y-t.y,p=e.z-t.z,f=r.x-t.x,c=r.y-t.y,S=r.z-t.z,L=l*S-p*c,R=p*f-s*S,N=s*c-l*f,U=L*L+R*R+N*N,lt=Math.sqrt(U)/2;return lt};tn.centroid=function(t,e,r){var s=(t.x+e.x+r.x)/3,l=(t.y+e.y+r.y)/3;return new ct(s,l)};tn.inCentre=function(t,e,r){var s=e.distance(r),l=t.distance(r),p=t.distance(e),f=s+l+p,c=(s*t.x+l*e.x+p*r.x)/f,S=(s*t.y+l*e.y+p*r.y)/f;return new ct(c,S)};var vo=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new jt;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};vo.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,dt.EXTERIOR,dt.INTERIOR)};vo.prototype.addPolygon=function(t){var e=this,r=this._distance,s=kt.LEFT;this._distance<0&&(r=-this._distance,s=kt.RIGHT);var l=t.getExteriorRing(),p=Oe.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&p.length<3)return null;this.addPolygonRing(p,r,s,dt.EXTERIOR,dt.INTERIOR);for(var f=0;f0&&e.isErodedCompletely(c,-e._distance)||e.addPolygonRing(S,r,kt.opposite(s),dt.INTERIOR,dt.EXTERIOR)}};vo.prototype.isTriangleErodedCompletely=function(t,e){var r=new tn(t[0],t[1],t[2]),s=r.inCentre(),l=Kt.distancePointLine(s,r.p0,r.p1);return l=Rs.MINIMUM_VALID_SIZE&&Kt.isCCW(t)&&(p=l,f=s,r=kt.opposite(r));var c=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(c,p,f)};vo.prototype.add=function(t){if(t.isEmpty())return null;t instanceof pi?this.addPolygon(t):t instanceof Zn?this.addLineString(t):t instanceof Or?this.addPoint(t):t instanceof Xc?this.addCollection(t):t instanceof Ll?this.addCollection(t):t instanceof As?this.addCollection(t):t instanceof ar&&this.addCollection(t)};vo.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(r.length===4)return this.isTriangleErodedCompletely(r,e);var s=t.getEnvelopeInternal(),l=Math.min(s.getHeight(),s.getWidth());return e<0&&2*Math.abs(e)>l};vo.prototype.addCollection=function(t){for(var e=this,r=0;r=this._max)throw new ch;var t=this._parent.getGeometryN(this._index++);return t instanceof ar?(this._subcollectionIterator=new Ms(t),this._subcollectionIterator.next()):t};Ms.prototype.remove=function(){throw new Error(this.getClass().getName())};Ms.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};Ms.prototype.interfaces_=function(){return[uh]};Ms.prototype.getClass=function(){return Ms};Ms.isAtomic=function(t){return!(t instanceof ar)};var $r=function(){this._geom=null;var t=arguments[0];this._geom=t};$r.prototype.locate=function(t){return $r.locate(t,this._geom)};$r.prototype.interfaces_=function(){return[Qc]};$r.prototype.getClass=function(){return $r};$r.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Kt.isPointInRing(t,e.getCoordinates()):!1};$r.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!$r.isPointInRing(t,r))return!1;for(var s=0;s=0;p--){var f=r._edgeList.get(p),c=f.getSym();l===null&&(l=c),s!==null&&c.setNext(s),s=f}l.setNext(s)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),p=s.getDepth(kt.LEFT),f=s.getDepth(kt.RIGHT),c=this.computeDepths(l+1,this._edgeList.size(),p),S=this.computeDepths(0,l,c);if(S!==f)throw new ua("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],R=arguments[1],N=arguments[2],U=N,lt=L;lt=0;c--){var S=s._resultAreaEdgeList.get(c),L=S.getSym();switch(l===null&&S.getEdgeRing()===r&&(l=S),f){case s._SCANNING_FOR_INCOMING:if(L.getEdgeRing()!==r)continue;p=L,f=s._LINKING_TO_OUTGOING;break;case s._LINKING_TO_OUTGOING:if(S.getEdgeRing()!==r)continue;p.setNextMin(S),f=s._SCANNING_FOR_INCOMING;break}}f===this._LINKING_TO_OUTGOING&&(Pe.isTrue(l!==null,"found null for first outgoing dirEdge"),Pe.isTrue(l.getEdgeRing()===r,"unable to link last incoming dirEdge"),p.setNextMin(l))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,s=this.iterator();s.hasNext();){var l=s.next();l.isInResult()&&r++}return r}else if(arguments.length===1){for(var p=arguments[0],f=0,c=this.iterator();c.hasNext();){var S=c.next();S.getEdgeRing()===p&&f++}return f}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=dt.NONE,s=this.iterator();s.hasNext();){var l=s.next(),p=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){r=dt.INTERIOR;break}if(p.isInResult()){r=dt.EXTERIOR;break}}}if(r===dt.NONE)return null;for(var f=r,c=this.iterator();c.hasNext();){var S=c.next(),L=S.getSym();S.isLineEdge()?S.getEdge().setCovered(f===dt.INTERIOR):(S.isInResult()&&(f=dt.EXTERIOR),L.isInResult()&&(f=dt.INTERIOR))}},e.prototype.computeLabelling=function(r){var s=this;t.prototype.computeLabelling.call(this,r),this._label=new on(dt.NONE);for(var l=this.iterator();l.hasNext();)for(var p=l.next(),f=p.getEdge(),c=f.getLabel(),S=0;S<2;S++){var L=c.getLocation(S);(L===dt.INTERIOR||L===dt.BOUNDARY)&&s._label.setLocation(S,dt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ji),Y0=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new Rf(r,new Mw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yc),Fa=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Fa.prototype.compareTo=function(t){var e=t,r=Fa.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return r};Fa.prototype.interfaces_=function(){return[xo]};Fa.prototype.getClass=function(){return Fa};Fa.orientation=function(t){return Oe.increasingDirection(t)===1};Fa.compareOriented=function(t,e,r,s){for(var l=e?1:-1,p=s?1:-1,f=e?t.length:-1,c=s?r.length:-1,S=e?0:t.length-1,L=s?0:r.length-1;;){var R=t[S].compareTo(r[L]);if(R!==0)return R;S+=l,L+=p;var N=S===f,U=L===c;if(N&&!U)return-1;if(!N&&U)return 1;if(N&&U)return 0}};var Vo=function(){this._edges=new jt,this._ocaMap=new Yi};Vo.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var r=0;r0&&t.print(","),t.print("(");for(var l=s.getCoordinates(),p=0;p0&&t.print(","),t.print(l[p].x+" "+l[p].y);t.println(")")}t.print(") ")};Vo.prototype.addAll=function(t){for(var e=this,r=t.iterator();r.hasNext();)e.add(r.next())};Vo.prototype.findEdgeIndex=function(t){for(var e=this,r=0;r0||!e.coord.equals2D(l);p||s--;var f=new Array(s).fill(null),c=0;f[c++]=new ct(t.coord);for(var S=t.segmentIndex+1;S<=e.segmentIndex;S++)f[c++]=r.edge.pts[S];return p&&(f[c]=e.coord),new vf(f,new on(this.edge._label))};zs.prototype.add=function(t,e,r){var s=new ds(t,e,r),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)};zs.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();if(r.coord.equals(t))return!0}return!1};zs.prototype.interfaces_=function(){return[]};zs.prototype.getClass=function(){return zs};var Dl=function(){};Dl.prototype.getChainStartIndices=function(t){var e=this,r=0,s=new jt;s.add(new as(r));do{var l=e.findChainEnd(t,r);s.add(new as(l)),r=l}while(rr?e:r};ha.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return er&&(l=1),t._depth[e][s]=l}}};Fi.prototype.getDelta=function(t){return this._depth[t][kt.RIGHT]-this._depth[t][kt.LEFT]};Fi.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?dt.EXTERIOR:dt.INTERIOR};Fi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Fi.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],r=0;r<2;r++)for(var s=1;s<3;s++){var l=e.getLocation(r,s);(l===dt.EXTERIOR||l===dt.INTERIOR)&&(t.isNull(r,s)?t._depth[r][s]=Fi.depthAtLocation(l):t._depth[r][s]+=Fi.depthAtLocation(l))}else if(arguments.length===3){var p=arguments[0],f=arguments[1],c=arguments[2];c===dt.INTERIOR&&this._depth[p][f]++}};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};Fi.depthAtLocation=function(t){return t===dt.EXTERIOR?0:t===dt.INTERIOR?1:Fi.NULL_VALUE};K0.NULL_VALUE.get=function(){return-1};Object.defineProperties(Fi,K0);var vf=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new zs(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Fi,this._depthDelta=0,arguments.length===1){var r=arguments[0];e.call(this,r,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var s=new e(r,on.toLineLabel(this._label));return s},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var s=this;if(!(r instanceof e))return!1;var l=r;if(this.pts.length!==l.pts.length)return!1;for(var p=!0,f=!0,c=this.pts.length,S=0;S0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var s=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var l=0;l0&&r.print(","),r.print(s.pts[l].x+" "+s.pts[l].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var s=this;r.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)r.print(s.pts[l]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ha(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new oe;for(var s=0;s0&&s.append(","),s.append(r.pts[l].x+" "+r.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},e.prototype.isPointwiseEqual=function(r){var s=this;if(this.pts.length!==r.pts.length)return!1;for(var l=0;ls||this._maxyp;if(f)return!1;var c=this.intersectsToleranceSquare(t,e);return Pe.isTrue(!(f&&c),"Found bad envelope test"),c};Er.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ct(this._maxx,this._maxy),this._corner[1]=new ct(this._minx,this._maxy),this._corner[2]=new ct(this._minx,this._miny),this._corner[3]=new ct(this._maxx,this._miny)};Er.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};Er.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};Er.prototype.getCoordinate=function(){return this._originalPt};Er.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};Er.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Er.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new oe(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};Er.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};Er.prototype.intersectsToleranceSquare=function(t,e){var r=!1,s=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||r&&s||t.equals(this._pt)||e.equals(this._pt))};Er.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),s=t.getCoordinate(e+1);return this.intersects(r,s)?(t.addIntersection(this.getCoordinate(),e),!0):!1};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Q0.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(Er,Q0);var Vp=function(){this.tempEnv1=new oe,this.selectedSegment=new se};Vp.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};Vp.prototype.interfaces_=function(){return[]};Vp.prototype.getClass=function(){return Vp};var $c=function(){this._index=null;var t=arguments[0];this._index=t},$0={HotPixelSnapAction:{configurable:!0}};$c.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=e.getSafeEnvelope(),p=new tv(e,r,s);return this._index.query(l,{interfaces_:function(){return[za]},visitItem:function(f){var c=f;c.select(l,p)}}),p.isNodeAdded()}};$c.prototype.interfaces_=function(){return[]};$c.prototype.getClass=function(){return $c};$0.HotPixelSnapAction.get=function(){return tv};Object.defineProperties($c,$0);var tv=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=r,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1],l=r.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),bu=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new jt};bu.prototype.processIntersections=function(t,e,r,s){var l=this;if(t===r&&e===s)return null;var p=t.getCoordinates()[e],f=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];if(this._li.computeIntersection(p,f,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var L=0;L=0;e--){try{t.bufferReducedPrecision(e)}catch(p){if(p instanceof ua)t._saveException=p;else throw p}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],s=Wi.precisionScaleFactor(this._argGeom,this._distance,r),l=new nn(s);this.bufferFixedPrecision(l)}};Wi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===nn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Wi.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Wi.prototype.bufferOriginalPrecision=function(){try{var t=new sr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof aa)this._saveException=e;else throw e}finally{}};Wi.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Wi.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};Wi.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new Wi(t),s=r.getResultGeometry(e);return s}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var l=arguments[0],p=arguments[1],f=arguments[2],c=new Wi(l);c.setQuadrantSegments(f);var S=c.getResultGeometry(p);return S}else if(arguments[2]instanceof $e&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var L=arguments[0],R=arguments[1],N=arguments[2],U=new Wi(L,N),lt=U.getResultGeometry(R);return lt}}else if(arguments.length===4){var ht=arguments[0],vt=arguments[1],wt=arguments[2],Mt=arguments[3],Dt=new Wi(ht);Dt.setQuadrantSegments(wt),Dt.setEndCapStyle(Mt);var Bt=Dt.getResultGeometry(vt);return Bt}};Wi.precisionScaleFactor=function(t,e,r){var s=t.getEnvelopeInternal(),l=eo.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY())),p=e>0?e:0,f=l+2*p,c=Math.trunc(Math.log(f)/Math.log(10)+1),S=r-c,L=Math.pow(10,S);return L};hh.CAP_ROUND.get=function(){return $e.CAP_ROUND};hh.CAP_BUTT.get=function(){return $e.CAP_FLAT};hh.CAP_FLAT.get=function(){return $e.CAP_FLAT};hh.CAP_SQUARE.get=function(){return $e.CAP_SQUARE};hh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Wi,hh);var rr=function(){this._pt=[new ct,new ct],this._distance=be.NaN,this._isNull=!0};rr.prototype.getCoordinates=function(){return this._pt};rr.prototype.getCoordinate=function(t){return this._pt[t]};rr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var s=e.distance(r);sthis._distance&&this.initialize(e,r,s)}};rr.prototype.interfaces_=function(){return[]};rr.prototype.getClass=function(){return rr};var Ls=function(){};Ls.prototype.interfaces_=function(){return[]};Ls.prototype.getClass=function(){return Ls};Ls.computeDistance=function(){if(arguments[2]instanceof rr&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=t.getCoordinates(),l=new se,p=0;p0||this._isIn?dt.INTERIOR:dt.EXTERIOR)};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};var or=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],r=arguments[1];t.call(this,e,t.INSIDE_AREA,r)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._component=s,this._segIndex=l,this._pt=p}},ev={INSIDE_AREA:{configurable:!0}};or.prototype.isInsideArea=function(){return this._segIndex===or.INSIDE_AREA};or.prototype.getCoordinate=function(){return this._pt};or.prototype.getGeometryComponent=function(){return this._component};or.prototype.getSegmentIndex=function(){return this._segIndex};or.prototype.interfaces_=function(){return[]};or.prototype.getClass=function(){return or};ev.INSIDE_AREA.get=function(){return-1};Object.defineProperties(or,ev);var Ra=function(t){this._pts=t||null};Ra.prototype.filter=function(t){t instanceof Or&&this._pts.add(t)};Ra.prototype.interfaces_=function(){return[us]};Ra.prototype.getClass=function(){return Ra};Ra.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Or?Bo.singletonList(t):Ra.getPoints(t,new jt)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];return e instanceof Or?r.add(e):e instanceof ar&&e.apply(new Ra(r)),r}};var Iu=function(){this._locations=null;var t=arguments[0];this._locations=t};Iu.prototype.filter=function(t){(t instanceof Or||t instanceof Zn||t instanceof pi)&&this._locations.add(new or(t,0,t.getCoordinate()))};Iu.prototype.interfaces_=function(){return[us]};Iu.prototype.getClass=function(){return Iu};Iu.getLocations=function(t){var e=new jt;return t.apply(new Iu(e)),e};var Vi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Uo,this._minDistanceLocation=null,this._minDistance=be.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=s,this._terminateDistance=l}};Vi.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=1-r,p=sa.getPolygons(this._geom[r]);if(p.size()>0){var f=Iu.getLocations(this._geom[l]);if(this.computeContainmentDistance(f,p,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[r]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&me(arguments[0],ko)&&me(arguments[1],ko)){for(var c=arguments[0],S=arguments[1],L=arguments[2],R=0;Rthis._minDistance)return null;for(var l=e.getCoordinates(),p=r.getCoordinate(),f=0;fthis._minDistance)return null;for(var lt=R.getCoordinates(),ht=N.getCoordinates(),vt=0;vtthis._distance&&this.initialize(e,r,s)}};Xi.prototype.interfaces_=function(){return[]};Xi.prototype.getClass=function(){return Xi};var rs=function(){};rs.prototype.interfaces_=function(){return[]};rs.prototype.getClass=function(){return rs};rs.computeDistance=function(){if(arguments[2]instanceof Xi&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=new se,l=t.getCoordinates(),p=0;p1||t<=0)throw new Rn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};go.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};go.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};go.prototype.computeOrientedDistance=function(t,e,r){var s=new Eu(e);if(t.apply(s),r.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new Ua(e,this._densifyFrac);t.apply(l),r.setMaximum(l.getMaxPointDistance())}};go.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};go.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new go(t,e);return r.distance()}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2],f=new go(s,l);return f.setDensifyFraction(p),f.distance()}};Tg.MaxPointDistanceFilter.get=function(){return Eu};Tg.MaxDensifiedByFractionDistanceFilter.get=function(){return Ua};Object.defineProperties(go,Tg);var Eu=function(){this._maxPtDist=new Xi,this._minPtDist=new Xi,this._euclideanDist=new rs,this._geom=null;var t=arguments[0];this._geom=t};Eu.prototype.filter=function(t){this._minPtDist.initialize(),rs.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Eu.prototype.getMaxPointDistance=function(){return this._maxPtDist};Eu.prototype.interfaces_=function(){return[Ds]};Eu.prototype.getClass=function(){return Eu};var Ua=function(){this._maxPtDist=new Xi,this._minPtDist=new Xi,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Ua.prototype.filter=function(t,e){var r=this;if(e===0)return null;for(var s=t.getCoordinate(e-1),l=t.getCoordinate(e),p=(l.x-s.x)/this._numSubSegs,f=(l.y-s.y)/this._numSubSegs,c=0;cr){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+zo.toLineString(l[0],l[1])+")"}};zr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=zr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),zr.VERBOSE&&Bi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};zr.prototype.checkNegativeValid=function(){if(!(this._input instanceof pi||this._input instanceof As||this._input instanceof ar))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};zr.prototype.getErrorIndicator=function(){return this._errorIndicator};zr.prototype.checkMinimumDistance=function(t,e,r){var s=new Vi(t,e,r);if(this._minDistanceFound=s.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ui.prototype.report=function(t){if(!Ui.VERBOSE)return null;Bi.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ui.prototype.getErrorMessage=function(){return this._errorMsg};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.isValidMsg=function(t,e,r){var s=new Ui(t,e,r);return s.isValid()?null:s.getErrorMessage()};Ui.isValid=function(t,e,r){var s=new Ui(t,e,r);return!!s.isValid()};Pg.VERBOSE.get=function(){return!1};Pg.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ui,Pg);var ms=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ms.prototype.getCoordinates=function(){return this._pts};ms.prototype.size=function(){return this._pts.length};ms.prototype.getCoordinate=function(t){return this._pts[t]};ms.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ms.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:vu.octant(this.getCoordinate(t),this.getCoordinate(t+1))};ms.prototype.setData=function(t){this._data=t};ms.prototype.getData=function(){return this._data};ms.prototype.toString=function(){return zo.toLineString(new Qn(this._pts))};ms.prototype.interfaces_=function(){return[ks]};ms.prototype.getClass=function(){return ms};var Ni=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new jt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Ni.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Ni.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Ni.prototype.getIntersectionSegments=function(){return this._intSegments};Ni.prototype.count=function(){return this._intersectionCount};Ni.prototype.getIntersections=function(){return this._intersections};Ni.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ni.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Ni.prototype.processIntersections=function(t,e,r,s){if(!this._findAllIntersections&&this.hasIntersection()||t===r&&e===s)return null;if(this._isCheckEndSegmentsOnly){var l=this.isEndSegment(t,e)||this.isEndSegment(r,s);if(!l)return null}var p=t.getCoordinates()[e],f=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];this._li.computeIntersection(p,f,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=p,this._intSegments[1]=f,this._intSegments[2]=c,this._intSegments[3]=S,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Ni.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Ni.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Ni.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Ni.prototype.interfaces_=function(){return[Ml]};Ni.prototype.getClass=function(){return Ni};Ni.createAllIntersectionsFinder=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e};Ni.createAnyIntersectionFinder=function(t){return new Ni(t)};Ni.createIntersectionCounter=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qo=function(){this._li=new Ol,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qo.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};qo.prototype.getIntersections=function(){return this._segInt.getIntersections()};qo.prototype.isValid=function(){return this.execute(),this._isValid};qo.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};qo.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Ni(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Sg;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};qo.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ua(this.getErrorMessage(),this._segInt.getInteriorIntersection())};qo.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+zo.toLineString(t[0],t[1])+" and "+zo.toLineString(t[2],t[3])};qo.prototype.interfaces_=function(){return[]};qo.prototype.getClass=function(){return qo};qo.computeIntersections=function(t){var e=new qo(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Nl=function t(){this._nv=null;var e=arguments[0];this._nv=new qo(t.toSegmentStrings(e))};Nl.prototype.checkValid=function(){this._nv.checkValid()};Nl.prototype.interfaces_=function(){return[]};Nl.prototype.getClass=function(){return Nl};Nl.toSegmentStrings=function(t){for(var e=new jt,r=t.iterator();r.hasNext();){var s=r.next();e.add(new ms(s.getCoordinates(),s))}return e};Nl.checkValid=function(t){var e=new Nl(t);e.checkValid()};var Su=function(t){this._mapOp=t};Su.prototype.map=function(t){for(var e=this,r=new jt,s=0;s0&&s<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};var Fs=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new se,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zn&&typeof arguments[1]=="number"){var e=arguments[0],r=arguments[1];t.call(this,e.getCoordinates(),r)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};Fs.prototype.snapVertices=function(t,e){for(var r=this,s=this._isClosed?t.size()-1:t.size(),l=0;l=0&&t.add(f+1,new ct(p),!1)}};Fs.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,s=be.MAX_VALUE,l=-1,p=0;pe&&(e=s)}return e}else if(arguments.length===2){var l=arguments[0],p=arguments[1];return Math.min($n.computeOverlaySnapTolerance(l),$n.computeOverlaySnapTolerance(p))}};$n.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),r=Math.min(e.getHeight(),e.getWidth()),s=r*$n.SNAP_PRECISION_FACTOR;return s};$n.snapToSelf=function(t,e,r){var s=new $n(t);return s.snapToSelf(e,r)};nv.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties($n,nv);var iv=function(t){function e(r,s,l){t.call(this),this._snapTolerance=r||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0?l:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,s){var l=new Fs(r,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},e.prototype.transformCoordinates=function(r,s){var l=r.toCoordinateArray(),p=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(p)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Sr),ir=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ir.prototype.getCommon=function(){return be.longBitsToDouble(this._commonBits)};ir.prototype.add=function(t){var e=be.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=ir.signExpBits(this._commonBits),this._isFirst=!1,null;var r=ir.signExpBits(e);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ir.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=ir.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};ir.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=be.longBitsToDouble(t),r=be.toBinaryString(t),s="0000000000000000000000000000000000000000000000000000000000000000"+r,l=s.substring(s.length-64),p=l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+e+" ]";return p}};ir.prototype.interfaces_=function(){return[]};ir.prototype.getClass=function(){return ir};ir.getBit=function(t,e){var r=1<>52};ir.zeroLowerBits=function(t,e){var r=(1<=0;s--){if(ir.getBit(t,s)!==ir.getBit(e,s))return r;r++}return 52};var qa=function(){this._commonCoord=null,this._ccFilter=new Tu},Ag={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};qa.prototype.addCommonBits=function(t){var e=new Ga(this._commonCoord);t.apply(e),t.geometryChanged()};qa.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ct(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new Ga(e);return t.apply(r),t.geometryChanged(),t};qa.prototype.getCommonCoordinate=function(){return this._commonCoord};qa.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};qa.prototype.interfaces_=function(){return[]};qa.prototype.getClass=function(){return qa};Ag.CommonCoordinateFilter.get=function(){return Tu};Ag.Translater.get=function(){return Ga};Object.defineProperties(qa,Ag);var Tu=function(){this._commonBitsX=new ir,this._commonBitsY=new ir};Tu.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Tu.prototype.getCommonCoordinate=function(){return new ct(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Tu.prototype.interfaces_=function(){return[Ds]};Tu.prototype.getClass=function(){return Tu};var Ga=function(){this.trans=null;var t=arguments[0];this.trans=t};Ga.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,s=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,s)};Ga.prototype.isDone=function(){return!1};Ga.prototype.isGeometryChanged=function(){return!0};Ga.prototype.interfaces_=function(){return[Oo]};Ga.prototype.getClass=function(){return Ga};var ki=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ki.prototype.selfSnap=function(t){var e=new $n(t),r=e.snapTo(t,this._snapTolerance);return r};ki.prototype.removeCommonBits=function(t){this._cbr=new qa,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};ki.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};ki.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=Ie.overlayOp(e[0],e[1],t);return this.prepareResult(r)};ki.prototype.checkValid=function(t){t.isValid()||Bi.out.println("Snapped geometry is invalid")};ki.prototype.computeSnapTolerance=function(){this._snapTolerance=$n.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};ki.prototype.snap=function(t){var e=this.removeCommonBits(t),r=$n.snap(e[0],e[1],this._snapTolerance);return r};ki.prototype.interfaces_=function(){return[]};ki.prototype.getClass=function(){return ki};ki.overlayOp=function(t,e,r){var s=new ki(t,e);return s.getResultGeometry(r)};ki.union=function(t,e){return ki.overlayOp(t,e,Ie.UNION)};ki.intersection=function(t,e){return ki.overlayOp(t,e,Ie.INTERSECTION)};ki.symDifference=function(t,e){return ki.overlayOp(t,e,Ie.SYMDIFFERENCE)};ki.difference=function(t,e){return ki.overlayOp(t,e,Ie.DIFFERENCE)};var cr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};cr.prototype.getResultGeometry=function(t){var e=null,r=!1,s=null;try{e=Ie.overlayOp(this._geom[0],this._geom[1],t);var l=!0;l&&(r=!0)}catch(p){if(p instanceof aa)s=p;else throw p}finally{}if(!r)try{e=ki.overlayOp(this._geom[0],this._geom[1],t)}catch(p){throw p instanceof aa?s:p}finally{}return e};cr.prototype.interfaces_=function(){return[]};cr.prototype.getClass=function(){return cr};cr.overlayOp=function(t,e,r){var s=new cr(t,e);return s.getResultGeometry(r)};cr.union=function(t,e){return cr.overlayOp(t,e,Ie.UNION)};cr.intersection=function(t,e){return cr.overlayOp(t,e,Ie.INTERSECTION)};cr.symDifference=function(t,e){return cr.overlayOp(t,e,Ie.SYMDIFFERENCE)};cr.difference=function(t,e){return cr.overlayOp(t,e,Ie.DIFFERENCE)};var Up=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Up.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Up.prototype.interfaces_=function(){return[]};Up.prototype.getClass=function(){return Up};var Vr=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=p}},Mg={INSERT:{configurable:!0},DELETE:{configurable:!0}};Vr.prototype.isDelete=function(){return this._eventType===Vr.DELETE};Vr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Vr.prototype.getObject=function(){return this._obj};Vr.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Vr.prototype.getInsertEvent=function(){return this._insertEvent};Vr.prototype.isInsert=function(){return this._eventType===Vr.INSERT};Vr.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Vr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Vr.prototype.interfaces_=function(){return[xo]};Vr.prototype.getClass=function(){return Vr};Mg.INSERT.get=function(){return 1};Mg.DELETE.get=function(){return 2};Object.defineProperties(Vr,Mg);var xf=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var qi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};qi.prototype.isTrivialIntersection=function(t,e,r,s){if(t===r&&this._li.getIntersectionNum()===1){if(qi.isAdjacentSegments(e,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(e===0&&s===l||s===0&&e===l)return!0}}return!1};qi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};qi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};qi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};qi.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next(),l=s.getCoordinate();if(t.isIntersection(l))return!0}return!1};qi.prototype.hasProperIntersection=function(){return this._hasProper};qi.prototype.hasIntersection=function(){return this._hasIntersection};qi.prototype.isDone=function(){return this._isDone};qi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};qi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};qi.prototype.addIntersections=function(t,e,r,s){if(t===r&&e===s)return null;this.numTests++;var l=t.getCoordinates()[e],p=t.getCoordinates()[e+1],f=r.getCoordinates()[s],c=r.getCoordinates()[s+1];this._li.computeIntersection(l,p,f,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,s)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),r.addIntersections(this._li,s,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};qi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var Dw=function(t){function e(){t.call(this),this.events=new jt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;Bo.sort(this.events);for(var s=0;se||this._maxp?1:0};qp.prototype.interfaces_=function(){return[Uc]};qp.prototype.getClass=function(){return qp};var Rw=function(t){function e(){t.call(this),this._item=null;var r=arguments[0],s=arguments[1],l=arguments[2];this._min=r,this._max=s,this._item=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;l.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Bs),Nw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var r=arguments[0],s=arguments[1];this._node1=r,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,s){this._min=Math.min(r._min,s._min),this._max=Math.max(r._max,s._max)},e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;this._node1!==null&&this._node1.query(r,s,l),this._node2!==null&&this._node2.query(r,s,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Bs),Vs=function(){this._leaves=new jt,this._root=null,this._level=0};Vs.prototype.buildTree=function(){var t=this;Bo.sort(this._leaves,new Bs.NodeComparator);for(var e=this._leaves,r=null,s=new jt;;){if(t.buildLevel(e,s),s.size()===1)return s.get(0);r=e,e=s,s=r}};Vs.prototype.insert=function(t,e,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Rw(t,e,r))};Vs.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)};Vs.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Vs.prototype.printNode=function(t){Bi.out.println(zo.toLineString(new ct(t._min,this._level),new ct(t._max,this._level)))};Vs.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Vs.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),s=new Array(r.size()).fill(null),l=0,p=r.iterator();p.hasNext();){var f=p.next();s[l++]=f.getCoordinate().copy()}return s},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,s,l){if(this.isBoundaryNode(r,s))return null;l===dt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,s):this.insertPoint(r,s,l)},e.prototype.addPolygonRing=function(r,s,l){if(r.isEmpty())return null;var p=Oe.removeRepeatedPoints(r.getCoordinates());if(p.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=p[0],null;var f=s,c=l;Kt.isCCW(p)&&(f=l,c=s);var S=new vf(p,new on(this._argIndex,dt.BOUNDARY,f,c));this._lineEdgeMap.put(r,S),this.insertEdge(S),this.insertPoint(this._argIndex,p[0],dt.BOUNDARY)},e.prototype.insertPoint=function(r,s,l){var p=this._nodes.addNode(s),f=p.getLabel();f===null?p._label=new on(r,l):f.setLocation(r,l)},e.prototype.createEdgeSetIntersector=function(){return new Dw},e.prototype.addSelfIntersectionNodes=function(r){for(var s=this,l=this._edges.iterator();l.hasNext();)for(var p=l.next(),f=p.getLabel().getLocation(r),c=p.eiList.iterator();c.hasNext();){var S=c.next();s.addSelfIntersectionNode(r,S.coord,f)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof As&&(this._useBoundaryDeterminationRule=!1),r instanceof pi)this.addPolygon(r);else if(r instanceof Zn)this.addLineString(r);else if(r instanceof Or)this.addPoint(r);else if(r instanceof Xc)this.addCollection(r);else if(r instanceof Ll)this.addCollection(r);else if(r instanceof As)this.addCollection(r);else if(r instanceof ar)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var s=this,l=0;l50?(this._areaPtLocator===null&&(this._areaPtLocator=new eh(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,s){return r.isInBoundary(s)?dt.BOUNDARY:dt.INTERIOR},e}(Vn),ih=function(){if(this._li=new Ol,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new _p(0,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=_o.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,e,s),this._arg[1]=new _p(1,r,s)}else if(arguments.length===3){var l=arguments[0],p=arguments[1],f=arguments[2];l.getPrecisionModel().compareTo(p.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(p.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,l,f),this._arg[1]=new _p(1,p,f)}};ih.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};ih.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};ih.prototype.interfaces_=function(){return[]};ih.prototype.getClass=function(){return ih};var bl=function(){};bl.prototype.interfaces_=function(){return[]};bl.prototype.getClass=function(){return bl};bl.map=function(){if(arguments[0]instanceof pe&&me(arguments[1],bl.MapOp)){for(var t=arguments[0],e=arguments[1],r=new jt,s=0;s=t.size()?null:t.get(e)};ri.union=function(t){var e=new ri(t);return e.union()};sv.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(ri,sv);var bf=function(){};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};bf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Ie.createEmptyResult(Ie.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),cr.overlayOp(t,e,Ie.UNION)};function Fl(){return new wf}function wf(){this.reset()}wf.prototype={constructor:wf,reset:function(){this.s=this.t=0},add:function(t){jy(af,t,this.t),jy(this,af.s,this.s),this.s?this.t+=af.t:this.s=af.t},valueOf:function(){return this.s}};var af=new wf;function jy(t,e,r){var s=t.s=e+r,l=s-e,p=s-l;t.t=e-p+(r-l)}var ug=Math.PI,Zy=ug*2;Fl();Fl();Fl();function Hy(t,e){return[t>ug?t-Zy:t<-ug?t+Zy:t,e]}Hy.invert=Hy;function av(t,e){return te?1:t>=e?0:NaN}function kw(t){return t.length===1&&(t=zw(t)),{left:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)<0?s=p+1:l=p}return s},right:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)>0?l=p:s=p+1}return s}}}function zw(t){return function(e,r){return av(t(e),r)}}kw(av);Fl();Fl();Fl();Fl();Fl();function Wy(){}Wy.prototype={constructor:Wy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Xy(t,e){return[t,e]}Xy.invert=Xy;const Ow=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Fw={decimalLatitude:40.123,decimalLongitude:-74.123},Bw=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Vw=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function Uw(){const t=[];return Ow.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Fw})}),[...t,...Bw,...Vw]}const qw=Uw();qw.map(t=>t.verbatimCoordinates);function Yy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Ky(t){let e,r,s,l=t[1]+"",p,f;return{c(){e=sn("li"),r=sn("span"),s=Hi(),p=Cl(l),f=Hi(),Tn(r,"class","svelte-kzgqtg"),Ro(r,"background",t[2])},m(c,S){hn(c,e,S),Cn(e,r),Cn(e,s),Cn(e,p),Cn(e,f)},p(c,S){S&1&&Ro(r,"background",c[2]),S&1&&l!==(l=c[1]+"")&&Tp(p,l)},d(c){c&&an(e)}}}function Gw(t){let e,r=gl(t[0]),s=[];for(let l=0;l{"rows"in l&&r(0,s=l.rows)},[s]}class L2 extends ao{constructor(e){super(),so(this,e,jw,Gw,Cr,{rows:0})}}const Zw=t=>({props:t&8}),Jy=t=>({props:Xw(t[3])});function Hw(t){let e;const r=t[1].default,s=wl(r,t,t[2],Jy);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&12)&&El(s,r,l,l[2],e?Il(r,l[2],p,Zw):Sl(l[2]),Jy)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Ww(t){let e,r;return e=new Zb({props:{openOn:t[0],$$slots:{default:[Hw,({features:s})=>({3:s}),({features:s})=>s?8:0]},$$scope:{ctx:t}}}),{c(){du(e.$$.fragment)},m(s,l){_l(e,s,l),r=!0},p(s,[l]){const p={};l&1&&(p.openOn=s[0]),l&12&&(p.$$scope={dirty:l,ctx:s}),e.$set(p)},i(s){r||(dn(e.$$.fragment,s),r=!0)},o(s){Fn(e.$$.fragment,s),r=!1},d(s){yl(e,s)}}}function Xw(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function Yw(t,e,r){let{$$slots:s={},$$scope:l}=e,{openOn:p="hover"}=e;return t.$$set=f=>{"openOn"in f&&r(0,p=f.openOn),"$$scope"in f&&r(2,l=f.$$scope)},[p,s,l]}class P2 extends ao{constructor(e){super(),so(this,e,Yw,Ww,Cr,{openOn:0})}}function Qy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function $y(t){let e,r,s=t[1]+"",l,p,f,c=t[2]+"",S,L;return{c(){e=sn("tr"),r=sn("td"),l=Cl(s),p=Hi(),f=sn("td"),S=Cl(c),L=Hi()},m(R,N){hn(R,e,N),Cn(e,r),Cn(r,l),Cn(e,p),Cn(e,f),Cn(f,S),Cn(e,L)},p(R,N){N&1&&s!==(s=R[1]+"")&&Tp(l,s),N&1&&c!==(c=R[2]+"")&&Tp(S,c)},d(R){R&&an(e)}}}function Kw(t){let e,r,s=gl(Object.entries(t[0])),l=[];for(let p=0;p{"properties"in l&&r(0,s=l.properties)},[s]}class A2 extends ao{constructor(e){super(),so(this,e,Jw,Kw,Cr,{properties:0})}}function t0(t,e,r){const s=t.slice();return s[3]=e[r],s}function e0(t,e,r){const s=t.slice();return s[6]=e[r],s}function n0(t){let e,r;return{c(){e=sn("span"),r=Cl(`  - `),Ro(e,"background",t[6]),Ro(e,"width","100%"),Ro(e,"border","1px solid black")},m(s,l){hn(s,e,l),Cn(e,r)},p(s,l){l&1&&Ro(e,"background",s[6])},d(s){s&&an(e)}}}function Qw(t){let e,r=t[3]+"",s;return{c(){e=sn("span"),s=Cl(r)},m(l,p){hn(l,e,p),Cn(e,s)},p(l,p){p&2&&r!==(r=l[3]+"")&&Tp(s,r)},d(l){l&&an(e)}}}function $w(t){let e,r=t[3].toFixed(t[2])+"",s;return{c(){e=sn("span"),s=Cl(r)},m(l,p){hn(l,e,p),Cn(e,s)},p(l,p){p&6&&r!==(r=l[3].toFixed(l[2])+"")&&Tp(s,r)},d(l){l&&an(e)}}}function i0(t){let e;function r(p,f){return p[2]>0?$w:Qw}let s=r(t),l=s(t);return{c(){l.c(),e=If()},m(p,f){l.m(p,f),hn(p,e,f)},p(p,f){s===(s=r(p))&&l?l.p(p,f):(l.d(1),l=s(p),l&&(l.c(),l.m(e.parentNode,e)))},d(p){p&&an(e),l.d(p)}}}function t2(t){let e,r,s,l=gl(t[0]),p=[];for(let S=0;S{"colorScale"in f&&r(0,s=f.colorScale),"limits"in f&&r(1,l=f.limits),"decimalPlaces"in f&&r(2,p=f.decimalPlaces)},[s,l,p]}class M2 extends ao{constructor(e){super(),so(this,e,e2,t2,Cr,{colorScale:0,limits:1,decimalPlaces:2})}}const n2=t=>({}),r0=t=>({}),i2=t=>({}),o0=t=>({});function r2(t){let e,r,s,l;const p=t[1].left,f=wl(p,t,t[0],o0),c=t[1].main,S=wl(c,t,t[0],r0);return{c(){e=sn("div"),f&&f.c(),r=Hi(),s=sn("div"),S&&S.c(),Tn(e,"class","left svelte-6kzmjs"),Tn(s,"class","main svelte-6kzmjs")},m(L,R){hn(L,e,R),f&&f.m(e,null),hn(L,r,R),hn(L,s,R),S&&S.m(s,null),l=!0},p(L,[R]){f&&f.p&&(!l||R&1)&&El(f,p,L,L[0],l?Il(p,L[0],R,i2):Sl(L[0]),o0),S&&S.p&&(!l||R&1)&&El(S,c,L,L[0],l?Il(c,L[0],R,n2):Sl(L[0]),r0)},i(L){l||(dn(f,L),dn(S,L),l=!0)},o(L){Fn(f,L),Fn(S,L),l=!1},d(L){L&&(an(e),an(r),an(s)),f&&f.d(L),S&&S.d(L)}}}function o2(t,e,r){let{$$slots:s={},$$scope:l}=e;return t.$$set=p=>{"$$scope"in p&&r(0,l=p.$$scope)},[l,s]}class D2 extends ao{constructor(e){super(),so(this,e,o2,r2,Cr,{})}}export{oa as $,p0 as A,gy as B,a1 as C,If as D,wr as E,d2 as F,wl as G,T2 as H,i1 as I,El as J,Sl as K,D2 as L,x2 as M,Il as N,cg as O,p2 as P,hg as Q,m2 as R,ao as S,Qr as T,wp as U,u2 as V,c2 as W,D0 as X,dg as Y,is as Z,b1 as _,_l as a,b2 as a0,_2 as a1,t1 as a2,v2 as a3,mp as a4,y2 as a5,w2 as a6,C2 as a7,S2 as a8,P2 as a9,A2 as aa,Tp as ab,mu as ac,r1 as ad,l2 as ae,L2 as af,E2 as ag,M2 as ah,I2 as ai,h2 as aj,a2 as ak,f2 as al,M0 as am,pb as an,g2 as ao,db as ap,gl as aq,hf as ar,Fn as b,du as c,yl as d,sn as e,Hi as f,Cl as g,Tn as h,so as i,Vm as j,pf as k,hn as l,Ps as m,Cn as n,u1 as o,hy as p,yp as q,oh as r,Cr as s,dn as t,sh as u,an as v,Lu as w,Vc as x,f0 as y,Ro as z}; +`)}return t.toString()};Ji.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();r.computeLabel(t)}};Ji.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var r=[!1,!1],s=this.iterator();s.hasNext();)for(var l=s.next(),p=l.getLabel(),f=0;f<2;f++)p.isLine(f)&&p.getLocation(f)===dt.BOUNDARY&&(r[f]=!0);for(var c=this.iterator();c.hasNext();)for(var S=c.next(),L=S.getLabel(),R=0;R<2;R++)if(L.isAnyNull(R)){var N=dt.NONE;if(r[R])N=dt.EXTERIOR;else{var U=S.getCoordinate();N=e.getLocation(R,U,t)}L.setAllLocationsIfNull(R,N)}};Ji.prototype.getDegree=function(){return this._edgeMap.size()};Ji.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null};Ji.prototype.interfaces_=function(){return[]};Ji.prototype.getClass=function(){return Ji};var Mw=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var r=this;this.getResultAreaEdges();for(var s=null,l=null,p=this._SCANNING_FOR_INCOMING,f=0;f=0;p--){var f=r._edgeList.get(p),c=f.getSym();l===null&&(l=c),s!==null&&c.setNext(s),s=f}l.setNext(s)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),p=s.getDepth(kt.LEFT),f=s.getDepth(kt.RIGHT),c=this.computeDepths(l+1,this._edgeList.size(),p),S=this.computeDepths(0,l,c);if(S!==f)throw new ua("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],R=arguments[1],N=arguments[2],U=N,lt=L;lt=0;c--){var S=s._resultAreaEdgeList.get(c),L=S.getSym();switch(l===null&&S.getEdgeRing()===r&&(l=S),f){case s._SCANNING_FOR_INCOMING:if(L.getEdgeRing()!==r)continue;p=L,f=s._LINKING_TO_OUTGOING;break;case s._LINKING_TO_OUTGOING:if(S.getEdgeRing()!==r)continue;p.setNextMin(S),f=s._SCANNING_FOR_INCOMING;break}}f===this._LINKING_TO_OUTGOING&&(Pe.isTrue(l!==null,"found null for first outgoing dirEdge"),Pe.isTrue(l.getEdgeRing()===r,"unable to link last incoming dirEdge"),p.setNextMin(l))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,s=this.iterator();s.hasNext();){var l=s.next();l.isInResult()&&r++}return r}else if(arguments.length===1){for(var p=arguments[0],f=0,c=this.iterator();c.hasNext();){var S=c.next();S.getEdgeRing()===p&&f++}return f}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=dt.NONE,s=this.iterator();s.hasNext();){var l=s.next(),p=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){r=dt.INTERIOR;break}if(p.isInResult()){r=dt.EXTERIOR;break}}}if(r===dt.NONE)return null;for(var f=r,c=this.iterator();c.hasNext();){var S=c.next(),L=S.getSym();S.isLineEdge()?S.getEdge().setCovered(f===dt.INTERIOR):(S.isInResult()&&(f=dt.EXTERIOR),L.isInResult()&&(f=dt.INTERIOR))}},e.prototype.computeLabelling=function(r){var s=this;t.prototype.computeLabelling.call(this,r),this._label=new on(dt.NONE);for(var l=this.iterator();l.hasNext();)for(var p=l.next(),f=p.getEdge(),c=f.getLabel(),S=0;S<2;S++){var L=c.getLocation(S);(L===dt.INTERIOR||L===dt.BOUNDARY)&&s._label.setLocation(S,dt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ji),Y0=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new Rf(r,new Mw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yc),Fa=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Fa.prototype.compareTo=function(t){var e=t,r=Fa.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return r};Fa.prototype.interfaces_=function(){return[xo]};Fa.prototype.getClass=function(){return Fa};Fa.orientation=function(t){return Oe.increasingDirection(t)===1};Fa.compareOriented=function(t,e,r,s){for(var l=e?1:-1,p=s?1:-1,f=e?t.length:-1,c=s?r.length:-1,S=e?0:t.length-1,L=s?0:r.length-1;;){var R=t[S].compareTo(r[L]);if(R!==0)return R;S+=l,L+=p;var N=S===f,U=L===c;if(N&&!U)return-1;if(!N&&U)return 1;if(N&&U)return 0}};var Vo=function(){this._edges=new jt,this._ocaMap=new Yi};Vo.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var r=0;r0&&t.print(","),t.print("(");for(var l=s.getCoordinates(),p=0;p0&&t.print(","),t.print(l[p].x+" "+l[p].y);t.println(")")}t.print(") ")};Vo.prototype.addAll=function(t){for(var e=this,r=t.iterator();r.hasNext();)e.add(r.next())};Vo.prototype.findEdgeIndex=function(t){for(var e=this,r=0;r0||!e.coord.equals2D(l);p||s--;var f=new Array(s).fill(null),c=0;f[c++]=new ct(t.coord);for(var S=t.segmentIndex+1;S<=e.segmentIndex;S++)f[c++]=r.edge.pts[S];return p&&(f[c]=e.coord),new vf(f,new on(this.edge._label))};zs.prototype.add=function(t,e,r){var s=new ds(t,e,r),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)};zs.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();if(r.coord.equals(t))return!0}return!1};zs.prototype.interfaces_=function(){return[]};zs.prototype.getClass=function(){return zs};var Dl=function(){};Dl.prototype.getChainStartIndices=function(t){var e=this,r=0,s=new jt;s.add(new as(r));do{var l=e.findChainEnd(t,r);s.add(new as(l)),r=l}while(rr?e:r};ha.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return er&&(l=1),t._depth[e][s]=l}}};Fi.prototype.getDelta=function(t){return this._depth[t][kt.RIGHT]-this._depth[t][kt.LEFT]};Fi.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?dt.EXTERIOR:dt.INTERIOR};Fi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Fi.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],r=0;r<2;r++)for(var s=1;s<3;s++){var l=e.getLocation(r,s);(l===dt.EXTERIOR||l===dt.INTERIOR)&&(t.isNull(r,s)?t._depth[r][s]=Fi.depthAtLocation(l):t._depth[r][s]+=Fi.depthAtLocation(l))}else if(arguments.length===3){var p=arguments[0],f=arguments[1],c=arguments[2];c===dt.INTERIOR&&this._depth[p][f]++}};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};Fi.depthAtLocation=function(t){return t===dt.EXTERIOR?0:t===dt.INTERIOR?1:Fi.NULL_VALUE};K0.NULL_VALUE.get=function(){return-1};Object.defineProperties(Fi,K0);var vf=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new zs(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Fi,this._depthDelta=0,arguments.length===1){var r=arguments[0];e.call(this,r,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var s=new e(r,on.toLineLabel(this._label));return s},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var s=this;if(!(r instanceof e))return!1;var l=r;if(this.pts.length!==l.pts.length)return!1;for(var p=!0,f=!0,c=this.pts.length,S=0;S0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var s=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var l=0;l0&&r.print(","),r.print(s.pts[l].x+" "+s.pts[l].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var s=this;r.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)r.print(s.pts[l]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ha(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new oe;for(var s=0;s0&&s.append(","),s.append(r.pts[l].x+" "+r.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},e.prototype.isPointwiseEqual=function(r){var s=this;if(this.pts.length!==r.pts.length)return!1;for(var l=0;ls||this._maxyp;if(f)return!1;var c=this.intersectsToleranceSquare(t,e);return Pe.isTrue(!(f&&c),"Found bad envelope test"),c};Er.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ct(this._maxx,this._maxy),this._corner[1]=new ct(this._minx,this._maxy),this._corner[2]=new ct(this._minx,this._miny),this._corner[3]=new ct(this._maxx,this._miny)};Er.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};Er.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};Er.prototype.getCoordinate=function(){return this._originalPt};Er.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};Er.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Er.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new oe(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};Er.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};Er.prototype.intersectsToleranceSquare=function(t,e){var r=!1,s=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||r&&s||t.equals(this._pt)||e.equals(this._pt))};Er.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),s=t.getCoordinate(e+1);return this.intersects(r,s)?(t.addIntersection(this.getCoordinate(),e),!0):!1};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Q0.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(Er,Q0);var Vp=function(){this.tempEnv1=new oe,this.selectedSegment=new se};Vp.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};Vp.prototype.interfaces_=function(){return[]};Vp.prototype.getClass=function(){return Vp};var $c=function(){this._index=null;var t=arguments[0];this._index=t},$0={HotPixelSnapAction:{configurable:!0}};$c.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=e.getSafeEnvelope(),p=new tv(e,r,s);return this._index.query(l,{interfaces_:function(){return[za]},visitItem:function(f){var c=f;c.select(l,p)}}),p.isNodeAdded()}};$c.prototype.interfaces_=function(){return[]};$c.prototype.getClass=function(){return $c};$0.HotPixelSnapAction.get=function(){return tv};Object.defineProperties($c,$0);var tv=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=r,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1],l=r.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),bu=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new jt};bu.prototype.processIntersections=function(t,e,r,s){var l=this;if(t===r&&e===s)return null;var p=t.getCoordinates()[e],f=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];if(this._li.computeIntersection(p,f,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var L=0;L=0;e--){try{t.bufferReducedPrecision(e)}catch(p){if(p instanceof ua)t._saveException=p;else throw p}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],s=Wi.precisionScaleFactor(this._argGeom,this._distance,r),l=new nn(s);this.bufferFixedPrecision(l)}};Wi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===nn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Wi.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Wi.prototype.bufferOriginalPrecision=function(){try{var t=new sr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof aa)this._saveException=e;else throw e}finally{}};Wi.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Wi.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};Wi.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new Wi(t),s=r.getResultGeometry(e);return s}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var l=arguments[0],p=arguments[1],f=arguments[2],c=new Wi(l);c.setQuadrantSegments(f);var S=c.getResultGeometry(p);return S}else if(arguments[2]instanceof $e&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var L=arguments[0],R=arguments[1],N=arguments[2],U=new Wi(L,N),lt=U.getResultGeometry(R);return lt}}else if(arguments.length===4){var ht=arguments[0],vt=arguments[1],wt=arguments[2],Mt=arguments[3],Dt=new Wi(ht);Dt.setQuadrantSegments(wt),Dt.setEndCapStyle(Mt);var Bt=Dt.getResultGeometry(vt);return Bt}};Wi.precisionScaleFactor=function(t,e,r){var s=t.getEnvelopeInternal(),l=eo.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY())),p=e>0?e:0,f=l+2*p,c=Math.trunc(Math.log(f)/Math.log(10)+1),S=r-c,L=Math.pow(10,S);return L};hh.CAP_ROUND.get=function(){return $e.CAP_ROUND};hh.CAP_BUTT.get=function(){return $e.CAP_FLAT};hh.CAP_FLAT.get=function(){return $e.CAP_FLAT};hh.CAP_SQUARE.get=function(){return $e.CAP_SQUARE};hh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Wi,hh);var rr=function(){this._pt=[new ct,new ct],this._distance=be.NaN,this._isNull=!0};rr.prototype.getCoordinates=function(){return this._pt};rr.prototype.getCoordinate=function(t){return this._pt[t]};rr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var s=e.distance(r);sthis._distance&&this.initialize(e,r,s)}};rr.prototype.interfaces_=function(){return[]};rr.prototype.getClass=function(){return rr};var Ls=function(){};Ls.prototype.interfaces_=function(){return[]};Ls.prototype.getClass=function(){return Ls};Ls.computeDistance=function(){if(arguments[2]instanceof rr&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=t.getCoordinates(),l=new se,p=0;p0||this._isIn?dt.INTERIOR:dt.EXTERIOR)};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};var or=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],r=arguments[1];t.call(this,e,t.INSIDE_AREA,r)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._component=s,this._segIndex=l,this._pt=p}},ev={INSIDE_AREA:{configurable:!0}};or.prototype.isInsideArea=function(){return this._segIndex===or.INSIDE_AREA};or.prototype.getCoordinate=function(){return this._pt};or.prototype.getGeometryComponent=function(){return this._component};or.prototype.getSegmentIndex=function(){return this._segIndex};or.prototype.interfaces_=function(){return[]};or.prototype.getClass=function(){return or};ev.INSIDE_AREA.get=function(){return-1};Object.defineProperties(or,ev);var Ra=function(t){this._pts=t||null};Ra.prototype.filter=function(t){t instanceof Or&&this._pts.add(t)};Ra.prototype.interfaces_=function(){return[us]};Ra.prototype.getClass=function(){return Ra};Ra.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Or?Bo.singletonList(t):Ra.getPoints(t,new jt)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];return e instanceof Or?r.add(e):e instanceof ar&&e.apply(new Ra(r)),r}};var Iu=function(){this._locations=null;var t=arguments[0];this._locations=t};Iu.prototype.filter=function(t){(t instanceof Or||t instanceof Zn||t instanceof pi)&&this._locations.add(new or(t,0,t.getCoordinate()))};Iu.prototype.interfaces_=function(){return[us]};Iu.prototype.getClass=function(){return Iu};Iu.getLocations=function(t){var e=new jt;return t.apply(new Iu(e)),e};var Vi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Uo,this._minDistanceLocation=null,this._minDistance=be.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=s,this._terminateDistance=l}};Vi.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=1-r,p=sa.getPolygons(this._geom[r]);if(p.size()>0){var f=Iu.getLocations(this._geom[l]);if(this.computeContainmentDistance(f,p,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[r]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&me(arguments[0],ko)&&me(arguments[1],ko)){for(var c=arguments[0],S=arguments[1],L=arguments[2],R=0;Rthis._minDistance)return null;for(var l=e.getCoordinates(),p=r.getCoordinate(),f=0;fthis._minDistance)return null;for(var lt=R.getCoordinates(),ht=N.getCoordinates(),vt=0;vtthis._distance&&this.initialize(e,r,s)}};Xi.prototype.interfaces_=function(){return[]};Xi.prototype.getClass=function(){return Xi};var rs=function(){};rs.prototype.interfaces_=function(){return[]};rs.prototype.getClass=function(){return rs};rs.computeDistance=function(){if(arguments[2]instanceof Xi&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=new se,l=t.getCoordinates(),p=0;p1||t<=0)throw new Rn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};go.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};go.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};go.prototype.computeOrientedDistance=function(t,e,r){var s=new Eu(e);if(t.apply(s),r.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new Ua(e,this._densifyFrac);t.apply(l),r.setMaximum(l.getMaxPointDistance())}};go.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};go.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new go(t,e);return r.distance()}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2],f=new go(s,l);return f.setDensifyFraction(p),f.distance()}};Tg.MaxPointDistanceFilter.get=function(){return Eu};Tg.MaxDensifiedByFractionDistanceFilter.get=function(){return Ua};Object.defineProperties(go,Tg);var Eu=function(){this._maxPtDist=new Xi,this._minPtDist=new Xi,this._euclideanDist=new rs,this._geom=null;var t=arguments[0];this._geom=t};Eu.prototype.filter=function(t){this._minPtDist.initialize(),rs.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Eu.prototype.getMaxPointDistance=function(){return this._maxPtDist};Eu.prototype.interfaces_=function(){return[Ds]};Eu.prototype.getClass=function(){return Eu};var Ua=function(){this._maxPtDist=new Xi,this._minPtDist=new Xi,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Ua.prototype.filter=function(t,e){var r=this;if(e===0)return null;for(var s=t.getCoordinate(e-1),l=t.getCoordinate(e),p=(l.x-s.x)/this._numSubSegs,f=(l.y-s.y)/this._numSubSegs,c=0;cr){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+zo.toLineString(l[0],l[1])+")"}};zr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=zr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),zr.VERBOSE&&Bi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};zr.prototype.checkNegativeValid=function(){if(!(this._input instanceof pi||this._input instanceof As||this._input instanceof ar))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};zr.prototype.getErrorIndicator=function(){return this._errorIndicator};zr.prototype.checkMinimumDistance=function(t,e,r){var s=new Vi(t,e,r);if(this._minDistanceFound=s.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ui.prototype.report=function(t){if(!Ui.VERBOSE)return null;Bi.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ui.prototype.getErrorMessage=function(){return this._errorMsg};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.isValidMsg=function(t,e,r){var s=new Ui(t,e,r);return s.isValid()?null:s.getErrorMessage()};Ui.isValid=function(t,e,r){var s=new Ui(t,e,r);return!!s.isValid()};Pg.VERBOSE.get=function(){return!1};Pg.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ui,Pg);var ms=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ms.prototype.getCoordinates=function(){return this._pts};ms.prototype.size=function(){return this._pts.length};ms.prototype.getCoordinate=function(t){return this._pts[t]};ms.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ms.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:vu.octant(this.getCoordinate(t),this.getCoordinate(t+1))};ms.prototype.setData=function(t){this._data=t};ms.prototype.getData=function(){return this._data};ms.prototype.toString=function(){return zo.toLineString(new Qn(this._pts))};ms.prototype.interfaces_=function(){return[ks]};ms.prototype.getClass=function(){return ms};var Ni=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new jt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Ni.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Ni.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Ni.prototype.getIntersectionSegments=function(){return this._intSegments};Ni.prototype.count=function(){return this._intersectionCount};Ni.prototype.getIntersections=function(){return this._intersections};Ni.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ni.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Ni.prototype.processIntersections=function(t,e,r,s){if(!this._findAllIntersections&&this.hasIntersection()||t===r&&e===s)return null;if(this._isCheckEndSegmentsOnly){var l=this.isEndSegment(t,e)||this.isEndSegment(r,s);if(!l)return null}var p=t.getCoordinates()[e],f=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];this._li.computeIntersection(p,f,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=p,this._intSegments[1]=f,this._intSegments[2]=c,this._intSegments[3]=S,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Ni.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Ni.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Ni.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Ni.prototype.interfaces_=function(){return[Ml]};Ni.prototype.getClass=function(){return Ni};Ni.createAllIntersectionsFinder=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e};Ni.createAnyIntersectionFinder=function(t){return new Ni(t)};Ni.createIntersectionCounter=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qo=function(){this._li=new Ol,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qo.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};qo.prototype.getIntersections=function(){return this._segInt.getIntersections()};qo.prototype.isValid=function(){return this.execute(),this._isValid};qo.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};qo.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Ni(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Sg;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};qo.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ua(this.getErrorMessage(),this._segInt.getInteriorIntersection())};qo.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+zo.toLineString(t[0],t[1])+" and "+zo.toLineString(t[2],t[3])};qo.prototype.interfaces_=function(){return[]};qo.prototype.getClass=function(){return qo};qo.computeIntersections=function(t){var e=new qo(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Nl=function t(){this._nv=null;var e=arguments[0];this._nv=new qo(t.toSegmentStrings(e))};Nl.prototype.checkValid=function(){this._nv.checkValid()};Nl.prototype.interfaces_=function(){return[]};Nl.prototype.getClass=function(){return Nl};Nl.toSegmentStrings=function(t){for(var e=new jt,r=t.iterator();r.hasNext();){var s=r.next();e.add(new ms(s.getCoordinates(),s))}return e};Nl.checkValid=function(t){var e=new Nl(t);e.checkValid()};var Su=function(t){this._mapOp=t};Su.prototype.map=function(t){for(var e=this,r=new jt,s=0;s0&&s<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};var Fs=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new se,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zn&&typeof arguments[1]=="number"){var e=arguments[0],r=arguments[1];t.call(this,e.getCoordinates(),r)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};Fs.prototype.snapVertices=function(t,e){for(var r=this,s=this._isClosed?t.size()-1:t.size(),l=0;l=0&&t.add(f+1,new ct(p),!1)}};Fs.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,s=be.MAX_VALUE,l=-1,p=0;pe&&(e=s)}return e}else if(arguments.length===2){var l=arguments[0],p=arguments[1];return Math.min($n.computeOverlaySnapTolerance(l),$n.computeOverlaySnapTolerance(p))}};$n.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),r=Math.min(e.getHeight(),e.getWidth()),s=r*$n.SNAP_PRECISION_FACTOR;return s};$n.snapToSelf=function(t,e,r){var s=new $n(t);return s.snapToSelf(e,r)};nv.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties($n,nv);var iv=function(t){function e(r,s,l){t.call(this),this._snapTolerance=r||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0?l:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,s){var l=new Fs(r,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},e.prototype.transformCoordinates=function(r,s){var l=r.toCoordinateArray(),p=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(p)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Sr),ir=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ir.prototype.getCommon=function(){return be.longBitsToDouble(this._commonBits)};ir.prototype.add=function(t){var e=be.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=ir.signExpBits(this._commonBits),this._isFirst=!1,null;var r=ir.signExpBits(e);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ir.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=ir.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};ir.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=be.longBitsToDouble(t),r=be.toBinaryString(t),s="0000000000000000000000000000000000000000000000000000000000000000"+r,l=s.substring(s.length-64),p=l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+e+" ]";return p}};ir.prototype.interfaces_=function(){return[]};ir.prototype.getClass=function(){return ir};ir.getBit=function(t,e){var r=1<>52};ir.zeroLowerBits=function(t,e){var r=(1<=0;s--){if(ir.getBit(t,s)!==ir.getBit(e,s))return r;r++}return 52};var qa=function(){this._commonCoord=null,this._ccFilter=new Tu},Ag={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};qa.prototype.addCommonBits=function(t){var e=new Ga(this._commonCoord);t.apply(e),t.geometryChanged()};qa.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ct(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new Ga(e);return t.apply(r),t.geometryChanged(),t};qa.prototype.getCommonCoordinate=function(){return this._commonCoord};qa.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};qa.prototype.interfaces_=function(){return[]};qa.prototype.getClass=function(){return qa};Ag.CommonCoordinateFilter.get=function(){return Tu};Ag.Translater.get=function(){return Ga};Object.defineProperties(qa,Ag);var Tu=function(){this._commonBitsX=new ir,this._commonBitsY=new ir};Tu.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Tu.prototype.getCommonCoordinate=function(){return new ct(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Tu.prototype.interfaces_=function(){return[Ds]};Tu.prototype.getClass=function(){return Tu};var Ga=function(){this.trans=null;var t=arguments[0];this.trans=t};Ga.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,s=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,s)};Ga.prototype.isDone=function(){return!1};Ga.prototype.isGeometryChanged=function(){return!0};Ga.prototype.interfaces_=function(){return[Oo]};Ga.prototype.getClass=function(){return Ga};var ki=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ki.prototype.selfSnap=function(t){var e=new $n(t),r=e.snapTo(t,this._snapTolerance);return r};ki.prototype.removeCommonBits=function(t){this._cbr=new qa,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};ki.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};ki.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=Ie.overlayOp(e[0],e[1],t);return this.prepareResult(r)};ki.prototype.checkValid=function(t){t.isValid()||Bi.out.println("Snapped geometry is invalid")};ki.prototype.computeSnapTolerance=function(){this._snapTolerance=$n.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};ki.prototype.snap=function(t){var e=this.removeCommonBits(t),r=$n.snap(e[0],e[1],this._snapTolerance);return r};ki.prototype.interfaces_=function(){return[]};ki.prototype.getClass=function(){return ki};ki.overlayOp=function(t,e,r){var s=new ki(t,e);return s.getResultGeometry(r)};ki.union=function(t,e){return ki.overlayOp(t,e,Ie.UNION)};ki.intersection=function(t,e){return ki.overlayOp(t,e,Ie.INTERSECTION)};ki.symDifference=function(t,e){return ki.overlayOp(t,e,Ie.SYMDIFFERENCE)};ki.difference=function(t,e){return ki.overlayOp(t,e,Ie.DIFFERENCE)};var cr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};cr.prototype.getResultGeometry=function(t){var e=null,r=!1,s=null;try{e=Ie.overlayOp(this._geom[0],this._geom[1],t);var l=!0;l&&(r=!0)}catch(p){if(p instanceof aa)s=p;else throw p}finally{}if(!r)try{e=ki.overlayOp(this._geom[0],this._geom[1],t)}catch(p){throw p instanceof aa?s:p}finally{}return e};cr.prototype.interfaces_=function(){return[]};cr.prototype.getClass=function(){return cr};cr.overlayOp=function(t,e,r){var s=new cr(t,e);return s.getResultGeometry(r)};cr.union=function(t,e){return cr.overlayOp(t,e,Ie.UNION)};cr.intersection=function(t,e){return cr.overlayOp(t,e,Ie.INTERSECTION)};cr.symDifference=function(t,e){return cr.overlayOp(t,e,Ie.SYMDIFFERENCE)};cr.difference=function(t,e){return cr.overlayOp(t,e,Ie.DIFFERENCE)};var Up=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Up.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Up.prototype.interfaces_=function(){return[]};Up.prototype.getClass=function(){return Up};var Vr=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=p}},Mg={INSERT:{configurable:!0},DELETE:{configurable:!0}};Vr.prototype.isDelete=function(){return this._eventType===Vr.DELETE};Vr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Vr.prototype.getObject=function(){return this._obj};Vr.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Vr.prototype.getInsertEvent=function(){return this._insertEvent};Vr.prototype.isInsert=function(){return this._eventType===Vr.INSERT};Vr.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Vr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Vr.prototype.interfaces_=function(){return[xo]};Vr.prototype.getClass=function(){return Vr};Mg.INSERT.get=function(){return 1};Mg.DELETE.get=function(){return 2};Object.defineProperties(Vr,Mg);var xf=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var qi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};qi.prototype.isTrivialIntersection=function(t,e,r,s){if(t===r&&this._li.getIntersectionNum()===1){if(qi.isAdjacentSegments(e,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(e===0&&s===l||s===0&&e===l)return!0}}return!1};qi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};qi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};qi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};qi.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next(),l=s.getCoordinate();if(t.isIntersection(l))return!0}return!1};qi.prototype.hasProperIntersection=function(){return this._hasProper};qi.prototype.hasIntersection=function(){return this._hasIntersection};qi.prototype.isDone=function(){return this._isDone};qi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};qi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};qi.prototype.addIntersections=function(t,e,r,s){if(t===r&&e===s)return null;this.numTests++;var l=t.getCoordinates()[e],p=t.getCoordinates()[e+1],f=r.getCoordinates()[s],c=r.getCoordinates()[s+1];this._li.computeIntersection(l,p,f,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,s)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),r.addIntersections(this._li,s,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};qi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var Dw=function(t){function e(){t.call(this),this.events=new jt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;Bo.sort(this.events);for(var s=0;se||this._maxp?1:0};qp.prototype.interfaces_=function(){return[Uc]};qp.prototype.getClass=function(){return qp};var Rw=function(t){function e(){t.call(this),this._item=null;var r=arguments[0],s=arguments[1],l=arguments[2];this._min=r,this._max=s,this._item=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;l.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Bs),Nw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var r=arguments[0],s=arguments[1];this._node1=r,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,s){this._min=Math.min(r._min,s._min),this._max=Math.max(r._max,s._max)},e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;this._node1!==null&&this._node1.query(r,s,l),this._node2!==null&&this._node2.query(r,s,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Bs),Vs=function(){this._leaves=new jt,this._root=null,this._level=0};Vs.prototype.buildTree=function(){var t=this;Bo.sort(this._leaves,new Bs.NodeComparator);for(var e=this._leaves,r=null,s=new jt;;){if(t.buildLevel(e,s),s.size()===1)return s.get(0);r=e,e=s,s=r}};Vs.prototype.insert=function(t,e,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Rw(t,e,r))};Vs.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)};Vs.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Vs.prototype.printNode=function(t){Bi.out.println(zo.toLineString(new ct(t._min,this._level),new ct(t._max,this._level)))};Vs.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Vs.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),s=new Array(r.size()).fill(null),l=0,p=r.iterator();p.hasNext();){var f=p.next();s[l++]=f.getCoordinate().copy()}return s},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,s,l){if(this.isBoundaryNode(r,s))return null;l===dt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,s):this.insertPoint(r,s,l)},e.prototype.addPolygonRing=function(r,s,l){if(r.isEmpty())return null;var p=Oe.removeRepeatedPoints(r.getCoordinates());if(p.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=p[0],null;var f=s,c=l;Kt.isCCW(p)&&(f=l,c=s);var S=new vf(p,new on(this._argIndex,dt.BOUNDARY,f,c));this._lineEdgeMap.put(r,S),this.insertEdge(S),this.insertPoint(this._argIndex,p[0],dt.BOUNDARY)},e.prototype.insertPoint=function(r,s,l){var p=this._nodes.addNode(s),f=p.getLabel();f===null?p._label=new on(r,l):f.setLocation(r,l)},e.prototype.createEdgeSetIntersector=function(){return new Dw},e.prototype.addSelfIntersectionNodes=function(r){for(var s=this,l=this._edges.iterator();l.hasNext();)for(var p=l.next(),f=p.getLabel().getLocation(r),c=p.eiList.iterator();c.hasNext();){var S=c.next();s.addSelfIntersectionNode(r,S.coord,f)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof As&&(this._useBoundaryDeterminationRule=!1),r instanceof pi)this.addPolygon(r);else if(r instanceof Zn)this.addLineString(r);else if(r instanceof Or)this.addPoint(r);else if(r instanceof Xc)this.addCollection(r);else if(r instanceof Ll)this.addCollection(r);else if(r instanceof As)this.addCollection(r);else if(r instanceof ar)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var s=this,l=0;l50?(this._areaPtLocator===null&&(this._areaPtLocator=new eh(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,s){return r.isInBoundary(s)?dt.BOUNDARY:dt.INTERIOR},e}(Vn),ih=function(){if(this._li=new Ol,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new _p(0,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=_o.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,e,s),this._arg[1]=new _p(1,r,s)}else if(arguments.length===3){var l=arguments[0],p=arguments[1],f=arguments[2];l.getPrecisionModel().compareTo(p.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(p.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,l,f),this._arg[1]=new _p(1,p,f)}};ih.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};ih.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};ih.prototype.interfaces_=function(){return[]};ih.prototype.getClass=function(){return ih};var bl=function(){};bl.prototype.interfaces_=function(){return[]};bl.prototype.getClass=function(){return bl};bl.map=function(){if(arguments[0]instanceof pe&&me(arguments[1],bl.MapOp)){for(var t=arguments[0],e=arguments[1],r=new jt,s=0;s=t.size()?null:t.get(e)};ri.union=function(t){var e=new ri(t);return e.union()};sv.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(ri,sv);var bf=function(){};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};bf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Ie.createEmptyResult(Ie.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),cr.overlayOp(t,e,Ie.UNION)};function Fl(){return new wf}function wf(){this.reset()}wf.prototype={constructor:wf,reset:function(){this.s=this.t=0},add:function(t){jy(af,t,this.t),jy(this,af.s,this.s),this.s?this.t+=af.t:this.s=af.t},valueOf:function(){return this.s}};var af=new wf;function jy(t,e,r){var s=t.s=e+r,l=s-e,p=s-l;t.t=e-p+(r-l)}var ug=Math.PI,Zy=ug*2;Fl();Fl();Fl();function Hy(t,e){return[t>ug?t-Zy:t<-ug?t+Zy:t,e]}Hy.invert=Hy;function av(t,e){return te?1:t>=e?0:NaN}function kw(t){return t.length===1&&(t=zw(t)),{left:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)<0?s=p+1:l=p}return s},right:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)>0?l=p:s=p+1}return s}}}function zw(t){return function(e,r){return av(t(e),r)}}kw(av);Fl();Fl();Fl();Fl();Fl();function Wy(){}Wy.prototype={constructor:Wy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Xy(t,e){return[t,e]}Xy.invert=Xy;const Ow=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Fw={decimalLatitude:40.123,decimalLongitude:-74.123},Bw=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Vw=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function Uw(){const t=[];return Ow.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Fw})}),[...t,...Bw,...Vw]}const qw=Uw();qw.map(t=>t.verbatimCoordinates);function Yy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Ky(t){let e,r,s,l=t[1]+"",p,f;return{c(){e=sn("li"),r=sn("span"),s=Hi(),p=Cl(l),f=Hi(),Tn(r,"class","svelte-kzgqtg"),Ro(r,"background",t[2])},m(c,S){hn(c,e,S),Cn(e,r),Cn(e,s),Cn(e,p),Cn(e,f)},p(c,S){S&1&&Ro(r,"background",c[2]),S&1&&l!==(l=c[1]+"")&&Tp(p,l)},d(c){c&&an(e)}}}function Gw(t){let e,r=gl(t[0]),s=[];for(let l=0;l{"rows"in l&&r(0,s=l.rows)},[s]}class T2 extends ao{constructor(e){super(),so(this,e,jw,Gw,Cr,{rows:0})}}const Zw=t=>({props:t&8}),Jy=t=>({props:Xw(t[3])});function Hw(t){let e;const r=t[1].default,s=wl(r,t,t[2],Jy);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&12)&&El(s,r,l,l[2],e?Il(r,l[2],p,Zw):Sl(l[2]),Jy)},i(l){e||(dn(s,l),e=!0)},o(l){Fn(s,l),e=!1},d(l){s&&s.d(l)}}}function Ww(t){let e,r;return e=new Zb({props:{openOn:t[0],$$slots:{default:[Hw,({features:s})=>({3:s}),({features:s})=>s?8:0]},$$scope:{ctx:t}}}),{c(){du(e.$$.fragment)},m(s,l){_l(e,s,l),r=!0},p(s,[l]){const p={};l&1&&(p.openOn=s[0]),l&12&&(p.$$scope={dirty:l,ctx:s}),e.$set(p)},i(s){r||(dn(e.$$.fragment,s),r=!0)},o(s){Fn(e.$$.fragment,s),r=!1},d(s){yl(e,s)}}}function Xw(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function Yw(t,e,r){let{$$slots:s={},$$scope:l}=e,{openOn:p="hover"}=e;return t.$$set=f=>{"openOn"in f&&r(0,p=f.openOn),"$$scope"in f&&r(2,l=f.$$scope)},[p,s,l]}class L2 extends ao{constructor(e){super(),so(this,e,Yw,Ww,Cr,{openOn:0})}}function Qy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function $y(t){let e,r,s=t[1]+"",l,p,f,c=t[2]+"",S,L;return{c(){e=sn("tr"),r=sn("td"),l=Cl(s),p=Hi(),f=sn("td"),S=Cl(c),L=Hi()},m(R,N){hn(R,e,N),Cn(e,r),Cn(r,l),Cn(e,p),Cn(e,f),Cn(f,S),Cn(e,L)},p(R,N){N&1&&s!==(s=R[1]+"")&&Tp(l,s),N&1&&c!==(c=R[2]+"")&&Tp(S,c)},d(R){R&&an(e)}}}function Kw(t){let e,r,s=gl(Object.entries(t[0])),l=[];for(let p=0;p{"properties"in l&&r(0,s=l.properties)},[s]}class P2 extends ao{constructor(e){super(),so(this,e,Jw,Kw,Cr,{properties:0})}}function t0(t,e,r){const s=t.slice();return s[3]=e[r],s}function e0(t,e,r){const s=t.slice();return s[6]=e[r],s}function n0(t){let e,r;return{c(){e=sn("span"),r=Cl(`  + `),Ro(e,"background",t[6]),Ro(e,"width","100%"),Ro(e,"border","1px solid black")},m(s,l){hn(s,e,l),Cn(e,r)},p(s,l){l&1&&Ro(e,"background",s[6])},d(s){s&&an(e)}}}function Qw(t){let e,r=t[3]+"",s;return{c(){e=sn("span"),s=Cl(r)},m(l,p){hn(l,e,p),Cn(e,s)},p(l,p){p&2&&r!==(r=l[3]+"")&&Tp(s,r)},d(l){l&&an(e)}}}function $w(t){let e,r=t[3].toFixed(t[2])+"",s;return{c(){e=sn("span"),s=Cl(r)},m(l,p){hn(l,e,p),Cn(e,s)},p(l,p){p&6&&r!==(r=l[3].toFixed(l[2])+"")&&Tp(s,r)},d(l){l&&an(e)}}}function i0(t){let e;function r(p,f){return p[2]>0?$w:Qw}let s=r(t),l=s(t);return{c(){l.c(),e=If()},m(p,f){l.m(p,f),hn(p,e,f)},p(p,f){s===(s=r(p))&&l?l.p(p,f):(l.d(1),l=s(p),l&&(l.c(),l.m(e.parentNode,e)))},d(p){p&&an(e),l.d(p)}}}function t2(t){let e,r,s,l=gl(t[0]),p=[];for(let S=0;S{"colorScale"in f&&r(0,s=f.colorScale),"limits"in f&&r(1,l=f.limits),"decimalPlaces"in f&&r(2,p=f.decimalPlaces)},[s,l,p]}class A2 extends ao{constructor(e){super(),so(this,e,e2,t2,Cr,{colorScale:0,limits:1,decimalPlaces:2})}}function M2(t){let e='poly:"';for(let[s,l]of t.geometry.coordinates[0])e+=`${l} ${s} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function D2(t,e,r){let s=["step",t];for(let l=1;l({}),r0=t=>({}),i2=t=>({}),o0=t=>({});function r2(t){let e,r,s,l;const p=t[1].left,f=wl(p,t,t[0],o0),c=t[1].main,S=wl(c,t,t[0],r0);return{c(){e=sn("div"),f&&f.c(),r=Hi(),s=sn("div"),S&&S.c(),Tn(e,"class","left svelte-6kzmjs"),Tn(s,"class","main svelte-6kzmjs")},m(L,R){hn(L,e,R),f&&f.m(e,null),hn(L,r,R),hn(L,s,R),S&&S.m(s,null),l=!0},p(L,[R]){f&&f.p&&(!l||R&1)&&El(f,p,L,L[0],l?Il(p,L[0],R,i2):Sl(L[0]),o0),S&&S.p&&(!l||R&1)&&El(S,c,L,L[0],l?Il(c,L[0],R,n2):Sl(L[0]),r0)},i(L){l||(dn(f,L),dn(S,L),l=!0)},o(L){Fn(f,L),Fn(S,L),l=!1},d(L){L&&(an(e),an(r),an(s)),f&&f.d(L),S&&S.d(L)}}}function o2(t,e,r){let{$$slots:s={},$$scope:l}=e;return t.$$set=p=>{"$$scope"in p&&r(0,l=p.$$scope)},[l,s]}class R2 extends ao{constructor(e){super(),so(this,e,o2,r2,Cr,{})}}export{oa as $,p0 as A,gy as B,a1 as C,If as D,wr as E,d2 as F,wl as G,C2 as H,i1 as I,El as J,Sl as K,R2 as L,x2 as M,Il as N,cg as O,p2 as P,hg as Q,m2 as R,ao as S,Qr as T,wp as U,u2 as V,c2 as W,D0 as X,dg as Y,is as Z,b1 as _,_l as a,b2 as a0,_2 as a1,t1 as a2,v2 as a3,mp as a4,y2 as a5,D2 as a6,S2 as a7,E2 as a8,L2 as a9,P2 as aa,Tp as ab,mu as ac,r1 as ad,l2 as ae,T2 as af,I2 as ag,A2 as ah,w2 as ai,h2 as aj,a2 as ak,f2 as al,M0 as am,g2 as an,pb as ao,db as ap,M2 as aq,gl as ar,hf as as,Fn as b,du as c,yl as d,sn as e,Hi as f,Cl as g,Tn as h,so as i,Vm as j,pf as k,hn as l,Ps as m,Cn as n,u1 as o,hy as p,yp as q,oh as r,Cr as s,dn as t,sh as u,an as v,Lu as w,Vc as x,f0 as y,Ro as z}; diff --git a/assets/SidebarControls-dfa034e3.js b/assets/SidebarControls-b7959b5d.js similarity index 99% rename from assets/SidebarControls-dfa034e3.js rename to assets/SidebarControls-b7959b5d.js index d1af548..9470489 100644 --- a/assets/SidebarControls-dfa034e3.js +++ b/assets/SidebarControls-b7959b5d.js @@ -1,4 +1,4 @@ -import{S as we,i as ke,s as ye,X as gt,x as rt,y as ut,c as V,a as j,A as ft,t as z,b as R,d as P,Y as ht,G as vt,J as wt,K as kt,N as yt,Z as oe,$ as Se,a0 as tt,a1 as nt,a2 as ge,a3 as St,a4 as I,a5 as lt,f as L,l as h,v,T as U,a6 as Lt,a7 as ct,a8 as _t,D as mt,r as pt,u as dt,a9 as Ee,aa as Ct,g as T,ab as fe,e as b,h as q,n as p,q as M,E as De,w as Fe,ac as Tt,ad as zt,ae as Ot,j as Q,z as ot,V as ie,af as Rt,ag as J,ah as It}from"./Layout-663a57a0.js";function he(t,n){const l={},e={},o={$$scope:1};let i=t.length;for(;i--;){const r=t[i],s=n[i];if(s){for(const a in r)a in s||(e[a]=1);for(const a in s)o[a]||(l[a]=s[a],o[a]=1);t[i]=s}else for(const a in r)o[a]=1}for(const r in e)r in l||(l[r]=void 0);return l}function ve(t){return typeof t=="object"&&t!==null?t:{}}function Mt(t){let n;const l=t[16].default,e=vt(l,t,t[24],null);return{c(){e&&e.c()},m(o,i){e&&e.m(o,i),n=!0},p(o,i){e&&e.p&&(!n||i&16777216)&&wt(e,l,o,o[24],n?yt(l,o[24],i,null):kt(o[24]),null)},i(o){n||(z(e,o),n=!0)},o(o){R(e,o),n=!1},d(o){e&&e.d(o)}}}function Nt(t){let n,l,e;function o(r){t[17](r)}let i={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[Mt]},$$scope:{ctx:t}};return t[0]!==void 0&&(i.hovered=t[0]),n=new gt({props:i}),rt.push(()=>ut(n,"hovered",o)),n.$on("click",t[18]),n.$on("dblclick",t[19]),n.$on("contextmenu",t[20]),n.$on("mouseenter",t[21]),n.$on("mousemove",t[22]),n.$on("mouseleave",t[23]),{c(){V(n.$$.fragment)},m(r,s){j(n,r,s),e=!0},p(r,[s]){const a={};s&2&&(a.id=r[1]),s&4&&(a.source=r[2]),s&8&&(a.sourceLayer=r[3]),s&16&&(a.beforeId=r[4]),s&32&&(a.beforeLayerType=r[5]),s&64&&(a.paint=r[6]),s&128&&(a.layout=r[7]),s&256&&(a.filter=r[8]),s&512&&(a.applyToClusters=r[9]),s&1024&&(a.minzoom=r[10]),s&2048&&(a.maxzoom=r[11]),s&4096&&(a.hoverCursor=r[12]),s&8192&&(a.manageHoverState=r[13]),s&16384&&(a.eventsIfTopMost=r[14]),s&32768&&(a.interactive=r[15]),s&16777216&&(a.$$scope={dirty:s,ctx:r}),!l&&s&1&&(l=!0,a.hovered=r[0],ft(()=>l=!1)),n.$set(a)},i(r){e||(z(n.$$.fragment,r),e=!0)},o(r){R(n.$$.fragment,r),e=!1},d(r){P(n,r)}}}function Ht(t,n,l){let{$$slots:e={},$$scope:o}=n,{id:i=ht("symbol")}=n,{source:r=void 0}=n,{sourceLayer:s=void 0}=n,{beforeId:a=void 0}=n,{beforeLayerType:c=void 0}=n,{paint:w=void 0}=n,{layout:C=void 0}=n,{filter:S=void 0}=n,{applyToClusters:g=void 0}=n,{minzoom:y=void 0}=n,{maxzoom:O=void 0}=n,{hoverCursor:N=void 0}=n,{manageHoverState:u=!1}=n,{hovered:m=null}=n,{eventsIfTopMost:E=!1}=n,{interactive:F=!0}=n;function D(_){m=_,l(0,m)}function k(_){oe.call(this,t,_)}function ce(_){oe.call(this,t,_)}function X(_){oe.call(this,t,_)}function _e(_){oe.call(this,t,_)}function x(_){oe.call(this,t,_)}function se(_){oe.call(this,t,_)}return t.$$set=_=>{"id"in _&&l(1,i=_.id),"source"in _&&l(2,r=_.source),"sourceLayer"in _&&l(3,s=_.sourceLayer),"beforeId"in _&&l(4,a=_.beforeId),"beforeLayerType"in _&&l(5,c=_.beforeLayerType),"paint"in _&&l(6,w=_.paint),"layout"in _&&l(7,C=_.layout),"filter"in _&&l(8,S=_.filter),"applyToClusters"in _&&l(9,g=_.applyToClusters),"minzoom"in _&&l(10,y=_.minzoom),"maxzoom"in _&&l(11,O=_.maxzoom),"hoverCursor"in _&&l(12,N=_.hoverCursor),"manageHoverState"in _&&l(13,u=_.manageHoverState),"hovered"in _&&l(0,m=_.hovered),"eventsIfTopMost"in _&&l(14,E=_.eventsIfTopMost),"interactive"in _&&l(15,F=_.interactive),"$$scope"in _&&l(24,o=_.$$scope)},[m,i,r,s,a,c,w,C,S,g,y,O,N,u,E,F,e,D,k,ce,X,_e,x,se,o]}class qt extends we{constructor(n){super(),ke(this,n,Ht,Nt,ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}let Be=Se(!0),Ve=Se(!1),je=Se(!1),Pe=Se(!1);function it(t){let n,l;return n=new Ee({props:{$$slots:{default:[Dt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Dt(t){let n,l;return n=new Ct({props:{properties:t[10]}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&1024&&(i.properties=e[10]),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Bt(t){let n,l,e=t[2]&&it(t);return{c(){e&&e.c(),n=mt()},m(o,i){e&&e.m(o,i),h(o,n,i),l=!0},p(o,i){o[2]?e?(e.p(o,i),i&4&&z(e,1)):(e=it(o),e.c(),z(e,1),e.m(n.parentNode,n)):e&&(pt(),R(e,1,1,()=>{e=null}),dt())},i(o){l||(z(e),l=!0)},o(o){R(e),l=!1},d(o){o&&v(n),e&&e.d(o)}}}function Vt(t){let n=t[10].origin_count+"",l,e;return{c(){l=T(n),e=T(" routes start here")},m(o,i){h(o,l,i),h(o,e,i)},p(o,i){i&1024&&n!==(n=o[10].origin_count+"")&&fe(l,n)},d(o){o&&(v(l),v(e))}}}function jt(t){let n,l;return n=new Ee({props:{$$slots:{default:[Vt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Pt(t){let n=t[10].destination_count+"",l,e;return{c(){l=T(n),e=T(" routes end here")},m(o,i){h(o,l,i),h(o,e,i)},p(o,i){i&1024&&n!==(n=o[10].destination_count+"")&&fe(l,n)},d(o){o&&(v(l),v(e))}}}function Et(t){let n,l;return n=new Ee({props:{$$slots:{default:[Pt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Ft(t){let n,l,e,o,i,r,s,a;const c=[{id:"input-layer"},t[0],{filter:["==",["geometry-type"],"LineString"]},{manageHoverState:!0},{hoverCursor:t[2]?"pointer":void 0},{paint:{"line-width":t[3],"line-color":t[4]?t[9]:tt,"line-opacity":nt(1,.5)}},{layout:{visibility:t[5]?"visible":"none"}},{beforeId:"Road labels"}];let w={$$slots:{default:[Bt]},$$scope:{ctx:t}};for(let u=0;u",["abs",["get","slope"]],3]]},{minzoom:12},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","slope"],0],180,0],visibility:t[4]?"visible":"none"}}];let S={};for(let u=0;ul(4,i=g)),U(t,Be,g=>l(5,r=g)),U(t,Ve,g=>l(6,s=g)),U(t,je,g=>l(7,a=g));let{sourceOverride:c={}}=n,{controls:w}=n;function C(g){if(!e)return;let y=g.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${y}`,"_blank")}let S=Lt(["abs",["get","slope"]],_t,ct);return t.$$set=g=>{"sourceOverride"in g&&l(0,c=g.sourceOverride),"controls"in g&&l(1,w=g.controls)},t.$$.update=()=>{t.$$.dirty&2&&l(2,e=!w.streetviewOn),t.$$.dirty&2&&l(3,o=Gt(w.maxCount))},[c,w,e,o,i,r,s,a,C,S]}class xt extends we{constructor(n){super(),ke(this,n,Jt,Ft,ye,{sourceOverride:0,controls:1})}}const{window:Kt}=zt;function st(t){let n,l,e,o,i,r,s,a,c,w,C;return c=Ot(t[6][0]),{c(){n=b("div"),l=b("label"),e=b("input"),o=T(` +import{S as we,i as ke,s as ye,X as gt,x as rt,y as ut,c as V,a as j,A as ft,t as z,b as R,d as P,Y as ht,G as vt,J as wt,K as kt,N as yt,Z as oe,$ as Se,a0 as tt,a1 as nt,a2 as ge,a3 as St,a4 as I,a5 as lt,f as L,l as h,v,T as U,a6 as Lt,a7 as ct,a8 as _t,D as mt,r as pt,u as dt,a9 as Ee,aa as Ct,g as T,ab as fe,e as b,h as q,n as p,q as M,E as De,w as Fe,ac as Tt,ad as zt,ae as Ot,j as Q,z as ot,V as ie,af as Rt,ag as J,ah as It}from"./Layout-e3c78437.js";function he(t,n){const l={},e={},o={$$scope:1};let i=t.length;for(;i--;){const r=t[i],s=n[i];if(s){for(const a in r)a in s||(e[a]=1);for(const a in s)o[a]||(l[a]=s[a],o[a]=1);t[i]=s}else for(const a in r)o[a]=1}for(const r in e)r in l||(l[r]=void 0);return l}function ve(t){return typeof t=="object"&&t!==null?t:{}}function Mt(t){let n;const l=t[16].default,e=vt(l,t,t[24],null);return{c(){e&&e.c()},m(o,i){e&&e.m(o,i),n=!0},p(o,i){e&&e.p&&(!n||i&16777216)&&wt(e,l,o,o[24],n?yt(l,o[24],i,null):kt(o[24]),null)},i(o){n||(z(e,o),n=!0)},o(o){R(e,o),n=!1},d(o){e&&e.d(o)}}}function Nt(t){let n,l,e;function o(r){t[17](r)}let i={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[Mt]},$$scope:{ctx:t}};return t[0]!==void 0&&(i.hovered=t[0]),n=new gt({props:i}),rt.push(()=>ut(n,"hovered",o)),n.$on("click",t[18]),n.$on("dblclick",t[19]),n.$on("contextmenu",t[20]),n.$on("mouseenter",t[21]),n.$on("mousemove",t[22]),n.$on("mouseleave",t[23]),{c(){V(n.$$.fragment)},m(r,s){j(n,r,s),e=!0},p(r,[s]){const a={};s&2&&(a.id=r[1]),s&4&&(a.source=r[2]),s&8&&(a.sourceLayer=r[3]),s&16&&(a.beforeId=r[4]),s&32&&(a.beforeLayerType=r[5]),s&64&&(a.paint=r[6]),s&128&&(a.layout=r[7]),s&256&&(a.filter=r[8]),s&512&&(a.applyToClusters=r[9]),s&1024&&(a.minzoom=r[10]),s&2048&&(a.maxzoom=r[11]),s&4096&&(a.hoverCursor=r[12]),s&8192&&(a.manageHoverState=r[13]),s&16384&&(a.eventsIfTopMost=r[14]),s&32768&&(a.interactive=r[15]),s&16777216&&(a.$$scope={dirty:s,ctx:r}),!l&&s&1&&(l=!0,a.hovered=r[0],ft(()=>l=!1)),n.$set(a)},i(r){e||(z(n.$$.fragment,r),e=!0)},o(r){R(n.$$.fragment,r),e=!1},d(r){P(n,r)}}}function Ht(t,n,l){let{$$slots:e={},$$scope:o}=n,{id:i=ht("symbol")}=n,{source:r=void 0}=n,{sourceLayer:s=void 0}=n,{beforeId:a=void 0}=n,{beforeLayerType:c=void 0}=n,{paint:w=void 0}=n,{layout:C=void 0}=n,{filter:S=void 0}=n,{applyToClusters:g=void 0}=n,{minzoom:y=void 0}=n,{maxzoom:O=void 0}=n,{hoverCursor:N=void 0}=n,{manageHoverState:u=!1}=n,{hovered:m=null}=n,{eventsIfTopMost:E=!1}=n,{interactive:F=!0}=n;function D(_){m=_,l(0,m)}function k(_){oe.call(this,t,_)}function ce(_){oe.call(this,t,_)}function X(_){oe.call(this,t,_)}function _e(_){oe.call(this,t,_)}function x(_){oe.call(this,t,_)}function se(_){oe.call(this,t,_)}return t.$$set=_=>{"id"in _&&l(1,i=_.id),"source"in _&&l(2,r=_.source),"sourceLayer"in _&&l(3,s=_.sourceLayer),"beforeId"in _&&l(4,a=_.beforeId),"beforeLayerType"in _&&l(5,c=_.beforeLayerType),"paint"in _&&l(6,w=_.paint),"layout"in _&&l(7,C=_.layout),"filter"in _&&l(8,S=_.filter),"applyToClusters"in _&&l(9,g=_.applyToClusters),"minzoom"in _&&l(10,y=_.minzoom),"maxzoom"in _&&l(11,O=_.maxzoom),"hoverCursor"in _&&l(12,N=_.hoverCursor),"manageHoverState"in _&&l(13,u=_.manageHoverState),"hovered"in _&&l(0,m=_.hovered),"eventsIfTopMost"in _&&l(14,E=_.eventsIfTopMost),"interactive"in _&&l(15,F=_.interactive),"$$scope"in _&&l(24,o=_.$$scope)},[m,i,r,s,a,c,w,C,S,g,y,O,N,u,E,F,e,D,k,ce,X,_e,x,se,o]}class qt extends we{constructor(n){super(),ke(this,n,Ht,Nt,ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}let Be=Se(!0),Ve=Se(!1),je=Se(!1),Pe=Se(!1);function it(t){let n,l;return n=new Ee({props:{$$slots:{default:[Dt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Dt(t){let n,l;return n=new Ct({props:{properties:t[10]}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&1024&&(i.properties=e[10]),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Bt(t){let n,l,e=t[2]&&it(t);return{c(){e&&e.c(),n=mt()},m(o,i){e&&e.m(o,i),h(o,n,i),l=!0},p(o,i){o[2]?e?(e.p(o,i),i&4&&z(e,1)):(e=it(o),e.c(),z(e,1),e.m(n.parentNode,n)):e&&(pt(),R(e,1,1,()=>{e=null}),dt())},i(o){l||(z(e),l=!0)},o(o){R(e),l=!1},d(o){o&&v(n),e&&e.d(o)}}}function Vt(t){let n=t[10].origin_count+"",l,e;return{c(){l=T(n),e=T(" routes start here")},m(o,i){h(o,l,i),h(o,e,i)},p(o,i){i&1024&&n!==(n=o[10].origin_count+"")&&fe(l,n)},d(o){o&&(v(l),v(e))}}}function jt(t){let n,l;return n=new Ee({props:{$$slots:{default:[Vt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Pt(t){let n=t[10].destination_count+"",l,e;return{c(){l=T(n),e=T(" routes end here")},m(o,i){h(o,l,i),h(o,e,i)},p(o,i){i&1024&&n!==(n=o[10].destination_count+"")&&fe(l,n)},d(o){o&&(v(l),v(e))}}}function Et(t){let n,l;return n=new Ee({props:{$$slots:{default:[Pt,({props:e})=>({10:e}),({props:e})=>e?1024:0]},$$scope:{ctx:t}}}),{c(){V(n.$$.fragment)},m(e,o){j(n,e,o),l=!0},p(e,o){const i={};o&3072&&(i.$$scope={dirty:o,ctx:e}),n.$set(i)},i(e){l||(z(n.$$.fragment,e),l=!0)},o(e){R(n.$$.fragment,e),l=!1},d(e){P(n,e)}}}function Ft(t){let n,l,e,o,i,r,s,a;const c=[{id:"input-layer"},t[0],{filter:["==",["geometry-type"],"LineString"]},{manageHoverState:!0},{hoverCursor:t[2]?"pointer":void 0},{paint:{"line-width":t[3],"line-color":t[4]?t[9]:tt,"line-opacity":nt(1,.5)}},{layout:{visibility:t[5]?"visible":"none"}},{beforeId:"Road labels"}];let w={$$slots:{default:[Bt]},$$scope:{ctx:t}};for(let u=0;u",["abs",["get","slope"]],3]]},{minzoom:12},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","slope"],0],180,0],visibility:t[4]?"visible":"none"}}];let S={};for(let u=0;ul(4,i=g)),U(t,Be,g=>l(5,r=g)),U(t,Ve,g=>l(6,s=g)),U(t,je,g=>l(7,a=g));let{sourceOverride:c={}}=n,{controls:w}=n;function C(g){if(!e)return;let y=g.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${y}`,"_blank")}let S=Lt(["abs",["get","slope"]],_t,ct);return t.$$set=g=>{"sourceOverride"in g&&l(0,c=g.sourceOverride),"controls"in g&&l(1,w=g.controls)},t.$$.update=()=>{t.$$.dirty&2&&l(2,e=!w.streetviewOn),t.$$.dirty&2&&l(3,o=Gt(w.maxCount))},[c,w,e,o,i,r,s,a,C,S]}class xt extends we{constructor(n){super(),ke(this,n,Jt,Ft,ye,{sourceOverride:0,controls:1})}}const{window:Kt}=zt;function st(t){let n,l,e,o,i,r,s,a,c,w,C;return c=Ot(t[6][0]),{c(){n=b("div"),l=b("label"),e=b("input"),o=T(` Google StreetView`),i=L(),r=b("label"),s=b("input"),a=T(` Bing Streetside`),q(e,"type","radio"),e.__value="google",Q(e,e.__value),q(s,"type","radio"),s.__value="bing",Q(s,s.__value),c.p(e,s)},m(S,g){h(S,n,g),p(n,l),p(l,e),e.checked=e.__value===t[1],p(l,o),p(n,i),p(n,r),p(r,s),s.checked=s.__value===t[1],p(r,a),w||(C=[M(e,"change",t[5]),M(s,"change",t[7])],w=!0)},p(S,g){g&2&&(e.checked=e.__value===S[1]),g&2&&(s.checked=s.__value===S[1])},d(S){S&&v(n),c.r(),w=!1,Fe(C)}}}function Wt(t){let n,l,e,o,i,r,s,a=t[0]&&st(t);return{c(){n=b("label"),l=b("input"),e=T(` StreetView`),o=L(),a&&a.c(),i=mt(),q(l,"type","checkbox")},m(c,w){h(c,n,w),p(n,l),l.checked=t[0],p(n,e),h(c,o,w),a&&a.m(c,w),h(c,i,w),r||(s=[M(Kt,"keydown",t[2]),M(l,"change",t[4])],r=!0)},p(c,[w]){w&1&&(l.checked=c[0]),c[0]?a?a.p(c,w):(a=st(c),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i:De,o:De,d(c){c&&(v(n),v(o),v(i)),a&&a.d(c),r=!1,Fe(s)}}}function At(t,n,l){let{map:e}=n,{enabled:o=!1}=n,i="google";function r(){e.on("click",a),e.getCanvas().style.cursor="zoom-in"}function s(){e.off("click",a),e.getCanvas().style.cursor="auto"}Tt(s);function a(y){let O=y.lngLat.lng,N=y.lngLat.lat;i=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${N},${O}&cbp=11,0,0,0,0`,"_blank"):i=="bing"&&window.open(`https://www.bing.com/maps?cp=${N}~${O}&style=x`,"_blank")}function c(y){o&&y.key=="Escape"&&l(0,o=!1)}const w=[[]];function C(){o=this.checked,l(0,o)}function S(){i=this.__value,l(1,i)}function g(){i=this.__value,l(1,i)}return t.$$set=y=>{"map"in y&&l(3,e=y.map),"enabled"in y&&l(0,o=y.enabled)},t.$$.update=()=>{t.$$.dirty&1&&(o?r():s())},[o,i,c,e,C,S,w,g]}class Xt extends we{constructor(n){super(),ke(this,n,At,Wt,ye,{map:3,enabled:0})}}function at(t){let n,l,e,o,i,r;return{c(){n=b("div"),l=b("label"),e=b("input"),o=T(` diff --git a/assets/main-c343d383.js b/assets/main-33fcb5ff.js similarity index 98% rename from assets/main-c343d383.js rename to assets/main-33fcb5ff.js index f880497..8d7eab6 100644 --- a/assets/main-c343d383.js +++ b/assets/main-33fcb5ff.js @@ -1,4 +1,4 @@ -import{S as le,i as ae,s as G,m as re,P as se,L as ue,c as O,a as D,t as g,b,d as B,o as pe,H as fe,e as d,f as H,g as z,h as F,j as w,k as me,l as C,n as m,p as K,q as X,r as P,u as R,v as S,w as ce,M as _e,x as U,y as J,z as Z,A as T,_ as de,B as W,F as ge,C as be,D as ie,E as he}from"./Layout-663a57a0.js";import{S as ve,L as Ae}from"./SidebarControls-dfa034e3.js";const we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAm0lEQVRIS+2U0Q2AIAxEYQM30Q3UDXQy3UhHkE0cweuHHxKTXpuQaALJ/cE9eoXGUHjFwv6hAtSEPxFRh2su0Ayd6pWzDUwFO8700AGNVggDaGAqkNYDYQBStBvCAtwQC8AF8QA2kORlJWjQmm4BSB9M5lIyC3CZswC3OQu4PxqVef7TmYikoSs0aQ19GyMMwDp+HvsrQI3v/xFduXoiGbi1DtQAAAAASUVORK5CYII=";let q="pmtilesSource";async function ke(l){let e=await l.getHeader(),o=await l.getMetadata();return{bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],outputMetadata:JSON.parse(o.description),minZoom:e.minZoom,maxZoom:e.maxZoom}}function ye(l,e,o){let{pmtiles:t}=e,{map:n}=e,{outputMetadata:a=null}=e,i=new se;re.addProtocol("pmtiles",i.tile);async function p(s){r(q),i.add(s);let f=await ke(s);n.addSource(q,{type:"vector",tiles:["pmtiles://"+s.source.getKey()+"/{z}/{x}/{y}"],minzoom:f.minZoom,maxzoom:f.maxZoom,bounds:f.bounds}),n.fitBounds(f.bounds,{padding:100,duration:500}),o(0,a=f.outputMetadata)}function r(s){if(n.getSource(s)){let f=[];for(let u of n.getStyle().layers)"source"in u&&u.source==s&&f.push(u.id);for(let u of f)n.removeLayer(u);n.removeSource(s)}}return l.$$set=s=>{"pmtiles"in s&&o(1,t=s.pmtiles),"map"in s&&o(2,n=s.map),"outputMetadata"in s&&o(0,a=s.outputMetadata)},l.$$.update=()=>{l.$$.dirty&2&&(t?p(t):r(q))},[a,t,n]}class $e extends le{constructor(e){super(),ae(this,e,ye,null,G,{pmtiles:1,map:2,outputMetadata:0})}}function x(l){let e,o,t;return{c(){e=z("Open a "),o=d("i"),o.textContent=".pmtiles",t=z(` +import{S as le,i as ae,s as G,m as re,P as se,L as ue,c as O,a as D,t as g,b,d as B,o as pe,H as fe,e as d,f as H,g as z,h as F,j as w,k as me,l as C,n as m,p as K,q as X,r as P,u as R,v as S,w as ce,M as _e,x as U,y as J,z as Z,A as T,_ as de,B as W,F as ge,C as be,D as ie,E as he}from"./Layout-e3c78437.js";import{S as ve,L as Ae}from"./SidebarControls-b7959b5d.js";const we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAm0lEQVRIS+2U0Q2AIAxEYQM30Q3UDXQy3UhHkE0cweuHHxKTXpuQaALJ/cE9eoXGUHjFwv6hAtSEPxFRh2su0Ayd6pWzDUwFO8700AGNVggDaGAqkNYDYQBStBvCAtwQC8AF8QA2kORlJWjQmm4BSB9M5lIyC3CZswC3OQu4PxqVef7TmYikoSs0aQ19GyMMwDp+HvsrQI3v/xFduXoiGbi1DtQAAAAASUVORK5CYII=";let q="pmtilesSource";async function ke(l){let e=await l.getHeader(),o=await l.getMetadata();return{bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],outputMetadata:JSON.parse(o.description),minZoom:e.minZoom,maxZoom:e.maxZoom}}function ye(l,e,o){let{pmtiles:t}=e,{map:n}=e,{outputMetadata:a=null}=e,i=new se;re.addProtocol("pmtiles",i.tile);async function p(s){r(q),i.add(s);let f=await ke(s);n.addSource(q,{type:"vector",tiles:["pmtiles://"+s.source.getKey()+"/{z}/{x}/{y}"],minzoom:f.minZoom,maxzoom:f.maxZoom,bounds:f.bounds}),n.fitBounds(f.bounds,{padding:100,duration:500}),o(0,a=f.outputMetadata)}function r(s){if(n.getSource(s)){let f=[];for(let u of n.getStyle().layers)"source"in u&&u.source==s&&f.push(u.id);for(let u of f)n.removeLayer(u);n.removeSource(s)}}return l.$$set=s=>{"pmtiles"in s&&o(1,t=s.pmtiles),"map"in s&&o(2,n=s.map),"outputMetadata"in s&&o(0,a=s.outputMetadata)},l.$$.update=()=>{l.$$.dirty&2&&(t?p(t):r(q))},[a,t,n]}class $e extends le{constructor(e){super(),ae(this,e,ye,null,G,{pmtiles:1,map:2,outputMetadata:0})}}function x(l){let e,o,t;return{c(){e=z("Open a "),o=d("i"),o.textContent=".pmtiles",t=z(` file produced by the tool. Note this file stays in your browser; it doesn't get uploaded anywhere.`)},m(n,a){C(n,e,a),C(n,o,a),C(n,t,a)},d(n){n&&(S(e),S(o),S(t))}}}function ee(l){let e,o,t;function n(i){l[12](i)}let a={outputMetadata:l[3],map:l[1]};return l[4]!==void 0&&(a.controls=l[4]),e=new ve({props:a}),U.push(()=>J(e,"controls",n)),{c(){O(e.$$.fragment)},m(i,p){D(e,i,p),t=!0},p(i,p){const r={};p&8&&(r.outputMetadata=i[3]),p&2&&(r.map=i[1]),!o&&p&16&&(o=!0,r.controls=i[4],T(()=>o=!1)),e.$set(r)},i(i){t||(g(e.$$.fragment,i),t=!0)},o(i){b(e.$$.fragment,i),t=!1},d(i){B(e,i)}}}function Me(l){let e,o,t,n,a,i,p,r,s,f,u,k,y,$,M,c,A,L,Q,E,V,N,Y,j;o=new fe({props:{app:"main"}});let h=l[2]==null&&x(),_=l[3]&&ee(l);return{c(){e=d("div"),O(o.$$.fragment),t=H(),n=d("label"),h&&h.c(),a=H(),i=d("input"),p=H(),r=d("div"),s=d("label"),f=z(`Or load an example: `),u=d("select"),k=d("option"),k.textContent="Custom file loaded",y=d("option"),y.textContent="Edinburgh",$=d("option"),$.textContent=`England (2011 home-to-work) diff --git a/assets/x2-6e9c0b1b.js b/assets/x2-fbea54a9.js similarity index 98% rename from assets/x2-6e9c0b1b.js rename to assets/x2-fbea54a9.js index 0404505..5542a58 100644 --- a/assets/x2-6e9c0b1b.js +++ b/assets/x2-fbea54a9.js @@ -1,4 +1,4 @@ -import{S as le,i as oe,s as ie,G as ce,e as q,h as J,z as X,l as D,I as $,q as T,J as de,K as pe,N as ge,O as me,t as y,b as C,v as R,w as _e,Q as be,R as he,T as V,U as x,m as we,L as Le,c as z,f as I,a as O,d as P,o as ye,H as Ce,x as G,y as K,g as Y,n as M,A as W,r as ee,u as te,M as ve,_ as ke,V as re,j as ne,D as Me,E as Be,W as Se}from"./Layout-663a57a0.js";import{L as Ee,C as ze,O as Oe,_ as Pe,J as Ie,a as qe,G as De,P as Re}from"./CostFunction-a1f3b94f.js";import{S as Te,L as Je}from"./SidebarControls-dfa034e3.js";function Ne(s){let e,t,o,n,i,r,c;const l=s[18].default,u=ce(l,s,s[17],null);return{c(){e=q("div"),u&&u.c(),J(e,"tabindex",t=s[1]?0:void 0),J(e,"role",o=s[1]?"button":void 0),X(e,"z-index",s[2])},m(a,d){D(a,e,d),u&&u.m(e,null),i=!0,r||(c=[$(s[6].call(null,e)),$(n=je.call(null,e,s[0])),T(e,"click",s[19]),T(e,"dblclick",s[20]),T(e,"contextmenu",s[21]),T(e,"mouseenter",s[22]),T(e,"mouseleave",s[23]),T(e,"mousemove",s[24]),T(e,"keydown",s[7])],r=!0)},p(a,[d]){u&&u.p&&(!i||d&131072)&&de(u,l,a,a[17],i?ge(l,a[17],d,null):pe(a[17]),null),(!i||d&2&&t!==(t=a[1]?0:void 0))&&J(e,"tabindex",t),(!i||d&2&&o!==(o=a[1]?"button":void 0))&&J(e,"role",o),n&&me(n.update)&&d&1&&n.update.call(null,a[0]),d&4&&X(e,"z-index",a[2])},i(a){i||(y(u,a),i=!0)},o(a){C(u,a),i=!1},d(a){a&&R(e),u&&u.d(a),r=!1,_e(c)}}}function je(s,e){const t=s.className;function o(n){n?s.className=`${t} ${n}`:s.className=t}return o(e),{update:o}}function Ae(s,e,t){let o,n,i,{$$slots:r={},$$scope:c}=e,{lngLat:l}=e,{class:u=void 0}=e,{interactive:a=!0}=e,{asButton:d=!1}=e,{draggable:w=!1}=e,{feature:_=null}=e,{offset:B=void 0}=e,{zIndex:m=void 0}=e,{rotation:L=0}=e,{opacity:S=1}=e;const j=be(),{map:A,layerEvent:N,self:b}=he();V(s,A,f=>t(26,i=f)),V(s,N,f=>t(25,o=f)),V(s,b,f=>t(16,n=f));function h(f){x(b,n=new we.Marker({element:f,rotation:L,draggable:w,offset:B,opacity:S.toString()}).setLngLat(l).addTo(i),n);const Z=()=>v("dragstart"),H=()=>{g(),v("drag")},U=()=>{g(),v("dragend")};return w&&(n.on("dragstart",Z),n.on("drag",H),n.on("dragend",U)),{destroy(){w&&(n==null||n.off("dragstart",Z),n==null||n.off("drag",H),n==null||n.off("dragend",U)),n==null||n.remove()}}}function g(){let f=n==null?void 0:n.getLngLat();f&&(Array.isArray(l)?t(9,l=[f.lng,f.lat]):l&&"lon"in l?t(9,l={lon:f.lng,lat:f.lat}):t(9,l=f))}function E(f){f.key===" "&&(f.preventDefault(),f.stopPropagation(),v("click"))}function v(f){if(!a)return;let Z=n==null?void 0:n.getLngLat();if(!Z)return;const H=[Z.lng,Z.lat];let U={map:i,marker:n,lngLat:H,features:[{type:"Feature",properties:(_==null?void 0:_.properties)??{},geometry:{type:"Point",coordinates:H}}]};x(N,o={...U,layerType:"marker",type:f},o),j(f,U)}const F=()=>v("click"),Q=()=>v("dblclick"),p=()=>v("contextmenu"),k=f=>{v("mouseenter")},fe=()=>{v("mouseleave")},ue=()=>v("mousemove");return s.$$set=f=>{"lngLat"in f&&t(9,l=f.lngLat),"class"in f&&t(0,u=f.class),"interactive"in f&&t(10,a=f.interactive),"asButton"in f&&t(1,d=f.asButton),"draggable"in f&&t(11,w=f.draggable),"feature"in f&&t(12,_=f.feature),"offset"in f&&t(13,B=f.offset),"zIndex"in f&&t(2,m=f.zIndex),"rotation"in f&&t(14,L=f.rotation),"opacity"in f&&t(15,S=f.opacity),"$$scope"in f&&t(17,c=f.$$scope)},s.$$.update=()=>{s.$$.dirty&66048&&(n==null||n.setLngLat(l)),s.$$.dirty&73728&&(n==null||n.setOffset(B??[0,0])),s.$$.dirty&81920&&(n==null||n.setRotation(L)),s.$$.dirty&98304&&(n==null||n.setOpacity(S.toString()))},[u,d,m,A,N,b,h,E,v,l,a,w,_,B,L,S,n,c,r,F,Q,p,k,fe,ue]}class Fe extends le{constructor(e){super(),oe(this,e,Ae,Ne,ie,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14,opacity:15})}}const Ze=` +import{S as le,i as oe,s as ie,G as ce,e as q,h as J,z as X,l as D,I as $,q as T,J as de,K as pe,N as ge,O as me,t as y,b as C,v as R,w as _e,Q as be,R as he,T as V,U as x,m as we,L as Le,c as z,f as I,a as O,d as P,o as ye,H as Ce,x as G,y as K,g as Y,n as M,A as W,r as ee,u as te,M as ve,_ as ke,V as re,j as ne,D as Me,E as Be,W as Se}from"./Layout-e3c78437.js";import{L as Ee,C as ze,O as Oe,_ as Pe,J as Ie,a as qe,G as De,P as Re}from"./CostFunction-6f46faef.js";import{S as Te,L as Je}from"./SidebarControls-b7959b5d.js";function Ne(s){let e,t,o,n,i,r,c;const l=s[18].default,u=ce(l,s,s[17],null);return{c(){e=q("div"),u&&u.c(),J(e,"tabindex",t=s[1]?0:void 0),J(e,"role",o=s[1]?"button":void 0),X(e,"z-index",s[2])},m(a,d){D(a,e,d),u&&u.m(e,null),i=!0,r||(c=[$(s[6].call(null,e)),$(n=je.call(null,e,s[0])),T(e,"click",s[19]),T(e,"dblclick",s[20]),T(e,"contextmenu",s[21]),T(e,"mouseenter",s[22]),T(e,"mouseleave",s[23]),T(e,"mousemove",s[24]),T(e,"keydown",s[7])],r=!0)},p(a,[d]){u&&u.p&&(!i||d&131072)&&de(u,l,a,a[17],i?ge(l,a[17],d,null):pe(a[17]),null),(!i||d&2&&t!==(t=a[1]?0:void 0))&&J(e,"tabindex",t),(!i||d&2&&o!==(o=a[1]?"button":void 0))&&J(e,"role",o),n&&me(n.update)&&d&1&&n.update.call(null,a[0]),d&4&&X(e,"z-index",a[2])},i(a){i||(y(u,a),i=!0)},o(a){C(u,a),i=!1},d(a){a&&R(e),u&&u.d(a),r=!1,_e(c)}}}function je(s,e){const t=s.className;function o(n){n?s.className=`${t} ${n}`:s.className=t}return o(e),{update:o}}function Ae(s,e,t){let o,n,i,{$$slots:r={},$$scope:c}=e,{lngLat:l}=e,{class:u=void 0}=e,{interactive:a=!0}=e,{asButton:d=!1}=e,{draggable:w=!1}=e,{feature:_=null}=e,{offset:B=void 0}=e,{zIndex:m=void 0}=e,{rotation:L=0}=e,{opacity:S=1}=e;const j=be(),{map:A,layerEvent:N,self:b}=he();V(s,A,f=>t(26,i=f)),V(s,N,f=>t(25,o=f)),V(s,b,f=>t(16,n=f));function h(f){x(b,n=new we.Marker({element:f,rotation:L,draggable:w,offset:B,opacity:S.toString()}).setLngLat(l).addTo(i),n);const Z=()=>v("dragstart"),H=()=>{g(),v("drag")},U=()=>{g(),v("dragend")};return w&&(n.on("dragstart",Z),n.on("drag",H),n.on("dragend",U)),{destroy(){w&&(n==null||n.off("dragstart",Z),n==null||n.off("drag",H),n==null||n.off("dragend",U)),n==null||n.remove()}}}function g(){let f=n==null?void 0:n.getLngLat();f&&(Array.isArray(l)?t(9,l=[f.lng,f.lat]):l&&"lon"in l?t(9,l={lon:f.lng,lat:f.lat}):t(9,l=f))}function E(f){f.key===" "&&(f.preventDefault(),f.stopPropagation(),v("click"))}function v(f){if(!a)return;let Z=n==null?void 0:n.getLngLat();if(!Z)return;const H=[Z.lng,Z.lat];let U={map:i,marker:n,lngLat:H,features:[{type:"Feature",properties:(_==null?void 0:_.properties)??{},geometry:{type:"Point",coordinates:H}}]};x(N,o={...U,layerType:"marker",type:f},o),j(f,U)}const F=()=>v("click"),Q=()=>v("dblclick"),p=()=>v("contextmenu"),k=f=>{v("mouseenter")},fe=()=>{v("mouseleave")},ue=()=>v("mousemove");return s.$$set=f=>{"lngLat"in f&&t(9,l=f.lngLat),"class"in f&&t(0,u=f.class),"interactive"in f&&t(10,a=f.interactive),"asButton"in f&&t(1,d=f.asButton),"draggable"in f&&t(11,w=f.draggable),"feature"in f&&t(12,_=f.feature),"offset"in f&&t(13,B=f.offset),"zIndex"in f&&t(2,m=f.zIndex),"rotation"in f&&t(14,L=f.rotation),"opacity"in f&&t(15,S=f.opacity),"$$scope"in f&&t(17,c=f.$$scope)},s.$$.update=()=>{s.$$.dirty&66048&&(n==null||n.setLngLat(l)),s.$$.dirty&73728&&(n==null||n.setOffset(B??[0,0])),s.$$.dirty&81920&&(n==null||n.setRotation(L)),s.$$.dirty&98304&&(n==null||n.setOpacity(S.toString()))},[u,d,m,A,N,b,h,E,v,l,a,w,_,B,L,S,n,c,r,F,Q,p,k,fe,ue]}class Fe extends le{constructor(e){super(),oe(this,e,Ae,Ne,ie,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14,opacity:15})}}const Ze=` diff --git a/assets/x3-cebede1f.js b/assets/x3-1e334009.js similarity index 98% rename from assets/x3-cebede1f.js rename to assets/x3-1e334009.js index 08e4eb7..a491f70 100644 --- a/assets/x3-cebede1f.js +++ b/assets/x3-1e334009.js @@ -1,4 +1,4 @@ -import{S as fe,i as pe,s as ue,L as me,c as F,f as E,a as v,l as k,t as g,b as h,v as L,d as M,o as ce,H as _e,x as Q,y as te,e as y,g as W,h as Z,n as b,q as x,A as ne,r as ae,u as ie,M as de,z as U,_ as $e,a0 as ge,a4 as q,a6 as se,C as be,j as Y,k as he,p as le,w as we,ai as ee,a1 as ye,ah as ke,af as Le,ag as D,a3 as Ce,a9 as Se,aa as Fe}from"./Layout-663a57a0.js";import{L as ve,C as Me,O as Ne,_ as Oe,J as Be,a as Ee,G as Pe,P as je}from"./CostFunction-a1f3b94f.js";function oe(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G,J,A,m,p,B,T,H,I;const R=[Te,qe],P=[];function X(o,f){return o[5]=="lts"?0:1}d=X(l),$=P[d]=R[d](l);function V(o){l[23](o)}let z={};return l[1]!==void 0&&(z.cost=l[1]),p=new Ee({props:z}),Q.push(()=>te(p,"cost",V)),{c(){e=y("hr"),n=E(),t=y("div"),r=y("label"),s=W(`Color edges by: +import{S as fe,i as pe,s as ue,L as me,c as F,f as E,a as v,l as k,t as g,b as h,v as L,d as M,o as ce,H as _e,x as Q,y as te,e as y,g as W,h as Z,n as b,q as x,A as ne,r as ae,u as ie,M as de,z as U,_ as $e,a0 as ge,a4 as q,a6 as se,C as be,j as Y,k as he,p as le,w as we,ai as ee,a1 as ye,ah as ke,af as Le,ag as D,a3 as Ce,a9 as Se,aa as Fe}from"./Layout-e3c78437.js";import{L as ve,C as Me,O as Ne,_ as Oe,J as Be,a as Ee,G as Pe,P as je}from"./CostFunction-6f46faef.js";function oe(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G,J,A,m,p,B,T,H,I;const R=[Te,qe],P=[];function X(o,f){return o[5]=="lts"?0:1}d=X(l),$=P[d]=R[d](l);function V(o){l[23](o)}let z={};return l[1]!==void 0&&(z.cost=l[1]),p=new Ee({props:z}),Q.push(()=>te(p,"cost",V)),{c(){e=y("hr"),n=E(),t=y("div"),r=y("label"),s=W(`Color edges by: `),a=y("select"),i=y("option"),i.textContent="LTS",u=y("option"),u.textContent="Edge cost (relative to length)",w=y("option"),w.textContent="Nearby amenities",c=E(),$.c(),_=E(),N=y("div"),O=y("label"),C=y("input"),G=W(` Show cyclists not allowed`),J=E(),A=y("hr"),m=E(),F(p.$$.fragment),i.__value="lts",Y(i,i.__value),u.__value="cost",Y(u,u.__value),w.__value="nearby_amenities",Y(w,w.__value),l[5]===void 0&&he(()=>l[21].call(a)),Z(C,"type","checkbox"),U(O,"color",q.lts_not_allowed)},m(o,f){k(o,e,f),k(o,n,f),k(o,t,f),b(t,r),b(r,s),b(r,a),b(a,i),b(a,u),b(a,w),le(a,l[5],!0),k(o,c,f),P[d].m(o,f),k(o,_,f),k(o,N,f),b(N,O),b(O,C),C.checked=l[6],b(O,G),k(o,J,f),k(o,A,f),k(o,m,f),v(p,o,f),T=!0,H||(I=[x(a,"change",l[21]),x(C,"change",l[22])],H=!0)},p(o,f){f&32&&le(a,o[5]);let S=d;d=X(o),d===S?P[d].p(o,f):(ae(),h(P[S],1,1,()=>{P[S]=null}),ie(),$=P[d],$?$.p(o,f):($=P[d]=R[d](o),$.c()),g($,1),$.m(_.parentNode,_)),f&64&&(C.checked=o[6]);const j={};!B&&f&2&&(B=!0,j.cost=o[1],ne(()=>B=!1)),p.$set(j)},i(o){T||(g($),g(p.$$.fragment,o),T=!0)},o(o){h($),h(p.$$.fragment,o),T=!1},d(o){o&&(L(e),L(n),L(t),L(c),L(_),L(N),L(J),L(A),L(m)),P[d].d(o),M(p,o),H=!1,we(I)}}}function qe(l){let e,n;return e=new ke({props:{colorScale:ee,limits:K(l[5],l[9],l[10]),decimalPlaces:1}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&1568&&(s.limits=K(t[5],t[9],t[10])),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function Te(l){let e,n,t,r;return e=new Le({props:{rows:[[`${D.lts1}: ${l[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${l[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${l[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${l[8][4].toFixed(0)}%`,q.lts4]]}}),{c(){F(e.$$.fragment),n=E(),t=y("p"),t.innerHTML='Note: LTS model from BikeOttawa'},m(s,a){v(e,s,a),k(s,n,a),k(s,t,a),r=!0},p(s,a){const i={};a&256&&(i.rows=[[`${D.lts1}: ${s[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${s[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${s[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${s[8][4].toFixed(0)}%`,q.lts4]]),e.$set(i)},i(s){r||(g(e.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),r=!1},d(s){s&&(L(n),L(t)),M(e,s)}}}function Je(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G;n=new _e({props:{app:"costs"}});function J(p){l[18](p)}let A={};l[0]!==void 0&&(A.example=l[0]),c=new Me({props:A}),Q.push(()=>te(c,"example",J)),_=new Ne({props:{map:l[2]}}),_.$on("gotXml",l[15]),_.$on("loading",l[19]),_.$on("error",l[20]);let m=l[3]&&oe(l);return{c(){e=y("div"),F(n.$$.fragment),t=E(),r=y("label"),s=W("Open an "),a=y("i"),a.textContent=".osm.pbf",i=W(` file diff --git a/edge_cost.html b/edge_cost.html index 9d8feb8..6a22634 100644 --- a/edge_cost.html +++ b/edge_cost.html @@ -4,9 +4,9 @@ od2net edge cost mode - - - + + + diff --git a/index.html b/index.html index 4dd6bac..8a513ba 100644 --- a/index.html +++ b/index.html @@ -4,9 +4,9 @@ od2net - - - + + + diff --git a/interactive.html b/interactive.html index 6baca6b..6e469c4 100644 --- a/interactive.html +++ b/interactive.html @@ -4,10 +4,10 @@ od2net interactive mode - - - - + + + +